[llvm] r341993 - [InstCombine] add tests for icmp with xor; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 11 14:13:20 PDT 2018
Author: spatel
Date: Tue Sep 11 14:13:20 2018
New Revision: 341993
URL: http://llvm.org/viewvc/llvm-project?rev=341993&view=rev
Log:
[InstCombine] add tests for icmp with xor; NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/icmp.ll
Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=341993&r1=341992&r2=341993&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Tue Sep 11 14:13:20 2018
@@ -2227,6 +2227,53 @@ define <2 x i1> @icmp_xor_neg4_X_uge_4_v
ret <2 x i1> %cmp
}
+define <2 x i1> @xor_ult(<2 x i8> %x) {
+; CHECK-LABEL: @xor_ult(
+; CHECK-NEXT: [[XOR:%.*]] = xor <2 x i8> [[X:%.*]], <i8 -4, i8 -4>
+; CHECK-NEXT: [[R:%.*]] = icmp ult <2 x i8> [[XOR]], <i8 -4, i8 -4>
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %xor = xor <2 x i8> %x, <i8 -4, i8 -4>
+ %r = icmp ult <2 x i8> %xor, <i8 -4, i8 -4>
+ ret <2 x i1> %r
+}
+
+define i1 @xor_ult_extra_use(i8 %x, i8* %p) {
+; CHECK-LABEL: @xor_ult_extra_use(
+; CHECK-NEXT: [[XOR:%.*]] = xor i8 [[X:%.*]], -32
+; CHECK-NEXT: store i8 [[XOR]], i8* [[P:%.*]], align 1
+; CHECK-NEXT: [[R:%.*]] = icmp ult i8 [[XOR]], -32
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %xor = xor i8 %x, -32
+ store i8 %xor, i8* %p
+ %r = icmp ult i8 %xor, -32
+ ret i1 %r
+}
+
+define <2 x i1> @xor_ugt(<2 x i8> %x) {
+; CHECK-LABEL: @xor_ugt(
+; CHECK-NEXT: [[R:%.*]] = icmp ugt <2 x i8> [[X:%.*]], <i8 7, i8 7>
+; CHECK-NEXT: ret <2 x i1> [[R]]
+;
+ %xor = xor <2 x i8> %x, <i8 7, i8 7>
+ %r = icmp ugt <2 x i8> %xor, <i8 7, i8 7>
+ ret <2 x i1> %r
+}
+
+define i1 @xor_ugt_extra_use(i8 %x, i8* %p) {
+; CHECK-LABEL: @xor_ugt_extra_use(
+; CHECK-NEXT: [[XOR:%.*]] = xor i8 [[X:%.*]], 63
+; CHECK-NEXT: store i8 [[XOR]], i8* [[P:%.*]], align 1
+; CHECK-NEXT: [[R:%.*]] = icmp ugt i8 [[XOR]], 63
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %xor = xor i8 %x, 63
+ store i8 %xor, i8* %p
+ %r = icmp ugt i8 %xor, 63
+ ret i1 %r
+}
+
define i1 @icmp_swap_operands_for_cse(i32 %X, i32 %Y) {
; CHECK-LABEL: @icmp_swap_operands_for_cse(
; CHECK-NEXT: entry:
More information about the llvm-commits
mailing list