Przeglądaj źródła

* fixed in-code for big endian systems and smallsets < 4 bytes
(fixes tbs/tb0219 on big endian systems after r14177)

git-svn-id: trunk@14206 -

Jonas Maebe 15 lat temu
rodzic
commit
749e791768
1 zmienionych plików z 13 dodań i 5 usunięć
  1. 13 5
      compiler/ncgset.pas

+ 13 - 5
compiler/ncgset.pas

@@ -390,11 +390,19 @@ implementation
                   { load left in register }
                   location_force_reg(current_asmdata.CurrAsmList,left.location,location.size,true);
                   register_maybe_adjust_setbase(current_asmdata.CurrAsmList,left.location,setbase);
-                  location_force_reg(current_asmdata.CurrAsmList,right.location,opsize,true);
-                  { emit bit test operation }
-                  cg.a_bit_test_reg_reg_reg(current_asmdata.CurrAsmList,
-                    left.location.size,right.location.size,location.size,
-                    left.location.register,right.location.register,location.register);
+                  { emit bit test operation -- warning: do not use
+                    location_force_reg() to force a set into a register, except
+                    to a register of the same size as the set. The reason is
+                    that on big endian systems, this would require moving the
+                    set to the most significant part of the new register,
+                    and location_force_register can't do that (it does not
+                    know the type).
+
+                   a_bit_test_reg_loc_reg() properly takes into account the
+                   size of the set to adjust the register index to test }
+                  cg.a_bit_test_reg_loc_reg(current_asmdata.CurrAsmList,
+                    left.location.size,location.size,
+                    left.location.register,right.location,location.register);
 
                   { now zero the result if left > nr_of_bits_in_right_register }
                   hr := cg.getintregister(current_asmdata.CurrAsmList,location.size);