Allow speculating llvm.sqrt, fma and fmuladd

This doesn't set errno, so this should be OK.
Also update the documentation to explicitly state
that errno are not set.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200501 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault
2014-01-31 00:09:00 +00:00
parent 4b4b808860
commit e932091eb5
3 changed files with 67 additions and 2 deletions
+6
View File
@@ -2036,6 +2036,12 @@ bool llvm::isSafeToSpeculativelyExecute(const Value *V,
case Intrinsic::umul_with_overflow:
case Intrinsic::usub_with_overflow:
return true;
// Sqrt should be OK, since the llvm sqrt intrinsic isn't defined to set
// errno like libm sqrt would.
case Intrinsic::sqrt:
case Intrinsic::fma:
case Intrinsic::fmuladd:
return true;
// TODO: some fp intrinsics are marked as having the same error handling
// as libm. They're safe to speculate when they won't error.
// TODO: are convert_{from,to}_fp16 safe?