[LLVMdev] sqrt

Sandeep Patel deeppatel1987 at gmail.com
Thu Jan 7 12:28:57 PST 2010


On Thu, Jan 7, 2010 at 5:48 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Jan 7, 2010, at 7:06 AM, Jon Harrop wrote:
>
>>
>> What is the state of sqrt in LLVM?
>>
>> It was an intrinsic but there are no OCaml bindings for it and, last
>> I looked,
>> it generated inefficient code on Linux due to this bug:
>>
>>  http://www.llvm.org/PR3219
>>
>> Is the intrinsic deprecated? Am I losing a lot of performance by
>> calling sqrt
>> from libm instead of using the intrinsic?
>
> There is a fundamental difference between sqrt() and llvm.sqrt: the
> former is defined on negative values and sets errno (on linux).  The
> later is undefined.  Both work well for their stated purpose,
> llvm.sqrt should not be slower than sqrt even on linux.  Both
> llvm.sqrt and sqrt could be much better on linux, but noone seems
> compelled to do the work.

Many platforms could also benefit from recognizing 1.0/sqrt() as rsqrt().

deep




More information about the llvm-dev mailing list