1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -instcombine -S | FileCheck %s 3 4define 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]] 9; 10 %sub = or i8 %x, 1 11 %cmp = icmp eq i8 %sub, 19 12 ret i1 %cmp 13} 14 15define <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]] 20; 21 %sub = or <2 x i8> %x, <i8 3, i8 3> 22 %cmp = icmp ne <2 x i8> %sub, <i8 19, i8 19> 23 ret <2 x i1> %cmp 24} 25 26define 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]] 30; 31 %sub = or i8 %x, 3 32 %cmp = icmp ugt i8 %sub, 19 33 ret i1 %cmp 34} 35 36define 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]] 41; 42 %sub = or i8 %x, 3 43 %cmp = icmp ult i8 %sub, 19 44 ret i1 %cmp 45} 46 47define 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]] 51; 52 %sub = or i8 %x, 3 53 %cmp = icmp uge i8 %sub, 20 54 ret i1 %cmp 55} 56 57define 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]] 62; 63 %sub = or i8 %x, 3 64 %cmp = icmp ule i8 %sub, 18 65 ret i1 %cmp 66} 67 68define 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]] 73; 74 %sub = or i8 %x, 3 75 %cmp = icmp sgt i8 %sub, 20 76 ret i1 %cmp 77} 78 79define 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]] 84; 85 %sub = or i8 %x, 15 86 %cmp = icmp slt i8 %sub, 19 87 ret i1 %cmp 88} 89 90define 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]] 95; 96 %sub = or i8 %x, 31 97 %cmp = icmp sge i8 %sub, 51 98 ret i1 %cmp 99} 100 101define 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]] 106; 107 %sub = or i8 %x, 63 108 %cmp = icmp sle i8 %sub, 68 109 ret i1 %cmp 110} 111 112