[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question aboug gcc -mieee



Kelledin <kelledin@skarpsey.dyndns.org> writes:

> While compiling software on my Alpha box, I'm contemplating just how
> extensively I should use the -mieee option.  From what I gather,
> unless the software actually does something with SIGFPE, -mieee is
> fairly pointless.  Am I correct in this?

For the behaviour of a program, -mieee only makes a difference if
"special" IEEE floating point values such as NaN and Inf are used in
the program. IEEE mandates certain rules for arithmetic with such
numbers, e. g. Inf + NaN = NaN. The Alpha FPU does not implement these
rules for simplicity; if it encounters such operands, it traps to the
operating system, which then examines the operands and generates the
correct result.

The performance penalty that is there even when never trapping comes
from trap barriers ("trapb"), which need to be littered between the
instructions so the operating system can exactly identify the causing
instruction when a trap occurs.

So, unless you want to do arithmetic on NaNs, you don't need
-mieee. Note that *generating* these is just fine, 1.0 / 0.0 will
generate Inf without trapping, as long as you don't use the result
anymore.

Alternatively, you can get an EV6; the FPU there gets it right, and
-mieee is essentially free :)

-- 
	Falk



Reply to: