fpc/tests/test/tcmov1.pp
sergei f97f223de6 x86_64 assembler reader improvements:
+ Added new value TAttSuffix.attsufINTdual, assigned it to movsX and movzX instructions
* Moved suffix-to-size translation tables from rax86att.pas to itcpugas.pas
+ Added x86_64 specific suffix-to-size translation, enabling BQ and WQ suffixes (LQ seems unnecessary at the moment)
* Fixed logic of tx86attreader.is_asmopcode so it only assigns dual suffix to instructions that explicitly allow it. This disambiguates cases like movsbq=movs+bq vs. cmovbq=cmovb+q
* As a net result: movz[bw]q and movs[bw]q now compile for x86_64; cmovbw and cmovbl which were incorrectly handled for i386 are now fixed.
+ Test for correct assembling of cmov.

git-svn-id: trunk@17353 -
2011-04-20 11:18:13 +00:00

37 lines
856 B
ObjectPascal

{ %CPU=x86_64 }
{$mode objfpc}{$asmmode att}
// Test correct assembling of cmov instructions
// they should receive condition and size separately,
// iow cmovbq should not be processed as cmov+bq
function test: Pointer; assembler; nostackframe;
asm
jmp .L3
.L1:
cmovbq %rcx,%rax // 48 0f 42 c1
cmovbl %ecx,%eax // 0f 42 c1
cmovbw %cx,%ax // 66 0f 42 c1
cmovlq %rcx,%rax // 48 0f 4c c1
.L3:
lea .L1(%rip), %rax
end;
var
x: PByte;
begin
x := test;
if (x[0]<>$48) or (x[1]<>$0F) or (x[2]<>$42) or (x[3]<>$C1) then
Halt(1);
Inc(x,4);
if (x[0]<>$0F) or (x[1]<>$42) or (x[2]<>$C1) then
Halt(2);
Inc(x,3);
if (x[0]<>$66) or (x[1]<>$0F) or (x[2]<>$42) or (x[3]<>$C1) then
Halt(3);
Inc(x,4);
if (x[0]<>$48) or (x[1]<>$0F) or (x[2]<>$4C) or (x[3]<>$C1) then
Halt(4);
end.