@@ -552,3 +552,73 @@ define <2 x double> @select_eq_v2f64(i32 %i, <2 x double> %x, <2 x double> %y) {
552552 %res = select i1 %c , <2 x double > %x , <2 x double > %y
553553 ret <2 x double > %res
554554}
555+
556+ define <4 x i32 > @select_splat_first_zero_and_icmp (<4 x i32 > %x ) {
557+ ; CHECK-LABEL: select_splat_first_zero_and_icmp:
558+ ; CHECK: .functype select_splat_first_zero_and_icmp (v128) -> (v128)
559+ ; CHECK-NEXT: # %bb.0:
560+ ; CHECK-NEXT: local.get 0
561+ ; CHECK-NEXT: v128.const 2139095040, 2139095040, 2139095040, 2139095040
562+ ; CHECK-NEXT: v128.and
563+ ; CHECK-NEXT: v128.const 0, 0, 0, 0
564+ ; CHECK-NEXT: i32x4.ne
565+ ; CHECK-NEXT: local.get 0
566+ ; CHECK-NEXT: v128.and
567+ ; CHECK-NEXT: # fallthrough-return
568+ %a = and <4 x i32 > %x , splat (i32 2139095040 )
569+ %c = icmp eq <4 x i32 > %a , zeroinitializer
570+ %res = select <4 x i1 > %c , <4 x i32 > zeroinitializer , <4 x i32 > %x
571+ ret <4 x i32 > %res
572+ }
573+
574+ define <4 x i32 > @select_splat_second_zero_and_icmp (<4 x i32 > %x ) {
575+ ; CHECK-LABEL: select_splat_second_zero_and_icmp:
576+ ; CHECK: .functype select_splat_second_zero_and_icmp (v128) -> (v128)
577+ ; CHECK-NEXT: # %bb.0:
578+ ; CHECK-NEXT: local.get 0
579+ ; CHECK-NEXT: v128.const 2139095040, 2139095040, 2139095040, 2139095040
580+ ; CHECK-NEXT: v128.and
581+ ; CHECK-NEXT: v128.const 0, 0, 0, 0
582+ ; CHECK-NEXT: i32x4.eq
583+ ; CHECK-NEXT: local.get 0
584+ ; CHECK-NEXT: v128.and
585+ ; CHECK-NEXT: # fallthrough-return
586+ %a = and <4 x i32 > %x , splat (i32 2139095040 )
587+ %c = icmp eq <4 x i32 > %a , zeroinitializer
588+ %res = select <4 x i1 > %c , <4 x i32 > %x , <4 x i32 > zeroinitializer
589+ ret <4 x i32 > %res
590+ }
591+
592+ define <4 x i32 > @select_splat_first_zero_cond_input (<4 x i1 > %c , <4 x i32 > %x ) {
593+ ; CHECK-LABEL: select_splat_first_zero_cond_input:
594+ ; CHECK: .functype select_splat_first_zero_cond_input (v128, v128) -> (v128)
595+ ; CHECK-NEXT: # %bb.0:
596+ ; CHECK-NEXT: v128.const 0, 0, 0, 0
597+ ; CHECK-NEXT: local.get 1
598+ ; CHECK-NEXT: local.get 0
599+ ; CHECK-NEXT: i32.const 31
600+ ; CHECK-NEXT: i32x4.shl
601+ ; CHECK-NEXT: i32.const 31
602+ ; CHECK-NEXT: i32x4.shr_s
603+ ; CHECK-NEXT: v128.bitselect
604+ ; CHECK-NEXT: # fallthrough-return
605+ %res = select <4 x i1 > %c , <4 x i32 > zeroinitializer , <4 x i32 > %x
606+ ret <4 x i32 > %res
607+ }
608+
609+ define <4 x i32 > @select_splat_second_zero_cond_input (<4 x i1 > %c , <4 x i32 > %x ) {
610+ ; CHECK-LABEL: select_splat_second_zero_cond_input:
611+ ; CHECK: .functype select_splat_second_zero_cond_input (v128, v128) -> (v128)
612+ ; CHECK-NEXT: # %bb.0:
613+ ; CHECK-NEXT: local.get 0
614+ ; CHECK-NEXT: i32.const 31
615+ ; CHECK-NEXT: i32x4.shl
616+ ; CHECK-NEXT: i32.const 31
617+ ; CHECK-NEXT: i32x4.shr_s
618+ ; CHECK-NEXT: local.get 1
619+ ; CHECK-NEXT: v128.and
620+ ; CHECK-NEXT: # fallthrough-return
621+ %res = select <4 x i1 > %c , <4 x i32 > %x , <4 x i32 > zeroinitializer
622+ ret <4 x i32 > %res
623+ }
624+
0 commit comments