From fc569e224d5ac7df50f46e69ebe9d7584d1f667a Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 25 Jan 2012 21:26:59 +0000 Subject: [PATCH] * handle all operand combinations of xadd, resolves #21146 git-svn-id: trunk@20177 - --- .gitattributes | 1 + compiler/i386/i386nop.inc | 2 +- compiler/i386/i386tab.inc | 21 ++++++++++++++++++ compiler/x86/x86ins.dat | 4 ++++ compiler/x86_64/x8664nop.inc | 2 +- compiler/x86_64/x8664tab.inc | 28 +++++++++++++++++++++++ tests/webtbs/tw21146.pp | 43 ++++++++++++++++++++++++++++++++++++ 7 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 tests/webtbs/tw21146.pp diff --git a/.gitattributes b/.gitattributes index 579e70661c..0793b6d67f 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/i386/i386nop.inc b/compiler/i386/i386nop.inc index 69f2343600..148db9c7eb 100644 --- a/compiler/i386/i386nop.inc +++ b/compiler/i386/i386nop.inc @@ -1,2 +1,2 @@ { don't edit, this file is generated from x86ins.dat } -1205; +1208; diff --git a/compiler/i386/i386tab.inc b/compiler/i386/i386tab.inc index f3df187bdc..0c427a24a4 100644 --- a/compiler/i386/i386tab.inc +++ b/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; diff --git a/compiler/x86/x86ins.dat b/compiler/x86/x86ins.dat index 662ac07f0c..0192216535 100644 --- a/compiler/x86/x86ins.dat +++ b/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) diff --git a/compiler/x86_64/x8664nop.inc b/compiler/x86_64/x8664nop.inc index 011999b15f..c2713bb5c9 100644 --- a/compiler/x86_64/x8664nop.inc +++ b/compiler/x86_64/x8664nop.inc @@ -1,2 +1,2 @@ { don't edit, this file is generated from x86ins.dat } -1215; +1219; diff --git a/compiler/x86_64/x8664tab.inc b/compiler/x86_64/x8664tab.inc index 188e47e1ca..5a89969928 100644 --- a/compiler/x86_64/x8664tab.inc +++ b/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; diff --git a/tests/webtbs/tw21146.pp b/tests/webtbs/tw21146.pp new file mode 100644 index 0000000000..61cec8108b --- /dev/null +++ b/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.