[PATCH] The LoopVectorizer and libm sqrt
Hal Finkel
hfinkel at anl.gov
Thu Sep 12 12:34:14 PDT 2013
----- Original Message -----
> ----- 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.
Or perhaps not; the TargetOptions are not available at the IR-level right now, and so this seems to leave us with two options:
1. Feed something through TTI
2. Have Clang generate the intrinsic directly in fast-math mode
I'm leaning toward (1), because I'd like to give the target the ability to declare the availability of a vectorized sqrt that is suitable as a libm sqrt replacement.
What do you think?
-Hal
>
> -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
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits
mailing list