|
@@ -5,6 +5,7 @@ program test_fp_instructions;
|
|
|
|
|
|
var
|
|
var
|
|
x,y : integer;
|
|
x,y : integer;
|
|
|
|
+ statusword,controlword : word;
|
|
z,t : longint;
|
|
z,t : longint;
|
|
a,b,c : comp;
|
|
a,b,c : comp;
|
|
begin
|
|
begin
|
|
@@ -13,8 +14,30 @@ program test_fp_instructions;
|
|
t:=5;
|
|
t:=5;
|
|
z:=4;
|
|
z:=4;
|
|
a:=20;
|
|
a:=20;
|
|
|
|
+ { test all FPU instructions using 's' and 'l' suffix
|
|
|
|
+ for word and dword size PM }
|
|
{$asmmode att}
|
|
{$asmmode att}
|
|
asm
|
|
asm
|
|
|
|
+ fildl z
|
|
|
|
+ fiadds x
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ ficoms x
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ ficomps x
|
|
|
|
+ fildl z
|
|
|
|
+ fidivs x
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ fidivrs x
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ fisubs x
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ fisubrs x
|
|
|
|
+ fistpq b
|
|
fildl z
|
|
fildl z
|
|
fimuls x
|
|
fimuls x
|
|
fistpq b
|
|
fistpq b
|
|
@@ -25,6 +48,26 @@ program test_fp_instructions;
|
|
Halt(1);
|
|
Halt(1);
|
|
end;
|
|
end;
|
|
asm
|
|
asm
|
|
|
|
+ fildl z
|
|
|
|
+ fiaddl t
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ ficoml t
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ ficompl t
|
|
|
|
+ fildl z
|
|
|
|
+ fidivl t
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ fidivrl t
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ fisubl t
|
|
|
|
+ fistpq b
|
|
|
|
+ fildl z
|
|
|
|
+ fisubrl t
|
|
|
|
+ fistpq b
|
|
fildl z
|
|
fildl z
|
|
fimull t
|
|
fimull t
|
|
fistpq b
|
|
fistpq b
|
|
@@ -34,6 +77,21 @@ program test_fp_instructions;
|
|
Writeln('Error in FPU att syntax code generation');
|
|
Writeln('Error in FPU att syntax code generation');
|
|
Halt(1);
|
|
Halt(1);
|
|
end;
|
|
end;
|
|
|
|
+ { test CW and SW instructions }
|
|
|
|
+ { FSTSW FNSTSW
|
|
|
|
+ FLDCW FSTCW FNSTCW }
|
|
|
|
+ asm
|
|
|
|
+ fstsw statusword
|
|
|
|
+ fstsww statusword
|
|
|
|
+ fnstsw statusword
|
|
|
|
+ fnstsww statusword
|
|
|
|
+ fstcw controlword
|
|
|
|
+ fstcww controlword
|
|
|
|
+ fnstcw controlword
|
|
|
|
+ fnstcww controlword
|
|
|
|
+ fldcw controlword
|
|
|
|
+ fldcww controlword
|
|
|
|
+ end;
|
|
{$asmmode intel}
|
|
{$asmmode intel}
|
|
asm
|
|
asm
|
|
fild dword ptr z
|
|
fild dword ptr z
|
|
@@ -48,6 +106,14 @@ program test_fp_instructions;
|
|
Writeln('Error in FPU code generation');
|
|
Writeln('Error in FPU code generation');
|
|
Halt(1);
|
|
Halt(1);
|
|
end;
|
|
end;
|
|
|
|
+ { test CW and SW instructions }
|
|
|
|
+ asm
|
|
|
|
+ fstsw word ptr [statusword]
|
|
|
|
+ fnstsw word ptr [statusword]
|
|
|
|
+ fstcw word ptr [controlword]
|
|
|
|
+ fnstcw word ptr[controlword]
|
|
|
|
+ fldcw word ptr [controlword]
|
|
|
|
+ end;
|
|
test:=b;
|
|
test:=b;
|
|
end;
|
|
end;
|
|
|
|
|