[llvm-commits] [llvm-gcc-4.2] r55783 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h

Duncan Sands baldrick at free.fr
Thu Sep 4 13:23:51 PDT 2008


> > Hi Dale, since the llvm intrinsics are presumably readnone
> > (hence don't set errno, and don't read the floating point
> > mode - so they are what you want in "fast math" mode) shouldn't
> > these expansions only be done if the gcc builtins are marked
> > "const"?  IIRC, gcc marks these builtins "const" or "readonly"
> > depending on platform requirements and whether fast-math is
> > being used.
> 
> You may be right.  The way sqrt is handled maybe?

Well, I think it's important to check the gcc builtin's "pureness"
against that of the llvm intrinsic, since turning (for example)
a "pure" (readonly) gcc builtin into a readnone ("const") llvm
intrinsic seems like a clear no-no, whether fast-math is set or
not.  This will automagically take care of no-errno math, since
gcc adjusts the builtin's attributes based on whether that flag
is set or not (IIRC; easy to check by playing with flags and
seeing what attributes are output into the bitcode if you don't
convert them into llvm intrinsics).  There's also the question of
whether the llvm intrinsics pre-suppose fast-math, i.e. whether using
the intrinsics is telling the code-generators that can make
fast-math assumptions.  I don't think that's the case, so there
should be no need to check the fast-math flag.

Ciao,

Duncan.



More information about the llvm-commits mailing list