aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine/constant-fold-math.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/InstCombine/constant-fold-math.ll')
-rw-r--r--test/Transforms/InstCombine/constant-fold-math.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/constant-fold-math.ll b/test/Transforms/InstCombine/constant-fold-math.ll
index 14377df..ce8d337 100644
--- a/test/Transforms/InstCombine/constant-fold-math.ll
+++ b/test/Transforms/InstCombine/constant-fold-math.ll
@@ -7,6 +7,7 @@ declare <4 x float> @llvm.fma.v4f32(<4 x float>, <4 x float>, <4 x float>) #0
declare double @llvm.fma.f64(double, double, double) #0
declare double @llvm.fmuladd.f64(double, double, double) #0
+declare double @llvm.sqrt.f64(double) #0
; CHECK-LABEL: @constant_fold_fma_f32
@@ -44,4 +45,12 @@ define double @constant_fold_fmuladd_f64() #0 {
ret double %x
}
+; The sqrt intrinsic is undefined for negative inputs besides -0.0.
+; CHECK-LABEL: @bad_sqrt
+; CHECK-NEXT: ret double undef
+define double @bad_sqrt() {
+ %x = call double @llvm.sqrt.f64(double -2.000000e+00)
+ ret double %x
+}
+
attributes #0 = { nounwind readnone }