1; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s 2 3define signext i8 @func8s(i8 signext %a, i8 signext %b) { 4; CHECK-LABEL: func8s: 5; CHECK: # %bb.0: 6; CHECK-NEXT: nnd %s0, %s0, %s1 7; CHECK-NEXT: b.l.t (, %s10) 8 %not = xor i8 %a, -1 9 %res = and i8 %not, %b 10 ret i8 %res 11} 12 13define zeroext i8 @func8z(i8 zeroext %a, i8 zeroext %b) { 14; CHECK-LABEL: func8z: 15; CHECK: # %bb.0: 16; CHECK-NEXT: nnd %s0, %s0, %s1 17; CHECK-NEXT: b.l.t (, %s10) 18 %not = xor i8 %a, -1 19 %res = and i8 %b, %not 20 ret i8 %res 21} 22 23define signext i8 @funci8s(i8 signext %a) { 24; CHECK-LABEL: funci8s: 25; CHECK: # %bb.0: 26; CHECK-NEXT: or %s1, 5, (0)1 27; CHECK-NEXT: nnd %s0, %s0, %s1 28; CHECK-NEXT: b.l.t (, %s10) 29 %not = xor i8 %a, -1 30 %res = and i8 %not, 5 31 ret i8 %res 32} 33 34define zeroext i8 @funci8z(i8 zeroext %a) { 35; CHECK-LABEL: funci8z: 36; CHECK: # %bb.0: 37; CHECK-NEXT: lea %s1, 251 38; CHECK-NEXT: nnd %s0, %s0, %s1 39; CHECK-NEXT: b.l.t (, %s10) 40 %not = xor i8 %a, -1 41 %res = and i8 -5, %not 42 ret i8 %res 43} 44 45define signext i16 @func16s(i16 signext %a, i16 signext %b) { 46; CHECK-LABEL: func16s: 47; CHECK: # %bb.0: 48; CHECK-NEXT: nnd %s0, %s0, %s1 49; CHECK-NEXT: b.l.t (, %s10) 50 %not = xor i16 %a, -1 51 %res = and i16 %not, %b 52 ret i16 %res 53} 54 55define zeroext i16 @func16z(i16 zeroext %a, i16 zeroext %b) { 56; CHECK-LABEL: func16z: 57; CHECK: # %bb.0: 58; CHECK-NEXT: nnd %s0, %s0, %s1 59; CHECK-NEXT: b.l.t (, %s10) 60 %not = xor i16 %a, -1 61 %res = and i16 %b, %not 62 ret i16 %res 63} 64 65define signext i16 @funci16s(i16 signext %a) { 66; CHECK-LABEL: funci16s: 67; CHECK: # %bb.0: 68; CHECK-NEXT: xor %s0, -1, %s0 69; CHECK-NEXT: b.l.t (, %s10) 70 %not = xor i16 %a, -1 71 %res = and i16 %not, 65535 72 ret i16 %res 73} 74 75define zeroext i16 @funci16z(i16 zeroext %a) { 76; CHECK-LABEL: funci16z: 77; CHECK: # %bb.0: 78; CHECK-NEXT: nnd %s0, %s0, (52)0 79; CHECK-NEXT: b.l.t (, %s10) 80 %not = xor i16 %a, -1 81 %res = and i16 4095, %not 82 ret i16 %res 83} 84 85define signext i32 @func32s(i32 signext %a, i32 signext %b) { 86; CHECK-LABEL: func32s: 87; CHECK: # %bb.0: 88; CHECK-NEXT: nnd %s0, %s0, %s1 89; CHECK-NEXT: b.l.t (, %s10) 90 %not = xor i32 %a, -1 91 %res = and i32 %not, %b 92 ret i32 %res 93} 94 95define zeroext i32 @func32z(i32 zeroext %a, i32 zeroext %b) { 96; CHECK-LABEL: func32z: 97; CHECK: # %bb.0: 98; CHECK-NEXT: nnd %s0, %s0, %s1 99; CHECK-NEXT: b.l.t (, %s10) 100 %not = xor i32 %a, -1 101 %res = and i32 %not, %b 102 ret i32 %res 103} 104 105define signext i32 @funci32s(i32 signext %a) { 106; CHECK-LABEL: funci32s: 107; CHECK: # %bb.0: 108; CHECK-NEXT: nnd %s0, %s0, (36)0 109; CHECK-NEXT: b.l.t (, %s10) 110 %not = xor i32 %a, -1 111 %res = and i32 %not, 268435455 112 ret i32 %res 113} 114 115define zeroext i32 @funci32z(i32 zeroext %a) { 116; CHECK-LABEL: funci32z: 117; CHECK: # %bb.0: 118; CHECK-NEXT: nnd %s0, %s0, (36)0 119; CHECK-NEXT: b.l.t (, %s10) 120 %not = xor i32 %a, -1 121 %res = and i32 %not, 268435455 122 ret i32 %res 123} 124 125define i64 @func64(i64 %a, i64 %b) { 126; CHECK-LABEL: func64: 127; CHECK: # %bb.0: 128; CHECK-NEXT: nnd %s0, %s0, %s1 129; CHECK-NEXT: b.l.t (, %s10) 130 %not = xor i64 %a, -1 131 %res = and i64 %not, %b 132 ret i64 %res 133} 134 135define i64 @func64_2(i64 %a, i64 %b) { 136; CHECK-LABEL: func64_2: 137; CHECK: # %bb.0: 138; CHECK-NEXT: nnd %s0, %s1, %s0 139; CHECK-NEXT: b.l.t (, %s10) 140 %not = xor i64 %b, -1 141 %res = and i64 %not, %a 142 ret i64 %res 143} 144 145define i64 @func64i(i64 %a) { 146; CHECK-LABEL: func64i: 147; CHECK: # %bb.0: 148; CHECK-NEXT: nnd %s0, %s0, (24)0 149; CHECK-NEXT: b.l.t (, %s10) 150 %not = xor i64 %a, -1 151 %res = and i64 %not, 1099511627775 152 ret i64 %res 153} 154 155define i128 @func128(i128 %a, i128 %b) { 156; CHECK-LABEL: func128: 157; CHECK: # %bb.0: 158; CHECK-NEXT: nnd %s0, %s0, %s2 159; CHECK-NEXT: nnd %s1, %s1, %s3 160; CHECK-NEXT: b.l.t (, %s10) 161 %not = xor i128 %a, -1 162 %res = and i128 %b, %not 163 ret i128 %res 164} 165 166define i128 @funci128(i128 %a) { 167; CHECK-LABEL: funci128: 168; CHECK: # %bb.0: 169; CHECK-NEXT: or %s1, 5, (0)1 170; CHECK-NEXT: nnd %s0, %s0, %s1 171; CHECK-NEXT: or %s1, 0, (0)1 172; CHECK-NEXT: b.l.t (, %s10) 173 %not = xor i128 %a, -1 174 %res = and i128 %not, 5 175 ret i128 %res 176} 177 178define i64 @func64_nnd_fold(i64 %x, i64 %y, i64 %m) { 179; CHECK-LABEL: func64_nnd_fold: 180; CHECK: # %bb.0: 181; CHECK-NEXT: nnd %s1, %s2, %s1 182; CHECK-NEXT: and %s0, %s0, %s2 183; CHECK-NEXT: or %s0, %s0, %s1 184; CHECK-NEXT: b.l.t (, %s10) 185 %D = xor i64 %x, %y 186 %A = and i64 %D, %m 187 %res = xor i64 %A, %y 188 ret i64 %res 189} 190 191define i64 @func64iy_nnd_fold(i64 %x, i64 %m) { 192; CHECK-LABEL: func64iy_nnd_fold: 193; CHECK: # %bb.0: 194; CHECK-NEXT: nnd %s0, %s0, %s1 195; CHECK-NEXT: or %s1, -64, %s1 196; CHECK-NEXT: nnd %s0, %s0, %s1 197; CHECK-NEXT: b.l.t (, %s10) 198 %D = xor i64 %x, -64 199 %A = and i64 %D, %m 200 %res = xor i64 %A, -64 201 ret i64 %res 202} 203 204define i64 @func64im_nnd_fold(i64 %x, i64 %y) { 205; CHECK-LABEL: func64im_nnd_fold: 206; CHECK: # %bb.0: 207; CHECK-NEXT: xor %s0, %s0, %s1 208; CHECK-NEXT: and %s0, 30, %s0 209; CHECK-NEXT: xor %s0, %s0, %s1 210; CHECK-NEXT: b.l.t (, %s10) 211 %D = xor i64 %x, %y 212 %A = and i64 %D, 30 213 %res = xor i64 %A, %y 214 ret i64 %res 215} 216