Messages in this thread | | | Date | Sat, 27 Mar 2004 14:24:59 +0000 | From | Jamie Lokier <> | Subject | Re: Somewhat OT: gcc, x86, -ffast-math, and Linux |
| |
Daniel Forrest wrote: > What is the -ffast-math option doing?
It enables some optimisations and mathematical transformations which do not satisfy the properties of IEEE floating point arithmetic.
(Not that GCC's output satisfies those properties without -ffast-math on x86, but this flag enables much looser semantics).
> How are the excess bits of precision dealt with during context > switches?
They are preserved - they are part of the floating point context. If there is any failure to preserve all of that context, it's a kernel bug.
> Shouldn't the same binary with the same inputs produce the same > output on identical hardware?
Is the hardware *identical*, or are they different x86 CPUs?
Different CPUs give different results for the trigonometric functions. GCC's manual claims that fsin, fcos and fsqrt instructions are only used if the -funsafe-math-optimizations flag is also used, if the GCC version is >= 2.6.1. However you may find that Glibc's <math.h> ends up using those instructions when -ffast-math is used alone.
-- Jamie - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |