mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 09:39:09 +02:00
test case for push(w/l)/pop(w/l) segment registers
This commit is contained in:
parent
f94c25e338
commit
2c86ebf767
66
tests/test/testpusw.pp
Normal file
66
tests/test/testpusw.pp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
program test_register_pushing;
|
||||||
|
|
||||||
|
var
|
||||||
|
before, after : longint;
|
||||||
|
wpush,lpush : longint;
|
||||||
|
const
|
||||||
|
haserror : boolean = false;
|
||||||
|
|
||||||
|
begin
|
||||||
|
{$ifdef CPUI386}
|
||||||
|
{$asmmode att}
|
||||||
|
asm
|
||||||
|
movl %esp,before
|
||||||
|
pushw %es
|
||||||
|
movl %esp,after
|
||||||
|
popw %es
|
||||||
|
end;
|
||||||
|
wpush:=before-after;
|
||||||
|
if wpush<>2 then
|
||||||
|
begin
|
||||||
|
Writeln('Compiler does not push "pushw %es" into 2 bytes');
|
||||||
|
haserror:=true;
|
||||||
|
end;
|
||||||
|
asm
|
||||||
|
movl %esp,before
|
||||||
|
pushl %es
|
||||||
|
movl %esp,after
|
||||||
|
popl %es
|
||||||
|
end;
|
||||||
|
lpush:=before-after;
|
||||||
|
|
||||||
|
if lpush<>4 then
|
||||||
|
begin
|
||||||
|
Writeln('Compiler does not push "pushl %es" into 4 bytes');
|
||||||
|
haserror:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
asm
|
||||||
|
movl %esp,before
|
||||||
|
pushw %gs
|
||||||
|
movl %esp,after
|
||||||
|
popw %gs
|
||||||
|
end;
|
||||||
|
wpush:=before-after;
|
||||||
|
if wpush<>2 then
|
||||||
|
begin
|
||||||
|
Writeln('Compiler does not push "pushw %gs" into 2 bytes');
|
||||||
|
haserror:=true;
|
||||||
|
end;
|
||||||
|
asm
|
||||||
|
movl %esp,before
|
||||||
|
pushl %gs
|
||||||
|
movl %esp,after
|
||||||
|
popl %gs
|
||||||
|
end;
|
||||||
|
lpush:=before-after;
|
||||||
|
|
||||||
|
if lpush<>4 then
|
||||||
|
begin
|
||||||
|
Writeln('Compiler does not push "pushl %gs" into 4 bytes');
|
||||||
|
haserror:=true;
|
||||||
|
end;
|
||||||
|
{$endif CPUI386}
|
||||||
|
if haserror then
|
||||||
|
Halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user