+ added an x86_64 version of the tasm23.pp test

git-svn-id: trunk@38505 -
This commit is contained in:
nickysn 2018-03-12 16:07:39 +00:00
parent 79477f04b0
commit 8ecc41186d
2 changed files with 84 additions and 0 deletions

1
.gitattributes vendored
View File

@ -12540,6 +12540,7 @@ tests/test/tasm21b.pp svneol=native#text/plain
tests/test/tasm22.pp svneol=native#text/plain
tests/test/tasm23.pp svneol=native#text/plain
tests/test/tasm23a.pp svneol=native#text/plain
tests/test/tasm23b.pp svneol=native#text/plain
tests/test/tasm24.pp svneol=native#text/plain
tests/test/tasm2a.pp svneol=native#text/plain
tests/test/tasm3.pp svneol=native#text/plain

83
tests/test/tasm23b.pp Normal file
View File

@ -0,0 +1,83 @@
{ %CPU=x86_64 }
program tasm23b;
{$ASMMODE INTEL}
{$S-}
const
t_size = 33;
procedure t; assembler;
asm
mov eax, [rbx[5]][rdi][54][-17][45][4] { mov eax, [rbx+rdi+5Bh] }
mov eax, [[rbx+5]+[rdi+54]+[-17]+[45]+[4]] { mov eax, [rbx+rdi+5Bh] }
mov ebx, [5[7]] { mov ebx, [000Ch] }
mov ebx, [5+[7]] { mov ebx, [000Ch] }
end;
procedure t_verify; assembler;
asm
mov eax, [rbx+rdi+5Bh] { mov eax, [rbx[5]][rdi][54][-17][45][4] }
mov eax, [rbx+rdi+5Bh] { mov eax, [[rbx+5]+[rdi+54]+[-17]+[45]+[4]] }
mov ebx, [000Ch] { mov ebx, [5[7]] }
mov ebx, [000Ch] { mov ebx, [5+[7]] }
end;
const
t2_size = 38;
procedure t2; assembler;
var
locl: longword;
asm
mov eax, locl { mov еax, [rbp-08] }
mov eax, fs:locl { mov еax, fs:[rbp-08] }
mov eax, [fs:locl] { mov еax, fs:[rbp-08] }
mov eax, [fs:[locl]] { mov еax, fs:[rbp-08] }
mov eax, fs:locl[5] { mov еax, fs:[rbp-03] }
mov eax, fs:5[locl] { mov еax, fs:[rbp-03] }
end;
procedure t2_verify; assembler;
var
locl: longword;
asm
mov eax, [rbp-08] { mov еax, locl }
mov eax, fs:[rbp-08] { mov еax, fs:locl }
mov eax, fs:[rbp-08] { mov еax, [fs:locl] }
mov eax, fs:[rbp-08] { mov еax, [fs:[locl]] }
mov eax, fs:[rbp-03] { mov еax, fs:locl[5] }
mov eax, fs:[rbp-03] { mov еax, fs:5[locl] }
end;
{ This version works in all i8086 memory models }
function CompareCode(cp, cp2: CodePointer; sz: Integer): Boolean;
var
lastbyte: Byte;
begin
if CompareByte(cp^, cp2^, sz) <> 0 then
begin
CompareCode := False;
exit;
end;
{ check also that the last byte is a retn instruction }
lastbyte:=PByte(cp)[sz-1];
if lastbyte<>$C3 then
begin
CompareCode := False;
exit;
end;
CompareCode := True;
end;
procedure Error(N: Integer);
begin
Writeln('Error! ', N);
Halt(1);
end;
begin
if not CompareCode(CodePointer(@t), CodePointer(@t_verify), t_size) then
Error(1);
if not CompareCode(CodePointer(@t2), CodePointer(@t2_verify), t2_size) then
Error(2);
Writeln('Ok!');
end.