diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-02-29 11:12:23 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-02-29 11:12:23 +0000 |
commit | f5b2a47ac69a91be61a99f16d5b6bbab02e92b77 (patch) | |
tree | 5e1119e19bbdc8aab2e6203a9f910a457b452925 /llvm/test | |
parent | 27ba83fd45b05550bf8c2bd9a10a2b23c7b5f67e (diff) | |
download | bcm5719-llvm-f5b2a47ac69a91be61a99f16d5b6bbab02e92b77.tar.gz bcm5719-llvm-f5b2a47ac69a91be61a99f16d5b6bbab02e92b77.zip |
[InstSimplify] fsub 0.0, (fsub -0.0, X) ==> X is only safe if signed zeros are ignored.
Only allow fsub -0.0, (fsub -0.0, X) ==> X without nsz. PR26746.
llvm-svn: 262212
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll index b0957a81773..1c29884753a 100644 --- a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll +++ b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll @@ -1,8 +1,8 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s -; fsub 0, (fsub 0, X) ==> X -; CHECK-LABEL: @fsub_0_0_x( -define float @fsub_0_0_x(float %a) { +; fsub -0.0, (fsub -0.0, X) ==> X +; CHECK-LABEL: @fsub_-0_-0_x( +define float @fsub_-0_-0_x(float %a) { %t1 = fsub float -0.0, %a %ret = fsub float -0.0, %t1 @@ -10,6 +10,26 @@ define float @fsub_0_0_x(float %a) { ret float %ret } +; fsub 0.0, (fsub -0.0, X) != X +; CHECK-LABEL: @fsub_0_-0_x( +define float @fsub_0_-0_x(float %a) { + %t1 = fsub float 0.0, %a + %ret = fsub float -0.0, %t1 + +; CHECK-NOT: ret float %a + ret float %ret +} + +; fsub -0.0, (fsub 0.0, X) != X +; CHECK-LABEL: @fsub_-0_0_x( +define float @fsub_-0_0_x(float %a) { + %t1 = fsub float -0.0, %a + %ret = fsub float 0.0, %t1 + +; CHECK-NOT: ret float %a + ret float %ret +} + ; fsub X, 0 ==> X ; CHECK-LABEL: @fsub_x_0( define float @fsub_x_0(float %a) { |