Skip to content

Commit b841fc6

Browse files
committed
Add test for the inverse case
1 parent b7ee463 commit b841fc6

File tree

1 file changed

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

1 file changed

+13
-0
lines changed

llvm/test/Transforms/InstCombine/scmp.ll

+13
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,19 @@ define i8 @scmp_from_select_eq_and_gt(i32 %x, i32 %y) {
358358
ret i8 %r
359359
}
360360

361+
define i8 @scmp_from_select_eq_and_gt_inverse(i32 %x, i32 %y) {
362+
; CHECK-LABEL: define i8 @scmp_from_select_eq_and_gt_inverse(
363+
; CHECK-SAME: i32 [[X:%.*]], i32 [[Y:%.*]]) {
364+
; CHECK-NEXT: [[R:%.*]] = call i8 @llvm.scmp.i8.i32(i32 [[X]], i32 [[Y]])
365+
; CHECK-NEXT: ret i8 [[R]]
366+
;
367+
%ne = icmp ne i32 %x, %y
368+
%gt = icmp sgt i32 %x, %y
369+
%sel1 = select i1 %gt, i8 1, i8 -1
370+
%r = select i1 %ne, i8 %sel1, i8 0
371+
ret i8 %r
372+
}
373+
361374
define <4 x i8> @scmp_from_select_eq_and_gt_vec(<4 x i32> %x, <4 x i32> %y) {
362375
; CHECK-LABEL: define <4 x i8> @scmp_from_select_eq_and_gt_vec(
363376
; CHECK-SAME: <4 x i32> [[X:%.*]], <4 x i32> [[Y:%.*]]) {

0 commit comments

Comments
 (0)