Sfoglia il codice sorgente

* handle all operand combinations of xadd, resolves #21146

git-svn-id: trunk@20177 -
florian 13 anni fa
parent
commit
fc569e224d

+ 1 - 0
.gitattributes

@@ -12174,6 +12174,7 @@ tests/webtbs/tw21044.pp svneol=native#text/pascal
 tests/webtbs/tw21073.pp svneol=native#text/plain
 tests/webtbs/tw2109.pp svneol=native#text/plain
 tests/webtbs/tw2110.pp svneol=native#text/plain
+tests/webtbs/tw21146.pp svneol=native#text/pascal
 tests/webtbs/tw2128.pp svneol=native#text/plain
 tests/webtbs/tw2129.pp svneol=native#text/plain
 tests/webtbs/tw2129b.pp svneol=native#text/plain

+ 1 - 1
compiler/i386/i386nop.inc

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

+ 21 - 0
compiler/i386/i386tab.inc

@@ -5705,6 +5705,27 @@
     code    : #2#15#192#65;
     flags   : if_486
   ),
+  (
+    opcode  : A_XADD;
+    ops     : 2;
+    optypes : (ot_reg8,ot_reg8,ot_none,ot_none);
+    code    : #2#15#192#65;
+    flags   : if_486
+  ),
+  (
+    opcode  : A_XADD;
+    ops     : 2;
+    optypes : (ot_reg16,ot_reg16,ot_none,ot_none);
+    code    : #208#2#15#193#65;
+    flags   : if_486
+  ),
+  (
+    opcode  : A_XADD;
+    ops     : 2;
+    optypes : (ot_reg32,ot_reg32,ot_none,ot_none);
+    code    : #209#2#15#193#65;
+    flags   : if_486
+  ),
   (
     opcode  : A_XBTS;
     ops     : 2;

+ 4 - 0
compiler/x86/x86ins.dat

@@ -2022,6 +2022,10 @@ void                  \2\x0F\x30                      PENT,PRIV
 (Ch_All, Ch_None, Ch_None)
 mem,reg16|32|64       \320\2\x0F\xC1\101              486,SM
 rm8,reg8              \2\x0F\xC0\101                  486
+reg8,reg8             \2\x0F\xC0\101                  486
+reg16,reg16           \320\2\x0F\xC1\101              486
+reg32,reg32           \321\2\x0F\xC1\101              486
+reg64,reg64           \320\2\x0F\xC1\101              X86_64
 
 [XBTS,xbtsX]
 (Ch_All, Ch_None, Ch_None)

+ 1 - 1
compiler/x86_64/x8664nop.inc

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

+ 28 - 0
compiler/x86_64/x8664tab.inc

@@ -5614,6 +5614,34 @@
     code    : #2#15#192#65;
     flags   : if_486
   ),
+  (
+    opcode  : A_XADD;
+    ops     : 2;
+    optypes : (ot_reg8,ot_reg8,ot_none,ot_none);
+    code    : #2#15#192#65;
+    flags   : if_486
+  ),
+  (
+    opcode  : A_XADD;
+    ops     : 2;
+    optypes : (ot_reg16,ot_reg16,ot_none,ot_none);
+    code    : #208#2#15#193#65;
+    flags   : if_486
+  ),
+  (
+    opcode  : A_XADD;
+    ops     : 2;
+    optypes : (ot_reg32,ot_reg32,ot_none,ot_none);
+    code    : #209#2#15#193#65;
+    flags   : if_486
+  ),
+  (
+    opcode  : A_XADD;
+    ops     : 2;
+    optypes : (ot_reg64,ot_reg64,ot_none,ot_none);
+    code    : #208#2#15#193#65;
+    flags   : if_x86_64
+  ),
   (
     opcode  : A_XBTS;
     ops     : 2;

+ 43 - 0
tests/webtbs/tw21146.pp

@@ -0,0 +1,43 @@
+{ %cpu=i386,x86_64 }
+{ %norun }
+{$goto on}
+var
+{$ifdef cpux86_64}
+  a : array[0..31] of byte =
+                             ($0F,$C1,$C6,$66,$0F,$C1,$C6,$0F,$C0,$D8,$0F,$C1,$34,$24,$66,$0F,$C1,$34,$24,
+                              $0F,$C0,$04,$24,$48,$0F,$C1,$C6,$48,$0F,$C1,$04,$24);
+{$else cpux86_64}
+  a : array[0..22] of byte =
+                             ($0f,$c1,$c6,$66,$0f,$c1,$c6,$0f,$c0,$d8,$0f,$c1,$34,$24,$66,$0f,$c1,$34,$24,
+                              $0f,$c0,$04,$24);
+{$endif cpux86_64}
+
+
+var
+  p : pointer;
+  i : longint;
+label
+  l;
+begin
+l:
+  asm
+    xaddl %eax,%esi
+    xaddw %ax,%si
+    xaddb %bl,%al
+{$ifdef cpux86_64}
+    xaddl %esi,(%rsp)
+    xaddw %si,(%rsp)
+    xaddb %al,(%rsp)
+    xaddq %rax,%rsi
+    xaddq %rax,(%rsp)
+{$else cpux86_64}
+    xaddl %esi,(%esp)
+    xaddw %si,(%esp)
+    xaddb %al,(%esp)
+{$endif cpux86_64}
+  end;
+  for i:=low(a) to high(a) do
+    if pbyte(@l+i)^<>a[i] then
+      halt(1);
+  writeln('ok');
+end.