Skip to content

Commit 15d3e4a

Browse files
committed
[InstCombine] Test for two types of bittests (NFC)
1 parent aa9cc72 commit 15d3e4a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

llvm/test/Transforms/InstCombine/onehot_merge.ll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,3 +1143,20 @@ define i1 @foo1_and_signbit_lshr_without_shifting_signbit_not_pwr2_logical(i32 %
11431143
%or = select i1 %t2, i1 true, i1 %t4
11441144
ret i1 %or
11451145
}
1146+
1147+
define i1 @two_types_of_bittest(i8 %x, i8 %c) {
1148+
; CHECK-LABEL: @two_types_of_bittest(
1149+
; CHECK-NEXT: [[T0:%.*]] = shl nuw i8 1, [[C:%.*]]
1150+
; CHECK-NEXT: [[ICMP1:%.*]] = icmp slt i8 [[X:%.*]], 0
1151+
; CHECK-NEXT: [[AND:%.*]] = and i8 [[X]], [[T0]]
1152+
; CHECK-NEXT: [[ICMP2:%.*]] = icmp ne i8 [[AND]], 0
1153+
; CHECK-NEXT: [[RET:%.*]] = and i1 [[ICMP1]], [[ICMP2]]
1154+
; CHECK-NEXT: ret i1 [[RET]]
1155+
;
1156+
%t0 = shl i8 1, %c
1157+
%icmp1 = icmp slt i8 %x, 0
1158+
%and = and i8 %x, %t0
1159+
%icmp2 = icmp ne i8 %and, 0
1160+
%ret = and i1 %icmp1, %icmp2
1161+
ret i1 %ret
1162+
}

0 commit comments

Comments
 (0)