mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 07:09:23 +02:00
+ test lea with non-native address sizes (16-bit on i386, 32-bit on x86_64)
git-svn-id: trunk@37410 -
This commit is contained in:
parent
92a52a9f4d
commit
8ba4de3885
@ -3,6 +3,7 @@
|
|||||||
program tlea1;
|
program tlea1;
|
||||||
|
|
||||||
{$ASMMODE intel}
|
{$ASMMODE intel}
|
||||||
|
{$define 16BITADDRSUPPORT}
|
||||||
|
|
||||||
procedure Fail;
|
procedure Fail;
|
||||||
begin
|
begin
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
program tlea2;
|
program tlea2;
|
||||||
|
|
||||||
{$ASMMODE intel}
|
{$ASMMODE intel}
|
||||||
|
{$define 32BITADDRSUPPORT}
|
||||||
|
|
||||||
procedure Fail;
|
procedure Fail;
|
||||||
begin
|
begin
|
||||||
@ -58,9 +59,64 @@ begin
|
|||||||
Fail;
|
Fail;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef 32BITADDRSUPPORT}
|
||||||
|
procedure TestO64A32;
|
||||||
|
var
|
||||||
|
res: QWord;
|
||||||
|
begin
|
||||||
|
Writeln('Testing LEA with 64-bit operand size and 32-bit address size...');
|
||||||
|
asm
|
||||||
|
mov rcx, 0deadbeefdeadbeefh
|
||||||
|
mov rdi, 0abcdefedcbabcdefh
|
||||||
|
mov rbx, 05566778899aabbcch
|
||||||
|
lea rbx, [ecx + edi * 8 + 12345678h]
|
||||||
|
mov res, rbx
|
||||||
|
end ['RBX', 'RCX', 'RDI'];
|
||||||
|
if res <> $4E4084DF then
|
||||||
|
Fail;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TestO32A32;
|
||||||
|
var
|
||||||
|
res: QWord;
|
||||||
|
begin
|
||||||
|
Writeln('Testing LEA with 32-bit operand size and 32-bit address size...');
|
||||||
|
asm
|
||||||
|
mov rcx, 0deadbeefdeadbeefh
|
||||||
|
mov rdi, 0abcdefedcbabcdefh
|
||||||
|
mov rbx, 05566778899aabbcch
|
||||||
|
lea ebx, [ecx + edi * 8 + 12345678h]
|
||||||
|
mov res, rbx
|
||||||
|
end ['RBX', 'RCX', 'RDI'];
|
||||||
|
if res <> $4E4084DF then
|
||||||
|
Fail;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TestO16A32;
|
||||||
|
var
|
||||||
|
res: QWord;
|
||||||
|
begin
|
||||||
|
Writeln('Testing LEA with 16-bit operand size and 32-bit address size...');
|
||||||
|
asm
|
||||||
|
mov rcx, 0deadbeefdeadbeefh
|
||||||
|
mov rdi, 0abcdefedcbabcdefh
|
||||||
|
mov rbx, 05566778899aabbcch
|
||||||
|
lea bx, [ecx + edi * 8 + 12345678h]
|
||||||
|
mov res, rbx
|
||||||
|
end ['RBX', 'RCX', 'RDI'];
|
||||||
|
if res <> $5566778899AA84DF then
|
||||||
|
Fail;
|
||||||
|
end;
|
||||||
|
{$endif 32BITADDRSUPPORT}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
TestO64A64;
|
TestO64A64;
|
||||||
TestO32A64;
|
TestO32A64;
|
||||||
TestO16A64;
|
TestO16A64;
|
||||||
|
{$ifdef 32BITADDRSUPPORT}
|
||||||
|
TestO64A32;
|
||||||
|
TestO32A32;
|
||||||
|
TestO16A32;
|
||||||
|
{$endif 32BITADDRSUPPORT}
|
||||||
Writeln('Success!');
|
Writeln('Success!');
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user