Masking illegal FPU instructions

Masking illegal FPU instructions

gustav_a的头像

I wasn't sure if this is the right forum for my question but I hope someone could help me anyway...
I am working on a c++ program that generates random small programs by randomly selecting FPU (Floating Point Unit) instructions, and putting the machine code of these instructions in a byte-array that is then executed. Since I select the instructions randomly, alot of the times they will give an illegal value as result (NAN, INF, etc.). This is not really a problem for me, but the real problem is that each time I get an illegal value, it takes a _very_ long time for the program to execute on an Intel processor. I have masked all the exceptions in the FPU but they still takes a long time to handle. So my question is if I can do something to make the processor totally ignore these exceptions and just continue with the execution?
I have tried the program on several computers running on Intel processors, and also on AMD processors. The strange thing is that on the AMD processors, the program runs very fast, I only get the slow execution on Intel. So it seems that Intel processors handle FPU exceptions different?

Thanks in advance!

Regards,
Gustav

1 条帖子 / 0 new
如需更全面地了解编译器优化,请参阅优化注意事项