summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-06-20 22:55:28 +0000
committerSanjay Patel <spatel@rotateright.com>2019-06-20 22:55:28 +0000
commitb342f026a466e6faf331d91fced29db5d39796aa (patch)
treefa1cc0b1ac4e2e11a5d7f88839f4af38df4d307c /llvm/test/Transforms
parent73986707bd57faab657c17acb6d219ed021f408a (diff)
downloadbcm5719-llvm-b342f026a466e6faf331d91fced29db5d39796aa.tar.gz
bcm5719-llvm-b342f026a466e6faf331d91fced29db5d39796aa.zip
[InstSimplify] simplify power-of-2 (single bit set) sequences
As discussed in PR42314: https://bugs.llvm.org/show_bug.cgi?id=42314 Improving the canonicalization for these patterns: rL363956 ...means we should adjust/enhance the related simplification. https://rise4fun.com/Alive/w1cp Name: isPow2 or zero %x = and i32 %xx, 2048 %a = add i32 %x, -1 %r = and i32 %a, %x => %r = i32 0 llvm-svn: 363997
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstSimplify/AndOrXor.ll10
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/test/Transforms/InstSimplify/AndOrXor.ll b/llvm/test/Transforms/InstSimplify/AndOrXor.ll
index e2c17e24028..a5c8108d0a5 100644
--- a/llvm/test/Transforms/InstSimplify/AndOrXor.ll
+++ b/llvm/test/Transforms/InstSimplify/AndOrXor.ll
@@ -93,10 +93,7 @@ define i64 @pow2b(i32 %x) {
define i32 @pow2_decrement(i32 %p) {
; CHECK-LABEL: @pow2_decrement(
-; CHECK-NEXT: [[X:%.*]] = shl i32 1, [[P:%.*]]
-; CHECK-NEXT: [[A:%.*]] = add i32 [[X]], -1
-; CHECK-NEXT: [[R:%.*]] = and i32 [[A]], [[X]]
-; CHECK-NEXT: ret i32 [[R]]
+; CHECK-NEXT: ret i32 0
;
%x = shl i32 1, %p
%a = add i32 %x, -1
@@ -106,10 +103,7 @@ define i32 @pow2_decrement(i32 %p) {
define <2 x i32> @pow2_decrement_commute_vec(<2 x i32> %p) {
; CHECK-LABEL: @pow2_decrement_commute_vec(
-; CHECK-NEXT: [[X:%.*]] = and <2 x i32> [[P:%.*]], <i32 2048, i32 2048>
-; CHECK-NEXT: [[A:%.*]] = add <2 x i32> [[X]], <i32 -1, i32 -1>
-; CHECK-NEXT: [[R:%.*]] = and <2 x i32> [[X]], [[A]]
-; CHECK-NEXT: ret <2 x i32> [[R]]
+; CHECK-NEXT: ret <2 x i32> zeroinitializer
;
%x = and <2 x i32> %p, <i32 2048, i32 2048>
%a = add <2 x i32> %x, <i32 -1, i32 -1>
OpenPOWER on IntegriCloud