1; RUN: llc -march=hexagon < %s | FileCheck %s 2 3; --- Byte 4 5; CHECK-LABEL: test_00: 6; CHECK: q[[Q000:[0-3]]] = vcmp.eq(v0.b,v1.b) 7; CHECK: v0 = vmux(q[[Q000]],v1,v2) 8define <128 x i8> @test_00(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 9 %t0 = icmp eq <128 x i8> %v0, %v1 10 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 11 ret <128 x i8> %t1 12} 13 14; CHECK-LABEL: test_01: 15; CHECK: q[[Q010:[0-3]]] = vcmp.eq(v0.b,v1.b) 16; CHECK: v0 = vmux(q[[Q010]],v2,v1) 17define <128 x i8> @test_01(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 18 %t0 = icmp ne <128 x i8> %v0, %v1 19 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 20 ret <128 x i8> %t1 21} 22 23; CHECK-LABEL: test_02: 24; CHECK: q[[Q020:[0-3]]] = vcmp.gt(v1.b,v0.b) 25; CHECK: v0 = vmux(q[[Q020]],v1,v2) 26define <128 x i8> @test_02(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 27 %t0 = icmp slt <128 x i8> %v0, %v1 28 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 29 ret <128 x i8> %t1 30} 31 32; CHECK-LABEL: test_03: 33; CHECK: q[[Q030:[0-3]]] = vcmp.gt(v0.b,v1.b) 34; CHECK: v0 = vmux(q[[Q030]],v2,v1) 35define <128 x i8> @test_03(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 36 %t0 = icmp sle <128 x i8> %v0, %v1 37 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 38 ret <128 x i8> %t1 39} 40 41; CHECK-LABEL: test_04: 42; CHECK: q[[Q040:[0-3]]] = vcmp.gt(v0.b,v1.b) 43; CHECK: v0 = vmux(q[[Q040]],v1,v2) 44define <128 x i8> @test_04(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 45 %t0 = icmp sgt <128 x i8> %v0, %v1 46 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 47 ret <128 x i8> %t1 48} 49 50; CHECK-LABEL: test_05: 51; CHECK: q[[Q050:[0-3]]] = vcmp.gt(v1.b,v0.b) 52; CHECK: v0 = vmux(q[[Q050]],v2,v1) 53define <128 x i8> @test_05(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 54 %t0 = icmp sge <128 x i8> %v0, %v1 55 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 56 ret <128 x i8> %t1 57} 58 59; CHECK-LABEL: test_06: 60; CHECK: q[[Q060:[0-3]]] = vcmp.gt(v1.ub,v0.ub) 61; CHECK: v0 = vmux(q[[Q060]],v1,v2) 62define <128 x i8> @test_06(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 63 %t0 = icmp ult <128 x i8> %v0, %v1 64 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 65 ret <128 x i8> %t1 66} 67 68; CHECK-LABEL: test_07: 69; CHECK: q[[Q070:[0-3]]] = vcmp.gt(v0.ub,v1.ub) 70; CHECK: v0 = vmux(q[[Q070]],v2,v1) 71define <128 x i8> @test_07(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 72 %t0 = icmp ule <128 x i8> %v0, %v1 73 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 74 ret <128 x i8> %t1 75} 76 77; CHECK-LABEL: test_08: 78; CHECK: q[[Q080:[0-3]]] = vcmp.gt(v0.ub,v1.ub) 79; CHECK: v0 = vmux(q[[Q080]],v1,v2) 80define <128 x i8> @test_08(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 81 %t0 = icmp ugt <128 x i8> %v0, %v1 82 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 83 ret <128 x i8> %t1 84} 85 86; CHECK-LABEL: test_09: 87; CHECK: q[[Q090:[0-3]]] = vcmp.gt(v1.ub,v0.ub) 88; CHECK: v0 = vmux(q[[Q090]],v2,v1) 89define <128 x i8> @test_09(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 90 %t0 = icmp uge <128 x i8> %v0, %v1 91 %t1 = select <128 x i1> %t0, <128 x i8> %v1, <128 x i8> %v2 92 ret <128 x i8> %t1 93} 94 95; CHECK-LABEL: test_0a: 96; CHECK: q[[Q0A0:[0-3]]] &= vcmp.eq(v0.b,v1.b) 97; CHECK: v0 = vmux(q[[Q0A0]],v0,v1) 98define <128 x i8> @test_0a(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 99 %q0 = icmp eq <128 x i8> %v0, %v1 100 %q1 = trunc <128 x i8> %v2 to <128 x i1> 101 %q2 = and <128 x i1> %q0, %q1 102 %t1 = select <128 x i1> %q2, <128 x i8> %v0, <128 x i8> %v1 103 ret <128 x i8> %t1 104} 105 106; CHECK-LABEL: test_0b: 107; CHECK: q[[Q0B0:[0-3]]] |= vcmp.eq(v0.b,v1.b) 108; CHECK: v0 = vmux(q[[Q0B0]],v0,v1) 109define <128 x i8> @test_0b(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 110 %q0 = icmp eq <128 x i8> %v0, %v1 111 %q1 = trunc <128 x i8> %v2 to <128 x i1> 112 %q2 = or <128 x i1> %q0, %q1 113 %t1 = select <128 x i1> %q2, <128 x i8> %v0, <128 x i8> %v1 114 ret <128 x i8> %t1 115} 116 117; CHECK-LABEL: test_0c: 118; CHECK: q[[Q0C0:[0-3]]] ^= vcmp.eq(v0.b,v1.b) 119; CHECK: v0 = vmux(q[[Q0C0]],v0,v1) 120define <128 x i8> @test_0c(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 121 %q0 = icmp eq <128 x i8> %v0, %v1 122 %q1 = trunc <128 x i8> %v2 to <128 x i1> 123 %q2 = xor <128 x i1> %q0, %q1 124 %t1 = select <128 x i1> %q2, <128 x i8> %v0, <128 x i8> %v1 125 ret <128 x i8> %t1 126} 127 128; CHECK-LABEL: test_0d: 129; CHECK: q[[Q0D0:[0-3]]] &= vcmp.gt(v0.b,v1.b) 130; CHECK: v0 = vmux(q[[Q0D0]],v0,v1) 131define <128 x i8> @test_0d(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 132 %q0 = icmp sgt <128 x i8> %v0, %v1 133 %q1 = trunc <128 x i8> %v2 to <128 x i1> 134 %q2 = and <128 x i1> %q0, %q1 135 %t1 = select <128 x i1> %q2, <128 x i8> %v0, <128 x i8> %v1 136 ret <128 x i8> %t1 137} 138 139; CHECK-LABEL: test_0e: 140; CHECK: q[[Q0E0:[0-3]]] |= vcmp.gt(v0.b,v1.b) 141; CHECK: v0 = vmux(q[[Q0E0]],v0,v1) 142define <128 x i8> @test_0e(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 143 %q0 = icmp sgt <128 x i8> %v0, %v1 144 %q1 = trunc <128 x i8> %v2 to <128 x i1> 145 %q2 = or <128 x i1> %q0, %q1 146 %t1 = select <128 x i1> %q2, <128 x i8> %v0, <128 x i8> %v1 147 ret <128 x i8> %t1 148} 149 150; CHECK-LABEL: test_0f: 151; CHECK: q[[Q0F0:[0-3]]] ^= vcmp.gt(v0.b,v1.b) 152; CHECK: v0 = vmux(q[[Q0F0]],v0,v1) 153define <128 x i8> @test_0f(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 154 %q0 = icmp sgt <128 x i8> %v0, %v1 155 %q1 = trunc <128 x i8> %v2 to <128 x i1> 156 %q2 = xor <128 x i1> %q0, %q1 157 %t1 = select <128 x i1> %q2, <128 x i8> %v0, <128 x i8> %v1 158 ret <128 x i8> %t1 159} 160 161; CHECK-LABEL: test_0g: 162; CHECK: q[[Q0G0:[0-3]]] &= vcmp.gt(v0.ub,v1.ub) 163; CHECK: v0 = vmux(q[[Q0G0]],v0,v1) 164define <128 x i8> @test_0g(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 165 %q0 = icmp ugt <128 x i8> %v0, %v1 166 %q1 = trunc <128 x i8> %v2 to <128 x i1> 167 %q2 = and <128 x i1> %q0, %q1 168 %t1 = select <128 x i1> %q2, <128 x i8> %v0, <128 x i8> %v1 169 ret <128 x i8> %t1 170} 171 172; CHECK-LABEL: test_0h: 173; CHECK: q[[Q0H0:[0-3]]] |= vcmp.gt(v0.ub,v1.ub) 174; CHECK: v0 = vmux(q[[Q0H0]],v0,v1) 175define <128 x i8> @test_0h(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 176 %q0 = icmp ugt <128 x i8> %v0, %v1 177 %q1 = trunc <128 x i8> %v2 to <128 x i1> 178 %q2 = or <128 x i1> %q0, %q1 179 %t1 = select <128 x i1> %q2, <128 x i8> %v0, <128 x i8> %v1 180 ret <128 x i8> %t1 181} 182 183; CHECK-LABEL: test_0i: 184; CHECK: q[[Q0I0:[0-3]]] ^= vcmp.gt(v0.ub,v1.ub) 185; CHECK: v0 = vmux(q[[Q0I0]],v0,v1) 186define <128 x i8> @test_0i(<128 x i8> %v0, <128 x i8> %v1, <128 x i8> %v2) #0 { 187 %q0 = icmp ugt <128 x i8> %v0, %v1 188 %q1 = trunc <128 x i8> %v2 to <128 x i1> 189 %q2 = xor <128 x i1> %q0, %q1 190 %t1 = select <128 x i1> %q2, <128 x i8> %v0, <128 x i8> %v1 191 ret <128 x i8> %t1 192} 193 194; --- Half 195 196; CHECK-LABEL: test_10: 197; CHECK: q[[Q100:[0-3]]] = vcmp.eq(v0.h,v1.h) 198; CHECK: v0 = vmux(q[[Q100]],v1,v2) 199define <64 x i16> @test_10(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 200 %t0 = icmp eq <64 x i16> %v0, %v1 201 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 202 ret <64 x i16> %t1 203} 204 205; CHECK-LABEL: test_11: 206; CHECK: q[[Q110:[0-3]]] = vcmp.eq(v0.h,v1.h) 207; CHECK: v0 = vmux(q[[Q110]],v2,v1) 208define <64 x i16> @test_11(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 209 %t0 = icmp ne <64 x i16> %v0, %v1 210 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 211 ret <64 x i16> %t1 212} 213 214; CHECK-LABEL: test_12: 215; CHECK: q[[Q120:[0-3]]] = vcmp.gt(v1.h,v0.h) 216; CHECK: v0 = vmux(q[[Q120]],v1,v2) 217define <64 x i16> @test_12(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 218 %t0 = icmp slt <64 x i16> %v0, %v1 219 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 220 ret <64 x i16> %t1 221} 222 223; CHECK-LABEL: test_13: 224; CHECK: q[[Q130:[0-3]]] = vcmp.gt(v0.h,v1.h) 225; CHECK: v0 = vmux(q[[Q130]],v2,v1) 226define <64 x i16> @test_13(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 227 %t0 = icmp sle <64 x i16> %v0, %v1 228 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 229 ret <64 x i16> %t1 230} 231 232; CHECK-LABEL: test_14: 233; CHECK: q[[Q140:[0-3]]] = vcmp.gt(v0.h,v1.h) 234; CHECK: v0 = vmux(q[[Q140]],v1,v2) 235define <64 x i16> @test_14(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 236 %t0 = icmp sgt <64 x i16> %v0, %v1 237 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 238 ret <64 x i16> %t1 239} 240 241; CHECK-LABEL: test_15: 242; CHECK: q[[Q150:[0-3]]] = vcmp.gt(v1.h,v0.h) 243; CHECK: v0 = vmux(q[[Q150]],v2,v1) 244define <64 x i16> @test_15(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 245 %t0 = icmp sge <64 x i16> %v0, %v1 246 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 247 ret <64 x i16> %t1 248} 249 250; CHECK-LABEL: test_16: 251; CHECK: q[[Q160:[0-3]]] = vcmp.gt(v1.uh,v0.uh) 252; CHECK: v0 = vmux(q[[Q160]],v1,v2) 253define <64 x i16> @test_16(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 254 %t0 = icmp ult <64 x i16> %v0, %v1 255 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 256 ret <64 x i16> %t1 257} 258 259; CHECK-LABEL: test_17: 260; CHECK: q[[Q170:[0-3]]] = vcmp.gt(v0.uh,v1.uh) 261; CHECK: v0 = vmux(q[[Q170]],v2,v1) 262define <64 x i16> @test_17(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 263 %t0 = icmp ule <64 x i16> %v0, %v1 264 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 265 ret <64 x i16> %t1 266} 267 268; CHECK-LABEL: test_18: 269; CHECK: q[[Q180:[0-3]]] = vcmp.gt(v0.uh,v1.uh) 270; CHECK: v0 = vmux(q[[Q180]],v1,v2) 271define <64 x i16> @test_18(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 272 %t0 = icmp ugt <64 x i16> %v0, %v1 273 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 274 ret <64 x i16> %t1 275} 276 277; CHECK-LABEL: test_19: 278; CHECK: q[[Q190:[0-3]]] = vcmp.gt(v1.uh,v0.uh) 279; CHECK: v0 = vmux(q[[Q190]],v2,v1) 280define <64 x i16> @test_19(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 281 %t0 = icmp uge <64 x i16> %v0, %v1 282 %t1 = select <64 x i1> %t0, <64 x i16> %v1, <64 x i16> %v2 283 ret <64 x i16> %t1 284} 285 286; CHECK-LABEL: test_1a: 287; CHECK: q[[Q1A0:[0-3]]] &= vcmp.eq(v0.h,v1.h) 288; CHECK: v0 = vmux(q[[Q1A0]],v0,v1) 289define <64 x i16> @test_1a(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 290 %q0 = icmp eq <64 x i16> %v0, %v1 291 %q1 = trunc <64 x i16> %v2 to <64 x i1> 292 %q2 = and <64 x i1> %q0, %q1 293 %t1 = select <64 x i1> %q2, <64 x i16> %v0, <64 x i16> %v1 294 ret <64 x i16> %t1 295} 296 297; CHECK-LABEL: test_1b: 298; CHECK: q[[Q1B0:[0-3]]] |= vcmp.eq(v0.h,v1.h) 299; CHECK: v0 = vmux(q[[Q1B0]],v0,v1) 300define <64 x i16> @test_1b(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 301 %q0 = icmp eq <64 x i16> %v0, %v1 302 %q1 = trunc <64 x i16> %v2 to <64 x i1> 303 %q2 = or <64 x i1> %q0, %q1 304 %t1 = select <64 x i1> %q2, <64 x i16> %v0, <64 x i16> %v1 305 ret <64 x i16> %t1 306} 307 308; CHECK-LABEL: test_1c: 309; CHECK: q[[Q1C0:[0-3]]] ^= vcmp.eq(v0.h,v1.h) 310; CHECK: v0 = vmux(q[[Q1C0]],v0,v1) 311define <64 x i16> @test_1c(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 312 %q0 = icmp eq <64 x i16> %v0, %v1 313 %q1 = trunc <64 x i16> %v2 to <64 x i1> 314 %q2 = xor <64 x i1> %q0, %q1 315 %t1 = select <64 x i1> %q2, <64 x i16> %v0, <64 x i16> %v1 316 ret <64 x i16> %t1 317} 318 319; CHECK-LABEL: test_1d: 320; CHECK: q[[Q1D0:[0-3]]] &= vcmp.gt(v0.h,v1.h) 321; CHECK: v0 = vmux(q[[Q1D0]],v0,v1) 322define <64 x i16> @test_1d(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 323 %q0 = icmp sgt <64 x i16> %v0, %v1 324 %q1 = trunc <64 x i16> %v2 to <64 x i1> 325 %q2 = and <64 x i1> %q0, %q1 326 %t1 = select <64 x i1> %q2, <64 x i16> %v0, <64 x i16> %v1 327 ret <64 x i16> %t1 328} 329 330; CHECK-LABEL: test_1e: 331; CHECK: q[[Q1E0:[0-3]]] |= vcmp.gt(v0.h,v1.h) 332; CHECK: v0 = vmux(q[[Q1E0]],v0,v1) 333define <64 x i16> @test_1e(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 334 %q0 = icmp sgt <64 x i16> %v0, %v1 335 %q1 = trunc <64 x i16> %v2 to <64 x i1> 336 %q2 = or <64 x i1> %q0, %q1 337 %t1 = select <64 x i1> %q2, <64 x i16> %v0, <64 x i16> %v1 338 ret <64 x i16> %t1 339} 340 341; CHECK-LABEL: test_1f: 342; CHECK: q[[Q1F0:[0-3]]] ^= vcmp.gt(v0.h,v1.h) 343; CHECK: v0 = vmux(q[[Q1F0]],v0,v1) 344define <64 x i16> @test_1f(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 345 %q0 = icmp sgt <64 x i16> %v0, %v1 346 %q1 = trunc <64 x i16> %v2 to <64 x i1> 347 %q2 = xor <64 x i1> %q0, %q1 348 %t1 = select <64 x i1> %q2, <64 x i16> %v0, <64 x i16> %v1 349 ret <64 x i16> %t1 350} 351 352; CHECK-LABEL: test_1g: 353; CHECK: q[[Q1G0:[0-3]]] &= vcmp.gt(v0.uh,v1.uh) 354; CHECK: v0 = vmux(q[[Q1G0]],v0,v1) 355define <64 x i16> @test_1g(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 356 %q0 = icmp ugt <64 x i16> %v0, %v1 357 %q1 = trunc <64 x i16> %v2 to <64 x i1> 358 %q2 = and <64 x i1> %q0, %q1 359 %t1 = select <64 x i1> %q2, <64 x i16> %v0, <64 x i16> %v1 360 ret <64 x i16> %t1 361} 362 363; CHECK-LABEL: test_1h: 364; CHECK: q[[Q1H0:[0-3]]] |= vcmp.gt(v0.uh,v1.uh) 365; CHECK: v0 = vmux(q[[Q1H0]],v0,v1) 366define <64 x i16> @test_1h(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 367 %q0 = icmp ugt <64 x i16> %v0, %v1 368 %q1 = trunc <64 x i16> %v2 to <64 x i1> 369 %q2 = or <64 x i1> %q0, %q1 370 %t1 = select <64 x i1> %q2, <64 x i16> %v0, <64 x i16> %v1 371 ret <64 x i16> %t1 372} 373 374; CHECK-LABEL: test_1i: 375; CHECK: q[[Q1I0:[0-3]]] ^= vcmp.gt(v0.uh,v1.uh) 376; CHECK: v0 = vmux(q[[Q1I0]],v0,v1) 377define <64 x i16> @test_1i(<64 x i16> %v0, <64 x i16> %v1, <64 x i16> %v2) #0 { 378 %q0 = icmp ugt <64 x i16> %v0, %v1 379 %q1 = trunc <64 x i16> %v2 to <64 x i1> 380 %q2 = xor <64 x i1> %q0, %q1 381 %t1 = select <64 x i1> %q2, <64 x i16> %v0, <64 x i16> %v1 382 ret <64 x i16> %t1 383} 384 385; --- Word 386 387; CHECK-LABEL: test_20: 388; CHECK: q[[Q200:[0-3]]] = vcmp.eq(v0.w,v1.w) 389; CHECK: v0 = vmux(q[[Q200]],v1,v2) 390define <32 x i32> @test_20(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 391 %t0 = icmp eq <32 x i32> %v0, %v1 392 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 393 ret <32 x i32> %t1 394} 395 396; CHECK-LABEL: test_21: 397; CHECK: q[[Q210:[0-3]]] = vcmp.eq(v0.w,v1.w) 398; CHECK: v0 = vmux(q[[Q210]],v2,v1) 399define <32 x i32> @test_21(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 400 %t0 = icmp ne <32 x i32> %v0, %v1 401 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 402 ret <32 x i32> %t1 403} 404 405; CHECK-LABEL: test_22: 406; CHECK: q[[Q220:[0-3]]] = vcmp.gt(v1.w,v0.w) 407; CHECK: v0 = vmux(q[[Q220]],v1,v2) 408define <32 x i32> @test_22(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 409 %t0 = icmp slt <32 x i32> %v0, %v1 410 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 411 ret <32 x i32> %t1 412} 413 414; CHECK-LABEL: test_23: 415; CHECK: q[[Q230:[0-3]]] = vcmp.gt(v0.w,v1.w) 416; CHECK: v0 = vmux(q[[Q230]],v2,v1) 417define <32 x i32> @test_23(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 418 %t0 = icmp sle <32 x i32> %v0, %v1 419 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 420 ret <32 x i32> %t1 421} 422 423; CHECK-LABEL: test_24: 424; CHECK: q[[Q240:[0-3]]] = vcmp.gt(v0.w,v1.w) 425; CHECK: v0 = vmux(q[[Q240]],v1,v2) 426define <32 x i32> @test_24(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 427 %t0 = icmp sgt <32 x i32> %v0, %v1 428 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 429 ret <32 x i32> %t1 430} 431 432; CHECK-LABEL: test_25: 433; CHECK: q[[Q250:[0-3]]] = vcmp.gt(v1.w,v0.w) 434; CHECK: v0 = vmux(q[[Q250]],v2,v1) 435define <32 x i32> @test_25(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 436 %t0 = icmp sge <32 x i32> %v0, %v1 437 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 438 ret <32 x i32> %t1 439} 440 441; CHECK-LABEL: test_26: 442; CHECK: q[[Q260:[0-3]]] = vcmp.gt(v1.uw,v0.uw) 443; CHECK: v0 = vmux(q[[Q260]],v1,v2) 444define <32 x i32> @test_26(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 445 %t0 = icmp ult <32 x i32> %v0, %v1 446 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 447 ret <32 x i32> %t1 448} 449 450; CHECK-LABEL: test_27: 451; CHECK: q[[Q270:[0-3]]] = vcmp.gt(v0.uw,v1.uw) 452; CHECK: v0 = vmux(q[[Q270]],v2,v1) 453define <32 x i32> @test_27(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 454 %t0 = icmp ule <32 x i32> %v0, %v1 455 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 456 ret <32 x i32> %t1 457} 458 459; CHECK-LABEL: test_28: 460; CHECK: q[[Q280:[0-3]]] = vcmp.gt(v0.uw,v1.uw) 461; CHECK: v0 = vmux(q[[Q280]],v1,v2) 462define <32 x i32> @test_28(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 463 %t0 = icmp ugt <32 x i32> %v0, %v1 464 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 465 ret <32 x i32> %t1 466} 467 468; CHECK-LABEL: test_29: 469; CHECK: q[[Q290:[0-3]]] = vcmp.gt(v1.uw,v0.uw) 470; CHECK: v0 = vmux(q[[Q290]],v2,v1) 471define <32 x i32> @test_29(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 472 %t0 = icmp uge <32 x i32> %v0, %v1 473 %t1 = select <32 x i1> %t0, <32 x i32> %v1, <32 x i32> %v2 474 ret <32 x i32> %t1 475} 476 477; CHECK-LABEL: test_2a: 478; CHECK: q[[Q2A0:[0-3]]] &= vcmp.eq(v0.w,v1.w) 479; CHECK: v0 = vmux(q[[Q2A0]],v0,v1) 480define <32 x i32> @test_2a(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 481 %q0 = icmp eq <32 x i32> %v0, %v1 482 %q1 = trunc <32 x i32> %v2 to <32 x i1> 483 %q2 = and <32 x i1> %q0, %q1 484 %t1 = select <32 x i1> %q2, <32 x i32> %v0, <32 x i32> %v1 485 ret <32 x i32> %t1 486} 487 488; CHECK-LABEL: test_2b: 489; CHECK: q[[Q2B0:[0-3]]] |= vcmp.eq(v0.w,v1.w) 490; CHECK: v0 = vmux(q[[Q2B0]],v0,v1) 491define <32 x i32> @test_2b(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 492 %q0 = icmp eq <32 x i32> %v0, %v1 493 %q1 = trunc <32 x i32> %v2 to <32 x i1> 494 %q2 = or <32 x i1> %q0, %q1 495 %t1 = select <32 x i1> %q2, <32 x i32> %v0, <32 x i32> %v1 496 ret <32 x i32> %t1 497} 498 499; CHECK-LABEL: test_2c: 500; CHECK: q[[Q2C0:[0-3]]] ^= vcmp.eq(v0.w,v1.w) 501; CHECK: v0 = vmux(q[[Q2C0]],v0,v1) 502define <32 x i32> @test_2c(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 503 %q0 = icmp eq <32 x i32> %v0, %v1 504 %q1 = trunc <32 x i32> %v2 to <32 x i1> 505 %q2 = xor <32 x i1> %q0, %q1 506 %t1 = select <32 x i1> %q2, <32 x i32> %v0, <32 x i32> %v1 507 ret <32 x i32> %t1 508} 509 510; CHECK-LABEL: test_2d: 511; CHECK: q[[Q2D0:[0-3]]] &= vcmp.gt(v0.w,v1.w) 512; CHECK: v0 = vmux(q[[Q2D0]],v0,v1) 513define <32 x i32> @test_2d(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 514 %q0 = icmp sgt <32 x i32> %v0, %v1 515 %q1 = trunc <32 x i32> %v2 to <32 x i1> 516 %q2 = and <32 x i1> %q0, %q1 517 %t1 = select <32 x i1> %q2, <32 x i32> %v0, <32 x i32> %v1 518 ret <32 x i32> %t1 519} 520 521; CHECK-LABEL: test_2e: 522; CHECK: q[[Q2E0:[0-3]]] |= vcmp.gt(v0.w,v1.w) 523; CHECK: v0 = vmux(q[[Q2E0]],v0,v1) 524define <32 x i32> @test_2e(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 525 %q0 = icmp sgt <32 x i32> %v0, %v1 526 %q1 = trunc <32 x i32> %v2 to <32 x i1> 527 %q2 = or <32 x i1> %q0, %q1 528 %t1 = select <32 x i1> %q2, <32 x i32> %v0, <32 x i32> %v1 529 ret <32 x i32> %t1 530} 531 532; CHECK-LABEL: test_2f: 533; CHECK: q[[Q2F0:[0-3]]] ^= vcmp.gt(v0.w,v1.w) 534; CHECK: v0 = vmux(q[[Q2F0]],v0,v1) 535define <32 x i32> @test_2f(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 536 %q0 = icmp sgt <32 x i32> %v0, %v1 537 %q1 = trunc <32 x i32> %v2 to <32 x i1> 538 %q2 = xor <32 x i1> %q0, %q1 539 %t1 = select <32 x i1> %q2, <32 x i32> %v0, <32 x i32> %v1 540 ret <32 x i32> %t1 541} 542 543; CHECK-LABEL: test_2g: 544; CHECK: q[[Q2G0:[0-3]]] &= vcmp.gt(v0.uw,v1.uw) 545; CHECK: v0 = vmux(q[[Q2G0]],v0,v1) 546define <32 x i32> @test_2g(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 547 %q0 = icmp ugt <32 x i32> %v0, %v1 548 %q1 = trunc <32 x i32> %v2 to <32 x i1> 549 %q2 = and <32 x i1> %q0, %q1 550 %t1 = select <32 x i1> %q2, <32 x i32> %v0, <32 x i32> %v1 551 ret <32 x i32> %t1 552} 553 554; CHECK-LABEL: test_2h: 555; CHECK: q[[Q2H0:[0-3]]] |= vcmp.gt(v0.uw,v1.uw) 556; CHECK: v0 = vmux(q[[Q2H0]],v0,v1) 557define <32 x i32> @test_2h(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 558 %q0 = icmp ugt <32 x i32> %v0, %v1 559 %q1 = trunc <32 x i32> %v2 to <32 x i1> 560 %q2 = or <32 x i1> %q0, %q1 561 %t1 = select <32 x i1> %q2, <32 x i32> %v0, <32 x i32> %v1 562 ret <32 x i32> %t1 563} 564 565; CHECK-LABEL: test_2i: 566; CHECK: q[[Q2I0:[0-3]]] ^= vcmp.gt(v0.uw,v1.uw) 567; CHECK: v0 = vmux(q[[Q2I0]],v0,v1) 568define <32 x i32> @test_2i(<32 x i32> %v0, <32 x i32> %v1, <32 x i32> %v2) #0 { 569 %q0 = icmp ugt <32 x i32> %v0, %v1 570 %q1 = trunc <32 x i32> %v2 to <32 x i1> 571 %q2 = xor <32 x i1> %q0, %q1 572 %t1 = select <32 x i1> %q2, <32 x i32> %v0, <32 x i32> %v1 573 ret <32 x i32> %t1 574} 575 576attributes #0 = { nounwind readnone "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-length128b" } 577