lkml.org 
[lkml]   [2004]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.071 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site