summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstSimplify/fast-math.ll
diff options
context:
space:
mode:
authorMichael Ilseman <milseman@apple.com>2012-11-27 01:00:22 +0000
committerMichael Ilseman <milseman@apple.com>2012-11-27 01:00:22 +0000
commit6cdacff2d00fe846af92476172154ae743251086 (patch)
treed4455f0ed5bcf11888213f7946f6f60bd3cc632d /llvm/test/Transforms/InstSimplify/fast-math.ll
parent37c36e486eb23b998a78de861c9c5fdfd36b4e24 (diff)
downloadbcm5719-llvm-6cdacff2d00fe846af92476172154ae743251086.tar.gz
bcm5719-llvm-6cdacff2d00fe846af92476172154ae743251086.zip
Fast-math test for SimplifyInstruction: fold multiply by 0
Applied the patch, rather than committing it. llvm-svn: 168656
Diffstat (limited to 'llvm/test/Transforms/InstSimplify/fast-math.ll')
-rw-r--r--llvm/test/Transforms/InstSimplify/fast-math.ll35
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/fast-math.ll b/llvm/test/Transforms/InstSimplify/fast-math.ll
new file mode 100644
index 00000000000..e4b3ea306a1
--- /dev/null
+++ b/llvm/test/Transforms/InstSimplify/fast-math.ll
@@ -0,0 +1,35 @@
+; RUN: opt < %s -instsimplify -S | FileCheck %s
+
+;; x * 0 ==> 0 when no-nans and no-signed-zero
+; CHECK: mul_zero_1
+define float @mul_zero_1(float %a) {
+ %b = fmul nsz nnan float %a, 0.0
+; CHECK: ret float 0.0
+ ret float %b
+}
+; CHECK: mul_zero_2
+define float @mul_zero_2(float %a) {
+ %b = fmul fast float 0.0, %a
+; CHECK: ret float 0.0
+ ret float %b
+}
+
+;; x * 0 =/=> 0 when there could be nans or -0
+; CHECK: no_mul_zero_1
+define float @no_mul_zero_1(float %a) {
+ %b = fmul nsz float %a, 0.0
+; CHECK: ret float %b
+ ret float %b
+}
+; CHECK: no_mul_zero_2
+define float @no_mul_zero_2(float %a) {
+ %b = fmul nnan float %a, 0.0
+; CHECK: ret float %b
+ ret float %b
+}
+; CHECK: no_mul_zero_3
+define float @no_mul_zero_3(float %a) {
+ %b = fmul float %a, 0.0
+; CHECK: ret float %b
+ ret float %b
+}
OpenPOWER on IntegriCloud