Program TestExcp;
uses excptest;

Procedure Do_Something;
var a:byte;
begin
a:=0;
writeln(2 div 1); {I can't write just "2 div 0" because of the FPC sanity check :-)}
end;


Procedure Test_SSE;assembler;
asm
movaps xmm1,xmm2
end;


Procedure Test_SSE3;assembler;
asm
haddpd xmm1,xmm2
end;


Procedure Test_AVX;assembler;
asm
vzeroall
end;


begin
writeln('instaluji handler...');
Install_Signal_handler_FPU;
writeln('Dobry.');
writeln('spoustim testovany kod');

Do_Something;

writeln('dobry');
writeln('stav vyjimky: ',signal_handler_was_excp);
writeln('ukoncuji handler');

UnInstall_Signal_handler_FPU;
writeln('dobry');
readln;

Install_Signal_handler_ILL;
Test_SSE3;
UnInstall_Signal_handler_ILL;

writeln('prezili jsme SSE3 instrukci. Vysledek: ',signal_handler_was_excp);
readln;


Test_AVX;
writeln('prezili jsme AVX instrukci. Vysledek: ',signal_handler_was_excp);
readln;
end.
