4

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?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
marcin
  • 3,351
  • 1
  • 29
  • 33

1 Answers1

3

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 the option -funsafe-math-optimizations.

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

sbhtta
  • 43
  • 1
  • 6
Konstantin Vladimirov
  • 6,791
  • 1
  • 27
  • 36
  • 3
    well, it doesn't answer the question (which is about `-fp-model fast=1` not `-ffast-math`) – marcin Apr 08 '16 at 23:03
  • I don't know in which exact way fp-model fast=1 violates IEEE. I just explained what options together constitutes ffast-math in gcc, so that you can play around with those 9 guys, looking for whatever you want in-between. – Konstantin Vladimirov Apr 09 '16 at 02:42