Ver Fonte

* x86-64: correctly translate and with large constants in mod optimizations, resolves #38164

git-svn-id: trunk@47805 -
florian há 4 anos atrás
pai
commit
80f87edffd
3 ficheiros alterados com 15 adições e 1 exclusões
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/x86/nx86mat.pas
  3. 13 0
      tests/webtbs/tw38164.pp

+ 1 - 0
.gitattributes

@@ -18608,6 +18608,7 @@ tests/webtbs/tw3814.pp svneol=native#text/plain
 tests/webtbs/tw38145a.pp svneol=native#text/pascal
 tests/webtbs/tw38145b.pp svneol=native#text/pascal
 tests/webtbs/tw38151.pp svneol=native#text/pascal
+tests/webtbs/tw38164.pp svneol=native#text/pascal
 tests/webtbs/tw38201.pp svneol=native#text/pascal
 tests/webtbs/tw38202.pp svneol=native#text/pascal
 tests/webtbs/tw3827.pp svneol=native#text/plain

+ 1 - 1
compiler/x86/nx86mat.pas

@@ -624,7 +624,7 @@ interface
                 cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,cgsize,resultdef.size*8-power,hreg2,hreg2);
               end;
             emit_reg_reg(A_ADD,opsize,hreg1,hreg2);
-            emit_const_reg(A_AND,opsize,not((aint(1) shl power)-1),hreg2);
+            cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_AND,cgsize,not((aint(1) shl power)-1),hreg2);
             emit_reg_reg(A_SUB,opsize,hreg2,hreg1);
             location.register:=hreg1;
           end

+ 13 - 0
tests/webtbs/tw38164.pp

@@ -0,0 +1,13 @@
+program int64modint64bug;
+{$mode delphi}
+const
+   a = int64($100000000);
+ var
+   b: int64 = 123;
+   c: int64;
+begin
+  c := b mod a;
+  if c <> 0 then
+  begin
+  end;
+end.