@@ -692,6 +692,32 @@ define <4 x float> @insert_undemanded_element_op1(<4 x float> %x, <4 x float> %y
692
692
ret <4 x float > %s
693
693
}
694
694
695
+ define <5 x float > @insert_undemanded_element_unequal_length_op0 (<4 x float > %x , <4 x float > %y ) {
696
+ ; CHECK-LABEL: @insert_undemanded_element_unequal_length_op0(
697
+ ; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.200000e+01, i32 3
698
+ ; CHECK-NEXT: call void @use(<4 x float> [[INS]])
699
+ ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[INS]], <4 x float> [[Y:%.*]], <5 x i32> <i32 undef, i32 0, i32 7, i32 1, i32 4>
700
+ ; CHECK-NEXT: ret <5 x float> [[S]]
701
+ ;
702
+ %ins = insertelement <4 x float > %x , float 42 .0 , i32 3
703
+ call void @use (<4 x float > %ins )
704
+ %s = shufflevector <4 x float > %ins , <4 x float > %y , <5 x i32 > <i32 undef , i32 0 , i32 7 , i32 1 , i32 4 >
705
+ ret <5 x float > %s
706
+ }
707
+
708
+ define <5 x float > @insert_undemanded_element_unequal_length_op1 (<4 x float > %x , <4 x float > %y ) {
709
+ ; CHECK-LABEL: @insert_undemanded_element_unequal_length_op1(
710
+ ; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.200000e+01, i32 3
711
+ ; CHECK-NEXT: call void @use(<4 x float> [[INS]])
712
+ ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> [[INS]], <5 x i32> <i32 undef, i32 3, i32 2, i32 1, i32 4>
713
+ ; CHECK-NEXT: ret <5 x float> [[S]]
714
+ ;
715
+ %ins = insertelement <4 x float > %x , float 42 .0 , i32 3
716
+ call void @use (<4 x float > %ins )
717
+ %s = shufflevector <4 x float > %y , <4 x float > %ins , <5 x i32 > <i32 undef , i32 3 , i32 2 , i32 1 , i32 4 >
718
+ ret <5 x float > %s
719
+ }
720
+
695
721
; Negative test - shuffle chooses the inserted constant.
696
722
697
723
define <4 x float > @insert_demanded_element_op0 (<4 x float > %x , <4 x float > %y ) {
@@ -722,6 +748,36 @@ define <4 x float> @insert_demanded_element_op1(<4 x float> %x, <4 x float> %y)
722
748
ret <4 x float > %s
723
749
}
724
750
751
+ ; Negative test - shuffle chooses the inserted constant.
752
+
753
+ define <5 x float > @insert_demanded_element_unequal_length_op0 (<4 x float > %x , <4 x float > %y ) {
754
+ ; CHECK-LABEL: @insert_demanded_element_unequal_length_op0(
755
+ ; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.200000e+01, i32 3
756
+ ; CHECK-NEXT: call void @use(<4 x float> [[INS]])
757
+ ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[INS]], <4 x float> [[Y:%.*]], <5 x i32> <i32 undef, i32 3, i32 2, i32 1, i32 4>
758
+ ; CHECK-NEXT: ret <5 x float> [[S]]
759
+ ;
760
+ %ins = insertelement <4 x float > %x , float 42 .0 , i32 3
761
+ call void @use (<4 x float > %ins )
762
+ %s = shufflevector <4 x float > %ins , <4 x float > %y , <5 x i32 > <i32 undef , i32 3 , i32 2 , i32 1 , i32 4 >
763
+ ret <5 x float > %s
764
+ }
765
+
766
+ ; Negative test - shuffle chooses the inserted constant.
767
+
768
+ define <5 x float > @insert_demanded_element_unequal_length_op1 (<4 x float > %x , <4 x float > %y ) {
769
+ ; CHECK-LABEL: @insert_demanded_element_unequal_length_op1(
770
+ ; CHECK-NEXT: [[INS:%.*]] = insertelement <4 x float> [[X:%.*]], float 4.300000e+01, i32 3
771
+ ; CHECK-NEXT: call void @use(<4 x float> [[INS]])
772
+ ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> [[INS]], <5 x i32> <i32 undef, i32 0, i32 7, i32 1, i32 4>
773
+ ; CHECK-NEXT: ret <5 x float> [[S]]
774
+ ;
775
+ %ins = insertelement <4 x float > %x , float 43 .0 , i32 3
776
+ call void @use (<4 x float > %ins )
777
+ %s = shufflevector <4 x float > %y , <4 x float > %ins , <5 x i32 > <i32 undef , i32 0 , i32 7 , i32 1 , i32 4 >
778
+ ret <5 x float > %s
779
+ }
780
+
725
781
define <4 x float > @splat_constant (<4 x float > %x ) {
726
782
; CHECK-LABEL: @splat_constant(
727
783
; CHECK-NEXT: [[INS3:%.*]] = insertelement <4 x float> [[X:%.*]], float 3.000000e+00, i32 3
0 commit comments