Skip to content

Commit ed14745

Browse files
committed
[InstCombine] Add test for regression in #127398. (NFC)
1 parent 936fe9b commit ed14745

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/test/Transforms/InstCombine/select-icmp-and.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,3 +794,18 @@ define i32 @select_bittest_to_shl_negative_test(i32 %x) {
794794
%res = add nuw nsw i32 %y, 2
795795
ret i32 %res
796796
}
797+
798+
define i8 @select_bittest_to_xor(i8 %x) {
799+
; CHECK-LABEL: @select_bittest_to_xor(
800+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[X:%.*]], -1
801+
; CHECK-NEXT: call void @use1(i1 [[CMP]])
802+
; CHECK-NEXT: [[MASKSEL:%.*]] = xor i8 [[X]], -128
803+
; CHECK-NEXT: ret i8 [[MASKSEL]]
804+
;
805+
%cmp = icmp sgt i8 %x, -1
806+
call void @use1(i1 %cmp)
807+
%and = and i8 %x, 127
808+
%or = or i8 %x, -128
809+
%masksel = select i1 %cmp, i8 %or, i8 %and
810+
ret i8 %masksel
811+
}

0 commit comments

Comments
 (0)