[LLVMdev] llvm.sqrt intrinsic undefined behaviour

Owen Anderson resistor at mac.com
Thu Oct 31 16:23:38 PDT 2013



> On Oct 31, 2013, at 6:16 AM, Nicholas Chapman <admin at indigorenderer.com> wrote:
> 
> I propose changing the llvm.sqrt() LLVM instrinsic to be well defined on all inputs, and be defined to return NaN on negative inputs.

I strongly disagree with this proposal.  The purpose of this general purpose intrinsic is to expose sqrt functionality present on many of the architectures LLVM supports.  If we defined its edge cases, we won't be able to map it to target functionality freely on targets whose edge cases don't match that definition.

I'd recommend using (or adding, if it doesn't already exist) an X86-specific intrinsic to expose exactly the instruction you want.

-Owen



More information about the llvm-dev mailing list