Skip to content

Commit 8eb72b6

Browse files
Add tests
1 parent 8eb28ca commit 8eb72b6

File tree

1 file changed

+56
-0
lines changed
  • llvm/test/Transforms/InstCombine

1 file changed

+56
-0
lines changed

llvm/test/Transforms/InstCombine/not.ll

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,3 +1061,59 @@ if.else:
10611061
call void @f2()
10621062
unreachable
10631063
}
1064+
1065+
define i8 @invert_bitcasted_icmp(<8 x i32> %a, <8 x i32> %b) {
1066+
; CHECK-LABEL: @invert_bitcasted_icmp(
1067+
; CHECK-NEXT: [[CMP:%.*]] = icmp sle <8 x i32> [[A:%.*]], [[B:%.*]]
1068+
; CHECK-NEXT: [[MASK_AS_INT:%.*]] = bitcast <8 x i1> [[CMP]] to i8
1069+
; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[MASK_AS_INT]], -1
1070+
; CHECK-NEXT: ret i8 [[NOT]]
1071+
;
1072+
%cmp = icmp sle <8 x i32> %a, %b
1073+
%mask.as.int = bitcast <8 x i1> %cmp to i8
1074+
%not = xor i8 %mask.as.int, 255
1075+
ret i8 %not
1076+
}
1077+
1078+
define i8 @invert_bitcasted_icmp_multi_use_1(<8 x i32> %a, <8 x i32> %b) {
1079+
; CHECK-LABEL: @invert_bitcasted_icmp_multi_use_1(
1080+
; CHECK-NEXT: [[CMP:%.*]] = icmp sle <8 x i32> [[A:%.*]], [[B:%.*]]
1081+
; CHECK-NEXT: call void (...) @llvm.fake.use(<8 x i1> [[CMP]])
1082+
; CHECK-NEXT: [[MASK_AS_INT:%.*]] = bitcast <8 x i1> [[CMP]] to i8
1083+
; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[MASK_AS_INT]], -1
1084+
; CHECK-NEXT: ret i8 [[NOT]]
1085+
;
1086+
%cmp = icmp sle <8 x i32> %a, %b
1087+
call void (...) @llvm.fake.use(<8 x i1> %cmp)
1088+
%mask.as.int = bitcast <8 x i1> %cmp to i8
1089+
%not = xor i8 %mask.as.int, -1
1090+
ret i8 %not
1091+
}
1092+
1093+
define i8 @invert_bitcasted_icmp_multi_use_2(<8 x i32> %a, <8 x i32> %b) {
1094+
; CHECK-LABEL: @invert_bitcasted_icmp_multi_use_2(
1095+
; CHECK-NEXT: [[CMP:%.*]] = icmp sle <8 x i32> [[A:%.*]], [[B:%.*]]
1096+
; CHECK-NEXT: [[MASK_AS_INT:%.*]] = bitcast <8 x i1> [[CMP]] to i8
1097+
; CHECK-NEXT: call void (...) @llvm.fake.use(i8 [[MASK_AS_INT]])
1098+
; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[MASK_AS_INT]], -1
1099+
; CHECK-NEXT: ret i8 [[NOT]]
1100+
;
1101+
%cmp = icmp sle <8 x i32> %a, %b
1102+
%mask.as.int = bitcast <8 x i1> %cmp to i8
1103+
call void (...) @llvm.fake.use(i8 %mask.as.int)
1104+
%not = xor i8 %mask.as.int, -1
1105+
ret i8 %not
1106+
}
1107+
1108+
define i8 @invert_bitcasted_fcmp(<8 x float> %a, <8 x float> %b) {
1109+
; CHECK-LABEL: @invert_bitcasted_fcmp(
1110+
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <8 x float> [[A:%.*]], [[B:%.*]]
1111+
; CHECK-NEXT: [[MASK_AS_INT:%.*]] = bitcast <8 x i1> [[CMP]] to i8
1112+
; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[MASK_AS_INT]], -1
1113+
; CHECK-NEXT: ret i8 [[NOT]]
1114+
;
1115+
%cmp = fcmp olt <8 x float> %a, %b
1116+
%mask.as.int = bitcast <8 x i1> %cmp to i8
1117+
%not = xor i8 %mask.as.int, 255
1118+
ret i8 %not
1119+
}

0 commit comments

Comments
 (0)