summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-07-14 15:09:49 +0000
committerSanjay Patel <spatel@rotateright.com>2017-07-14 15:09:49 +0000
commit3f4db3ea97ddf6cc0d2bbfed88d5566e25a95b1d (patch)
tree6726b9ae877e593bfb1ce732992fe794e9f2d43e /llvm/test/Transforms
parent45b2277a33251927be13f96b066ca638b25b3184 (diff)
downloadbcm5719-llvm-3f4db3ea97ddf6cc0d2bbfed88d5566e25a95b1d.tar.gz
bcm5719-llvm-3f4db3ea97ddf6cc0d2bbfed88d5566e25a95b1d.zip
[InstCombine] convert bitwise (in)equality checks to logical ops (PR32401)
As discussed in: https://bugs.llvm.org/show_bug.cgi?id=32401 we have a backend transform to undo this: https://reviews.llvm.org/rL299542 when it's likely that the xor version leads to better codegen, but we want this form in IR for better analysis and simplification potential. llvm-svn: 308031
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/icmp-logical.ll14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp-logical.ll b/llvm/test/Transforms/InstCombine/icmp-logical.ll
index 248d89d934e..aa95cc5a131 100644
--- a/llvm/test/Transforms/InstCombine/icmp-logical.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-logical.ll
@@ -157,10 +157,9 @@ define i1 @fold_mask_cmps_to_true(i32 %x) {
define i1 @cmpeq_bitwise(i8 %a, i8 %b, i8 %c, i8 %d) {
; CHECK-LABEL: @cmpeq_bitwise(
-; CHECK-NEXT: [[XOR1:%.*]] = xor i8 %a, %b
-; CHECK-NEXT: [[XOR2:%.*]] = xor i8 %c, %d
-; CHECK-NEXT: [[OR:%.*]] = or i8 [[XOR1]], [[XOR2]]
-; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[OR]], 0
+; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i8 %a, %b
+; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 %c, %d
+; CHECK-NEXT: [[CMP:%.*]] = and i1 [[TMP1]], [[TMP2]]
; CHECK-NEXT: ret i1 [[CMP]]
;
%xor1 = xor i8 %a, %b
@@ -172,10 +171,9 @@ define i1 @cmpeq_bitwise(i8 %a, i8 %b, i8 %c, i8 %d) {
define <2 x i1> @cmpne_bitwise(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c, <2 x i64> %d) {
; CHECK-LABEL: @cmpne_bitwise(
-; CHECK-NEXT: [[XOR1:%.*]] = xor <2 x i64> %a, %b
-; CHECK-NEXT: [[XOR2:%.*]] = xor <2 x i64> %c, %d
-; CHECK-NEXT: [[OR:%.*]] = or <2 x i64> [[XOR1]], [[XOR2]]
-; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i64> [[OR]], zeroinitializer
+; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <2 x i64> %a, %b
+; CHECK-NEXT: [[TMP2:%.*]] = icmp ne <2 x i64> %c, %d
+; CHECK-NEXT: [[CMP:%.*]] = or <2 x i1> [[TMP1]], [[TMP2]]
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%xor1 = xor <2 x i64> %a, %b
OpenPOWER on IntegriCloud