[PATCH] The LoopVectorizer and libm sqrt

Hal Finkel hfinkel at anl.gov
Thu Sep 12 11:58:48 PDT 2013


----- Original Message -----
> I did not write this code but I assume this was done on purpose
> because our llvm.sqrt intrinsics has a slightly different semantics:
> 
> The ‘llvm.sqrt‘ intrinsics return the sqrt of the specified operand,
> returning the same value as the libm ‘sqrt‘ functions would. Unlike
> sqrt in libm, however, llvm.sqrt has undefined behavior for negative
> numbers other than -0.0 (which allows for better optimization,
> because there is no need to worry about errno being set).
> llvm.sqrt(-0.0) is defined to return -0.0 like IEEE sort.

Hrmm... okay; I'll send a revised patch where we explicitly check for fast-math mode.

 -Hal

> 
>  
> On Sep 12, 2013, at 1:39 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> 
> > Nadav, Arnold, et al.,
> > 
> > It seems as though libm sqrt was accidentally omitted from the list
> > of functions with associated vectorizable intrinsics. The attached
> > patch fixes this. Please review.
> > 
> > Thanks again,
> > Hal
> > 
> > --
> > Hal Finkel
> > Assistant Computational Scientist
> > Leadership Computing Facility
> > Argonne National Laboratory<lv-libm-sqrt.patch>
> 
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory




More information about the llvm-commits mailing list