4
votes

As I read on Intel's website:

Intel compiler uses /fp-model fast=1 as defaults. This optimization favors speed over standards compliance. You may use compiler option -mieee-fp to get compliant code.

My understanding of the fp-model option in ICC is that (correct me if I'm wrong):

  • precise corresponds to default settings in GCC and Clang,
  • fast=2 is similar to -ffast-math,
  • fast=1 is somewhere between.

What options in GCC or Clang would make floating point math most similar to Intel's default -fp-model fast=1?

1

1 Answers

2
votes

As it follows from GCC's set_fast_math_flags function, ffast-math option (at least in GCC 5.2) is equivalent to

(1) unsafe opts group:

-fno-trapping-math
-fassociative_math
-fno-signed-zeros
-freciprocal-math

(2) other guys:

-ffinite-math-only
-fno-errno-math
-fno-signaling-nans
-fno-rounding-math
-fcx-limited-range

First group is abbreviated with -funsafe_math_optimizations.

You should figure out what comes in ICC and try to combine those flags to make desired effect.