* New test to detect SSE/AVX optimisation error

This commit is contained in:
J. Gareth "Curious Kit" Moreton 2023-08-22 12:27:48 +01:00 committed by FPK
parent 35e52b90f5
commit 1bcf4a5a8c

28
tests/webtbs/tw40401.pp Normal file
View File

@ -0,0 +1,28 @@
{ %OPT=-O3 }
{$mode objfpc}
program tw40401;
function OptPass1_V_MOVAP_Test: Single; noinline;
var
a, b, zero: single;
begin
repeat
zero := 0 + random(0);
a := 2 - zero;
b := 5 - zero;
Result := a * b; // must be 10
until true;
end;
var
m: Single;
begin
m := OptPass1_V_MOVAP_Test();
if m <> 10 then
begin
WriteLn('FAIL - returned' , m);
Halt(1);
end;
WriteLn('ok');
end.