Prechádzať zdrojové kódy

* support for the CDQE instruction, by Emelyanov Roman, resolves #30978

git-svn-id: trunk@34982 -
florian 8 rokov pred
rodič
commit
48fbd569fd

+ 2 - 0
.gitattributes

@@ -15270,6 +15270,8 @@ tests/webtbs/tw30936a.pp svneol=native#text/pascal
 tests/webtbs/tw30936b.pp svneol=native#text/pascal
 tests/webtbs/tw30936c.pp svneol=native#text/pascal
 tests/webtbs/tw30948.pp svneol=native#text/plain
+tests/webtbs/tw30978.pp svneol=native#text/pascal
+tests/webtbs/tw30978a.pp svneol=native#text/pascal
 tests/webtbs/tw3101.pp svneol=native#text/plain
 tests/webtbs/tw3104.pp svneol=native#text/plain
 tests/webtbs/tw3109.pp svneol=native#text/plain

+ 4 - 0
compiler/x86/x86ins.dat

@@ -3058,6 +3058,10 @@ reg64,reg32           \326\1\x63\110                  X86_64
 (Ch_MRAX, Ch_WRDX, Ch_None)
 void                  \326\1\x99                      X86_64
 
+[CDQE,cltq]
+(Ch_MRAX, Ch_None, Ch_None)
+void                  \326\1\x98                      X86_64
+
 [CMPXCHG16B,cmpxchg16bX]
 (Ch_All, Ch_None, Ch_None)
 mem                   \326\2\x0F\xC7\201              X86_64

+ 1 - 0
compiler/x86_64/x8664ats.inc

@@ -578,6 +578,7 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
 attsufINT,
 attsufNONE,
 attsufNONE,

+ 1 - 0
compiler/x86_64/x8664att.inc

@@ -578,6 +578,7 @@
 'movabs',
 'movslq',
 'cqto',
+'cltq',
 'cmpxchg16b',
 'movntss',
 'movntsd',

+ 1 - 0
compiler/x86_64/x8664int.inc

@@ -578,6 +578,7 @@
 'movabs',
 'movsxd',
 'cqo',
+'cdqe',
 'cmpxchg16b',
 'movntss',
 'movntsd',

+ 1 - 1
compiler/x86_64/x8664nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-1980;
+1981;

+ 1 - 0
compiler/x86_64/x8664op.inc

@@ -578,6 +578,7 @@ A_RDM,
 A_MOVABS,
 A_MOVSXD,
 A_CQO,
+A_CDQE,
 A_CMPXCHG16B,
 A_MOVNTSS,
 A_MOVNTSD,

+ 1 - 0
compiler/x86_64/x8664pro.inc

@@ -578,6 +578,7 @@
 (Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
 (Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
 (Ch: (Ch_MRAX, Ch_WRDX, Ch_None)),
+(Ch: (Ch_MRAX, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),

+ 7 - 0
compiler/x86_64/x8664tab.inc

@@ -7749,6 +7749,13 @@
     code    : #214#1#153;
     flags   : if_x86_64
   ),
+  (
+    opcode  : A_CDQE;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #214#1#152;
+    flags   : if_x86_64
+  ),
   (
     opcode  : A_CMPXCHG16B;
     ops     : 1;

+ 26 - 0
tests/webtbs/tw30978.pp

@@ -0,0 +1,26 @@
+{ %cpu=x86_64 }
+
+procedure p1;assembler;nostackframe;
+  asm
+    cltq
+  end;
+
+const
+  test_expected : array[0..1] of byte = (
+    $48,$98);
+
+var
+  i : longint;
+
+
+begin
+  for i:=0 to high(test_expected) do
+    if test_expected[i]<>pbyte(@p1)[i] then
+      begin
+        writeln('mismatch at offset $',hexstr(i,4), ', expected=$',
+          hexstr(test_expected[i],2),' actual=$',hexstr(pbyte(@p1)[i],2));
+        halt(1);
+      end;
+  writeln('ok');
+end.
+

+ 28 - 0
tests/webtbs/tw30978a.pp

@@ -0,0 +1,28 @@
+{ %cpu=x86_64 }
+
+{$asmmode intel}
+
+procedure p1;assembler;nostackframe;
+  asm
+    cdqe
+  end;
+
+const
+  test_expected : array[0..1] of byte = (
+    $48,$98);
+
+var
+  i : longint;
+
+
+begin
+  for i:=0 to high(test_expected) do
+    if test_expected[i]<>pbyte(@p1)[i] then
+      begin
+        writeln('mismatch at offset $',hexstr(i,4), ', expected=$',
+          hexstr(test_expected[i],2),' actual=$',hexstr(pbyte(@p1)[i],2));
+        halt(1);
+      end;
+  writeln('ok');
+end.
+