Переглянути джерело

* don't force OT_BITS32 on x86-64, resolves #16622

git-svn-id: trunk@15595 -
florian 15 роки тому
батько
коміт
9affb070b8
3 змінених файлів з 31 додано та 3 видалено
  1. 1 0
      .gitattributes
  2. 8 3
      compiler/x86/rax86.pas
  3. 22 0
      tests/webtbs/tw16622.pp

+ 1 - 0
.gitattributes

@@ -10529,6 +10529,7 @@ tests/webtbs/tw16377.pp svneol=native#text/plain
 tests/webtbs/tw16402.pp svneol=native#text/plain
 tests/webtbs/tw1658.pp svneol=native#text/plain
 tests/webtbs/tw16592.pp svneol=native#text/plain
+tests/webtbs/tw16622.pp svneol=native#text/pascal
 tests/webtbs/tw16668.pp svneol=native#text/plain
 tests/webtbs/tw16700.pp svneol=native#text/plain
 tests/webtbs/tw16757.pp svneol=native#text/plain

+ 8 - 3
compiler/x86/rax86.pas

@@ -734,11 +734,16 @@ begin
                    OS_64,OS_S64:
                      begin
                        { Only FPU operations know about 64bit values, for all
-                         integer operations it is seen as 32bit }
+                         integer operations it is seen as 32bit
+
+                         this applies only to i386, see tw16622}
                        if gas_needsuffix[opcode] in [attsufFPU,attsufFPUint] then
                          asize:=OT_BITS64
+{$ifdef i386}
                        else
-                         asize:=OT_BITS32;
+                         asize:=OT_BITS32
+{$endif i386}
+                         ;
                      end;
                    OS_F64,OS_C64 :
                      asize:=OT_BITS64;
@@ -754,7 +759,7 @@ begin
  { Condition ? }
   if condition<>C_None then
    ai.SetCondition(condition);
-  
+
   { Set is_jmp, it enables asmwriter to emit short jumps if appropriate }
   if (opcode=A_JMP) or (opcode=A_JCC) then
     ai.is_jmp := True;

+ 22 - 0
tests/webtbs/tw16622.pp

@@ -0,0 +1,22 @@
+{ %cpu=x86_64 }
+{$asmmode intel}
+procedure test;
+var
+  TestVar : Int64;
+begin
+  TestVar:=1234123412341234;
+  asm
+    MOV RAX,0
+    LEA RBX,TestVar
+    MOV QWORD [RBX],RAX
+  end;
+  writeln(TestVar);
+  if TestVar<>0 then
+    halt(1);
+end;
+
+begin
+  test;
+  writeln('ok');
+end.
+