diff options
author | Michael Ilseman <milseman@apple.com> | 2012-11-27 01:00:22 +0000 |
---|---|---|
committer | Michael Ilseman <milseman@apple.com> | 2012-11-27 01:00:22 +0000 |
commit | bc43fe1efe7e1059308480b4cd8ffffc7175debd (patch) | |
tree | 48e8babfb99ebe0f146419bb25c1cdbef6b49c7c /test/Transforms/InstSimplify | |
parent | 9780d352b9108d49097970f6686fd61aba58d7fc (diff) | |
download | external_llvm-bc43fe1efe7e1059308480b4cd8ffffc7175debd.zip external_llvm-bc43fe1efe7e1059308480b4cd8ffffc7175debd.tar.gz external_llvm-bc43fe1efe7e1059308480b4cd8ffffc7175debd.tar.bz2 |
Fast-math test for SimplifyInstruction: fold multiply by 0
Applied the patch, rather than committing it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168656 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstSimplify')
-rw-r--r-- | test/Transforms/InstSimplify/fast-math.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/fast-math.ll b/test/Transforms/InstSimplify/fast-math.ll new file mode 100644 index 0000000..e4b3ea3 --- /dev/null +++ b/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 +} |