Przeglądaj źródła

* don't change a sequence of shifts and sub/adds into a lea() in case
the flags are read afterwards (broke shldl/sub/sbb sequence generated
for 64 bit "*2", which appears in bitpacked size calculation)

git-svn-id: trunk@7336 -

Jonas Maebe 18 lat temu
rodzic
commit
20206500aa
3 zmienionych plików z 13 dodań i 1 usunięć
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/i386/popt386.pas
  3. 9 0
      tests/test/tprec14.pp

+ 1 - 0
.gitattributes

@@ -6879,6 +6879,7 @@ tests/test/tprec10.pp svneol=native#text/plain
 tests/test/tprec11.pp svneol=native#text/plain
 tests/test/tprec12.pp svneol=native#text/plain
 tests/test/tprec13.pp svneol=native#text/plain
+tests/test/tprec14.pp svneol=native#text/plain
 tests/test/tprec2.pp svneol=native#text/plain
 tests/test/tprec3.pp svneol=native#text/plain
 tests/test/tprec4.pp svneol=native#text/plain

+ 3 - 1
compiler/i386/popt386.pas

@@ -1497,7 +1497,9 @@ begin
                                  (((taicpu(hp1).opcode = A_INC) or
                                    (taicpu(hp1).opcode = A_DEC)) and
                                   (taicpu(hp1).oper[0]^.typ = Top_Reg) and
-                                  (taicpu(hp1).oper[0]^.reg = taicpu(p).oper[1]^.reg))) Do
+                                  (taicpu(hp1).oper[0]^.reg = taicpu(p).oper[1]^.reg))) and
+                                (not GetNextInstruction(hp1,hp2) or
+                                 not instrReadsFlags(hp2)) Do
                             begin
                               TmpBool1 := False;
                               if (taicpu(hp1).oper[0]^.typ = Top_Const) then

+ 9 - 0
tests/test/tprec14.pp

@@ -0,0 +1,9 @@
+type
+  tr = bitpacked record
+    l: longint;
+  end;
+
+begin
+  if bitsizeof(tr) <> 32 then
+    halt(1);
+end.