Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29280 Discussions

How do I force the 64bit ifort compiler to use x87 FPU and not SSE2?

Henrik_S_
Beginner
907 Views

How can I force the 64 bit ifort compiler to generate x87 FPU code (internal 80 bit precision) instead of SSE2 (internal 64 bit precision)? As best as I can tell, the 32bit compiler by default uses the x87 FPU unless an architecture flag is passed. The 64 bit compiler use -xW by default which forces SSE2 (I think). How can I tell the compiler to generate x87 FPU code?

This is for benchmarking and testing purposes.

Thanks,

- Henrik

0 Kudos
5 Replies
Steven_L_Intel1
Employee
907 Views

I'm not sure what the point of this is - you deliberately want to hobble the code? Note that in version 11, SSE2 will be the default for IA-32 as well. You would be better off to tell the 32-bit compiler to assume SSE2 (-xW) if you want a real comparison.

From a glance through the compiler options manual, I don't see an option to do this. I'm not even sure the compiler has support for that. -mia32 is not supported in the x64 compiler.

0 Kudos
TimP
Honored Contributor III
907 Views
ifort -O1 -mp appears to have the requested effect. I don't know if this is intentional.
0 Kudos
TimP
Honored Contributor III
907 Views
You may have to call a C function to reset to 64-bit precision mode, if -pc80 (for compilation of the main program) doesn't do it. Either gcc or icc, can use facilities to avoid direct use of inline asm.
0 Kudos
TimP
Honored Contributor III
907 Views

ifort -fno-inline-functions -ftz- -assume protect_parens paranoia.f

./a.out>ifortnftz.out

ifort -fno-inline-functions -mp paranoia.f

./a.out>ifortmp.out

diff ifortnftz.out ifortmp.out|less

< SUBEXPRESSIONS DO NOT APPEAR TO BE CALCULATED
< WITH EXTRA PRECISION
---
> SOME SUBEXPRESSIONS APPEAR TO BE CALCULATED EXTRA-PRECISELY
> WITH ABOUT 11.000000 EXTRA BASE B DIGITS, I. E.
> ROUGHLY 3.3113298 EXTRA SIGNIFICANT DECIMALS.
> THAT FEATURE IS NOT TESTED FURTHER BY THIS PROGRAM.
.....

Similar to gfortran -mfpmath=387 result

0 Kudos
Henrik_S_
Beginner
907 Views

Thank you everyone!

- Henrik

0 Kudos
Reply