l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2005 Jan 17 12:50

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] gcc questions: inline and -ffast-math
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] gcc questions: inline and -ffast-math

On Mon, 2005-01-17 at 13:47 -0500, Peter Jay Salzman wrote:

> Just to make sure I understand:
> You're saying that I want to enable -fno-math-errno because I don't care
> about or use errno;

That's right.  

> So it sounds like I'd like...

>    -fno-math-errno -fno-trapping-math -fno-rounding-math -fno-signaling-nans
> Do you know what a "user visible trap" is?  Is that like an assertion?

OK, here comes more detail, but before you rely on my expertise... a
disclaimer: I've looked closely at some of the gcc sources, but I don't
know much about floating point math.

That said, I believe that a "user visible trap" in this context refers
to a SIGFPE (or other similar mechanism on non-unix systems).  The
effects of -fno-trapping-math and -fno-signaling-nans are to generate
faster code that produces different numbers of these traps than would be
mandated by ISO standards. I don't know whether these can have the
effect of completely inhibiting traps for a program that would otherwise
produce one. If they can, then you don't want to use them.

Unfortunately, -fno-signaling-nans is on by default in gcc 3.4.2, and
the option to prevent its effects, -fsignaling-nans, is described by the
manual as "EXPERIMENTAL".  So I would strongly suggest that if you want
to rely on any of this that you experiment with gcc and make sure that
the code it generates raises SIGFPE where you want it to.

-fno-rounding-math is also on by default; so I would use just -fno-math-
errno, and experiment to see whether that setting will catch the errors
you want caught.

Alternatively you could explicitly check for NaN and inf where their
presence would indicate an error.  Then you could just enable -ffast-

> > Some more ideas for wringing extra speed out of gcc:...

> Holy cow.  You've just given me *hours* of Googling material!   :-P

Well, you should be able to find out more about these with "man gprof"
and "info gcc".  If you haven't thought of using profiling, I'd start
there; that will help you write better, faster, code, and gain you much
more speed than tweaking code generation options would.

Josh Parsons
Philosophy Department
1238 Social Sciences and Humanities Bldg.
University of California
Davis, CA 95616-8673

Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!