1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 define i1 @set_low_bit_mask_eq(i8 %x) {
5 ; CHECK-LABEL: @set_low_bit_mask_eq(
6 ; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[X:%.*]], -2
7 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[TMP1]], 18
8 ; CHECK-NEXT: ret i1 [[CMP]]
11 %cmp = icmp eq i8 %sub, 19
15 define <2 x i1> @set_low_bit_mask_ne(<2 x i8> %x) {
16 ; CHECK-LABEL: @set_low_bit_mask_ne(
17 ; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i8> [[X:%.*]], <i8 -4, i8 -4>
18 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i8> [[TMP1]], <i8 16, i8 16>
19 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
21 %sub = or <2 x i8> %x, <i8 3, i8 3>
22 %cmp = icmp ne <2 x i8> %sub, <i8 19, i8 19>
26 define i1 @set_low_bit_mask_ugt(i8 %x) {
27 ; CHECK-LABEL: @set_low_bit_mask_ugt(
28 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[X:%.*]], 19
29 ; CHECK-NEXT: ret i1 [[CMP]]
32 %cmp = icmp ugt i8 %sub, 19
36 define i1 @set_low_bit_mask_ult(i8 %x) {
37 ; CHECK-LABEL: @set_low_bit_mask_ult(
38 ; CHECK-NEXT: [[SUB:%.*]] = or i8 [[X:%.*]], 3
39 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[SUB]], 19
40 ; CHECK-NEXT: ret i1 [[CMP]]
43 %cmp = icmp ult i8 %sub, 19
47 define i1 @set_low_bit_mask_uge(i8 %x) {
48 ; CHECK-LABEL: @set_low_bit_mask_uge(
49 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[X:%.*]], 19
50 ; CHECK-NEXT: ret i1 [[CMP]]
53 %cmp = icmp uge i8 %sub, 20
57 define i1 @set_low_bit_mask_ule(i8 %x) {
58 ; CHECK-LABEL: @set_low_bit_mask_ule(
59 ; CHECK-NEXT: [[SUB:%.*]] = or i8 [[X:%.*]], 3
60 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[SUB]], 19
61 ; CHECK-NEXT: ret i1 [[CMP]]
64 %cmp = icmp ule i8 %sub, 18
68 define i1 @set_low_bit_mask_sgt(i8 %x) {
69 ; CHECK-LABEL: @set_low_bit_mask_sgt(
70 ; CHECK-NEXT: [[SUB:%.*]] = or i8 [[X:%.*]], 3
71 ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[SUB]], 20
72 ; CHECK-NEXT: ret i1 [[CMP]]
75 %cmp = icmp sgt i8 %sub, 20
79 define i1 @set_low_bit_mask_slt(i8 %x) {
80 ; CHECK-LABEL: @set_low_bit_mask_slt(
81 ; CHECK-NEXT: [[SUB:%.*]] = or i8 [[X:%.*]], 15
82 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[SUB]], 19
83 ; CHECK-NEXT: ret i1 [[CMP]]
86 %cmp = icmp slt i8 %sub, 19
90 define i1 @set_low_bit_mask_sge(i8 %x) {
91 ; CHECK-LABEL: @set_low_bit_mask_sge(
92 ; CHECK-NEXT: [[SUB:%.*]] = or i8 [[X:%.*]], 31
93 ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[SUB]], 50
94 ; CHECK-NEXT: ret i1 [[CMP]]
97 %cmp = icmp sge i8 %sub, 51
101 define i1 @set_low_bit_mask_sle(i8 %x) {
102 ; CHECK-LABEL: @set_low_bit_mask_sle(
103 ; CHECK-NEXT: [[SUB:%.*]] = or i8 [[X:%.*]], 63
104 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[SUB]], 69
105 ; CHECK-NEXT: ret i1 [[CMP]]
108 %cmp = icmp sle i8 %sub, 68