+ support LEA with 16-bit operand size

git-svn-id: trunk@25808 -
This commit is contained in:
nickysn 2013-10-17 16:11:08 +00:00
parent 8dd956cbde
commit 4aa010eedc
6 changed files with 96 additions and 8 deletions

1
.gitattributes vendored
View File

@ -11430,6 +11430,7 @@ tests/test/tisoread.pp svneol=native#text/pascal
tests/test/tisorec1.pp svneol=native#text/pascal
tests/test/tisorec2.pp svneol=native#text/pascal
tests/test/tisorec3.pp svneol=native#text/pascal
tests/test/tlea1.pp svneol=native#text/plain
tests/test/tlib1a.pp svneol=native#text/plain
tests/test/tlib1b.pp svneol=native#text/plain
tests/test/tlib2a.pp svneol=native#text/plain

View File

@ -2649,14 +2649,14 @@
(
opcode : A_LEA;
ops : 2;
optypes : (ot_reg32 or ot_bits64,ot_memory,ot_none,ot_none);
optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_memory,ot_none,ot_none);
code : #208#1#141#72;
flags : if_8086
),
(
opcode : A_LEA;
ops : 2;
optypes : (ot_reg32 or ot_bits64,ot_immediate,ot_none,ot_none);
optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_immediate,ot_none,ot_none);
code : #208#1#141#72;
flags : if_8086 or if_sd
),

View File

@ -2649,14 +2649,14 @@
(
opcode : A_LEA;
ops : 2;
optypes : (ot_reg32 or ot_bits64,ot_memory,ot_none,ot_none);
optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_memory,ot_none,ot_none);
code : #208#1#141#72;
flags : if_8086
),
(
opcode : A_LEA;
ops : 2;
optypes : (ot_reg32 or ot_bits64,ot_immediate,ot_none,ot_none);
optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_immediate,ot_none,ot_none);
code : #208#1#141#72;
flags : if_8086 or if_sd
),

View File

@ -924,8 +924,8 @@ reg16|32,mem \320\1\xC5\110 8086,NOX86_64
[LEA,leaX]
(Ch_Wop2, Ch_Rop1, Ch_None)
reg32|64,mem \320\1\x8D\110 8086
reg32|64,imm \320\1\x8D\110 8086,SD
reg16|32|64,mem \320\1\x8D\110 8086
reg16|32|64,imm \320\1\x8D\110 8086,SD
[LEAVE]
(Ch_RWESP, Ch_WEBP, Ch_None)

View File

@ -2544,14 +2544,14 @@
(
opcode : A_LEA;
ops : 2;
optypes : (ot_reg32 or ot_bits64,ot_memory,ot_none,ot_none);
optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_memory,ot_none,ot_none);
code : #208#1#141#72;
flags : if_8086
),
(
opcode : A_LEA;
ops : 2;
optypes : (ot_reg32 or ot_bits64,ot_immediate,ot_none,ot_none);
optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_immediate,ot_none,ot_none);
code : #208#1#141#72;
flags : if_8086 or if_sd
),

87
tests/test/tlea1.pp Normal file
View File

@ -0,0 +1,87 @@
{ %cpu=i386 }
program tlea1;
{$ASMMODE intel}
procedure Fail;
begin
Writeln('Error!');
Halt(1);
end;
procedure TestO32A32;
var
res: DWord;
begin
Writeln('Testing LEA with 32-bit operand size and 32-bit address size...');
asm
mov ecx, 0deadbeefh
mov edi, 0abcdefedh
mov ebx, 055667788h
lea ebx, [ecx + edi * 8 + 12345678h]
mov res, ebx
end ['EBX', 'ECX', 'EDI'];
if res <> $4F5194CF then
Fail;
end;
procedure TestO16A32;
var
res: DWord;
begin
Writeln('Testing LEA with 16-bit operand size and 32-bit address size...');
asm
mov ecx, 0deadbeefh
mov edi, 0abcdefedh
mov ebx, 055667788h
lea bx, [ecx + edi * 8 + 12345678h]
mov res, ebx
end ['EBX', 'ECX', 'EDI'];
if res <> $556694CF then
Fail;
end;
{$ifdef 16BITADDRSUPPORT}
procedure TestO32A16;
var
res: DWord;
begin
Writeln('Testing LEA with 32-bit operand size and 16-bit address size...');
asm
mov ebx, 0deadbeefh
mov edi, 0abcdefedh
mov ecx, 055667788h
lea ecx, [bx + di + 1234h]
mov res, ecx
end ['EBX', 'ECX', 'EDI'];
if res <> $C110 then
Fail;
end;
procedure TestO16A16;
var
res: DWord;
begin
Writeln('Testing LEA with 16-bit operand size and 16-bit address size...');
asm
mov ebx, 0deadbeefh
mov edi, 0abcdefedh
mov ecx, 055667788h
lea cx, [bx + di + 1234h]
mov res, ecx
end ['EBX', 'ECX', 'EDI'];
if res <> $5566C110 then
Fail;
end;
{$endif 16BITADDRSUPPORT}
begin
TestO32A32;
TestO16A32;
{$ifdef 16BITADDRSUPPORT}
TestO32A16;
TestO16A16;
{$endif 16BITADDRSUPPORT}
Writeln('Success!');
end.