@@ -323,6 +323,44 @@ define <2 x i32> @add_select_cmp_vec_nonunique(<2 x i32> %in) {
323323 %out = or disjoint <2 x i32 > %sel0 , %sel1
324324 ret <2 x i32 > %out
325325}
326+
327+ define i64 @mask_select_types (i32 %in ) {
328+ ; CHECK-LABEL: @mask_select_types(
329+ ; CHECK-NEXT: [[BITOP0:%.*]] = and i32 [[IN:%.*]], 1
330+ ; CHECK-NEXT: [[CMP0_NOT:%.*]] = icmp eq i32 [[BITOP0]], 0
331+ ; CHECK-NEXT: [[BITOP1:%.*]] = and i32 [[IN]], 2
332+ ; CHECK-NEXT: [[CMP1_NOT:%.*]] = icmp eq i32 [[BITOP1]], 0
333+ ; CHECK-NEXT: [[SEL0:%.*]] = select i1 [[CMP0_NOT]], i64 0, i64 72
334+ ; CHECK-NEXT: [[SEL1:%.*]] = select i1 [[CMP1_NOT]], i64 0, i64 144
335+ ; CHECK-NEXT: [[OUT:%.*]] = or disjoint i64 [[SEL0]], [[SEL1]]
336+ ; CHECK-NEXT: ret i64 [[OUT]]
337+ ;
338+ %bitop0 = and i32 %in , 1
339+ %cmp0 = icmp ne i32 %bitop0 , 0
340+ %bitop1 = and i32 %in , 2
341+ %cmp1 = icmp ne i32 %bitop1 , 0
342+ %sel0 = select i1 %cmp0 , i64 72 , i64 0
343+ %sel1 = select i1 %cmp1 , i64 144 , i64 0
344+ %out = or disjoint i64 %sel0 , %sel1
345+ ret i64 %out
346+ }
347+
348+ define i64 @mask_select_types_1 (i64 %in ) {
349+ ; CHECK-LABEL: @mask_select_types_1(
350+ ; CHECK-NEXT: [[TMP1:%.*]] = and i64 [[IN:%.*]], 3
351+ ; CHECK-NEXT: [[OUT:%.*]] = mul nuw nsw i64 [[TMP1]], 72
352+ ; CHECK-NEXT: ret i64 [[OUT]]
353+ ;
354+ %bitop0 = and i64 %in , 1
355+ %cmp0 = icmp ne i64 %bitop0 , 0
356+ %bitop1 = and i64 %in , 2
357+ %cmp1 = icmp ne i64 %bitop1 , 0
358+ %sel0 = select i1 %cmp0 , i64 72 , i64 0
359+ %sel1 = select i1 %cmp1 , i64 144 , i64 0
360+ %out = or disjoint i64 %sel0 , %sel1
361+ ret i64 %out
362+ }
363+
326364;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
327365; CONSTSPLAT: {{.*}}
328366; CONSTVEC: {{.*}}
0 commit comments