HomePhabricator

[SLPVectorizer] Vectorizing the libm sqrt to llvm's sqrt intrinsic requires nnan

Authored by majnemer on Apr 6 2016, 12:04 AM.

Description

[SLPVectorizer] Vectorizing the libm sqrt to llvm's sqrt intrinsic requires nnan

To quote the langref "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 sqrt."

This means that it's unsafe to replace sqrt with llvm.sqrt unless the
call is annotated with nnan.

Thanks to Hal Finkel for pointing this out!

llvm-svn: 265521

Details

Committed
majnemerApr 6 2016, 12:04 AM
Parents
rG3e0430e0a819: IR: Move MDStrings to a BumpPtrAllocator
Branches
Unknown
Tags
Unknown