[llvm] r336784 - [NFC][InstCombine] icmp-logical.ll: add a few more tests.
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 11 03:31:13 PDT 2018
Author: lebedevri
Date: Wed Jul 11 03:31:12 2018
New Revision: 336784
URL: http://llvm.org/viewvc/llvm-project?rev=336784&view=rev
Log:
[NFC][InstCombine] icmp-logical.ll: add a few more tests.
The @masked_and_notA_slightly_optimized and @masked_or_A
will break when PR38123 will be fixed:
https://rise4fun.com/Alive/Rny
Clearly, they aren't optimized currently.
https://rise4fun.com/Alive/ERo
Modified:
llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll
Modified: llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll?rev=336784&r1=336783&r2=336784&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll Wed Jul 11 03:31:12 2018
@@ -71,6 +71,21 @@ define i1 @masked_and_notA(i32 %A) {
ret i1 %res
}
+define i1 @masked_and_notA_slightly_optimized(i32 %A) {
+; CHECK-LABEL: @masked_and_notA_slightly_optimized(
+; CHECK-NEXT: [[TMP0:%.*]] = icmp ugt i32 [[A:%.*]], 7
+; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 39
+; CHECK-NEXT: [[TST2:%.*]] = icmp ne i32 [[MASK2]], [[A]]
+; CHECK-NEXT: [[RES:%.*]] = and i1 [[TMP0]], [[TST2]]
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %tmp0 = icmp uge i32 %A, 8
+ %mask2 = and i32 %A, 39
+ %tst2 = icmp ne i32 %mask2, %A
+ %res = and i1 %tmp0, %tst2
+ ret i1 %res
+}
+
define i1 @masked_or_A(i32 %A) {
; CHECK-LABEL: @masked_or_A(
; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A:%.*]], 39
@@ -85,6 +100,21 @@ define i1 @masked_or_A(i32 %A) {
ret i1 %res
}
+define i1 @masked_or_A_slightly_optimized(i32 %A) {
+; CHECK-LABEL: @masked_or_A_slightly_optimized(
+; CHECK-NEXT: [[TMP0:%.*]] = icmp ult i32 [[A:%.*]], 8
+; CHECK-NEXT: [[MASK2:%.*]] = and i32 [[A]], 39
+; CHECK-NEXT: [[TST2:%.*]] = icmp eq i32 [[MASK2]], [[A]]
+; CHECK-NEXT: [[RES:%.*]] = or i1 [[TMP0]], [[TST2]]
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %tmp0 = icmp ult i32 %A, 8
+ %mask2 = and i32 %A, 39
+ %tst2 = icmp eq i32 %mask2, %A
+ %res = or i1 %tmp0, %tst2
+ ret i1 %res
+}
+
define i1 @masked_or_allzeroes_notoptimised(i32 %A) {
; CHECK-LABEL: @masked_or_allzeroes_notoptimised(
; CHECK-NEXT: [[MASK1:%.*]] = and i32 [[A:%.*]], 15
More information about the llvm-commits
mailing list