aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-09-17 01:38:06 +0000
committerDan Gohman <gohman@apple.com>2010-09-17 01:38:06 +0000
commit8ee731f2ce62d936f81c12283a192375a87f323a (patch)
tree8389e69e02c397ba3aedae4cc18e8150ee31ea3b /test
parent11f51ca6f9886b9d548a64028c16c3709fe32fac (diff)
downloadexternal_llvm-8ee731f2ce62d936f81c12283a192375a87f323a.zip
external_llvm-8ee731f2ce62d936f81c12283a192375a87f323a.tar.gz
external_llvm-8ee731f2ce62d936f81c12283a192375a87f323a.tar.bz2
Fix the folding of floating-point math library calls, like sin(infinity),
so that it detects errors on platforms where libm doesn't set errno. It's still subject to host libm details though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114148 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/fold-calls.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/fold-calls.ll b/test/Transforms/InstCombine/fold-calls.ll
new file mode 100644
index 0000000..2b11771
--- /dev/null
+++ b/test/Transforms/InstCombine/fold-calls.ll
@@ -0,0 +1,19 @@
+; RUN: opt -instcombine -S < %s | FileCheck %s
+
+; This shouldn't fold, because sin(inf) is invalid.
+; CHECK: @foo
+; CHECK: %t = call double @sin(double 0x7FF0000000000000)
+define double @foo() {
+ %t = call double @sin(double 0x7FF0000000000000)
+ ret double %t
+}
+
+; This should fold.
+; CHECK: @bar
+; CHECK: ret double 0x3FDA6026360C2F91
+define double @bar() {
+ %t = call double @sin(double 9.0)
+ ret double %t
+}
+
+declare double @sin(double)