[PATCH] CodeGen: Emit sqrt intrinsic from __builtin_sqrt

Tom Stellard thomas.stellard at amd.com
Thu Mar 19 16:00:47 PDT 2015


In http://reviews.llvm.org/D8468#143820, @hfinkel wrote:

> In http://reviews.llvm.org/D8468#143819, @tstellarAMD wrote:
>
> > In http://reviews.llvm.org/D8468#143776, @hfinkel wrote:
> >
> > > To play devil's advocate: I don't understand what you're trying to fix here. So the intrinsic has undefined behavior if x < -0.0; that's the definition of our intrinsic.
> >
> >
> > The check is there to avoid the undefined behavior.  My understanding is that __builtin_sqrtf is supposed to return NaN for x < -0.0, so we need to handle that case specially if we emit the intrinsic.
>
>
> Right, I just want to understand what "supposed to" means? (what GCC does?)


No, it's what libm does.  Aren't all the __builtin prefixed library calls supposed to be identical to the library call except that they don't set errno?

> > 

> 

> > 

> 

> > > Regardless, you don't need to insert the extra code if we're in NoNaNs mode.

> 

> > 

> 





REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8468

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list