@@ -47,9 +47,9 @@ define <4 x float> @ext2_v4f32(<4 x float> %x, <4 x float> %y) {
4747
4848define <4 x float > @ext2_v2f32v4f32 (<2 x float > %x , <4 x float > %y ) {
4949; CHECK-LABEL: @ext2_v2f32v4f32(
50- ; CHECK-NEXT: [[TMP1 :%.*]] = fneg <2 x float> [[X:%.*]]
51- ; CHECK-NEXT: [[TMP2 :%.*]] = shufflevector <2 x float> [[TMP1]], <2 x float> poison, <4 x i32> <i32 poison, i32 poison, i32 2, i32 poison>
52- ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[Y:%.*]], <4 x float> [[TMP2 ]], <4 x i32> <i32 0, i32 1, i32 6, i32 3>
50+ ; CHECK-NEXT: [[E :%.*]] = extractelement <2 x float> [[X:%.*]], i32 2
51+ ; CHECK-NEXT: [[N :%.*]] = fneg float [[E]]
52+ ; CHECK-NEXT: [[R:%.*]] = insertelement <4 x float> [[Y:%.*]], float [[N ]], i32 2
5353; CHECK-NEXT: ret <4 x float> [[R]]
5454;
5555 %e = extractelement <2 x float > %x , i32 2
@@ -73,17 +73,11 @@ define <2 x double> @ext1_v2f64(<2 x double> %x, <2 x double> %y) {
7373}
7474
7575define <4 x double > @ext1_v2f64v4f64 (<2 x double > %x , <4 x double > %y ) {
76- ; SSE-LABEL: @ext1_v2f64v4f64(
77- ; SSE-NEXT: [[E:%.*]] = extractelement <2 x double> [[X:%.*]], i32 1
78- ; SSE-NEXT: [[N:%.*]] = fneg nsz double [[E]]
79- ; SSE-NEXT: [[R:%.*]] = insertelement <4 x double> [[Y:%.*]], double [[N]], i32 1
80- ; SSE-NEXT: ret <4 x double> [[R]]
81- ;
82- ; AVX-LABEL: @ext1_v2f64v4f64(
83- ; AVX-NEXT: [[TMP1:%.*]] = fneg nsz <2 x double> [[X:%.*]]
84- ; AVX-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[TMP1]], <2 x double> poison, <4 x i32> <i32 poison, i32 1, i32 poison, i32 poison>
85- ; AVX-NEXT: [[R:%.*]] = shufflevector <4 x double> [[Y:%.*]], <4 x double> [[TMP2]], <4 x i32> <i32 0, i32 5, i32 2, i32 3>
86- ; AVX-NEXT: ret <4 x double> [[R]]
76+ ; CHECK-LABEL: @ext1_v2f64v4f64(
77+ ; CHECK-NEXT: [[TMP1:%.*]] = fneg nsz <2 x double> [[X:%.*]]
78+ ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[TMP1]], <2 x double> poison, <4 x i32> <i32 poison, i32 1, i32 poison, i32 poison>
79+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x double> [[Y:%.*]], <4 x double> [[TMP2]], <4 x i32> <i32 0, i32 5, i32 2, i32 3>
80+ ; CHECK-NEXT: ret <4 x double> [[R]]
8781;
8882 %e = extractelement <2 x double > %x , i32 1
8983 %n = fneg nsz double %e
@@ -105,9 +99,9 @@ define <8 x float> @ext7_v8f32(<8 x float> %x, <8 x float> %y) {
10599
106100define <8 x float > @ext7_v4f32v8f32 (<4 x float > %x , <8 x float > %y ) {
107101; CHECK-LABEL: @ext7_v4f32v8f32(
108- ; CHECK-NEXT: [[E :%.*]] = extractelement <4 x float> [[X:%.*]], i32 3
109- ; CHECK-NEXT: [[N :%.*]] = fneg float [[E]]
110- ; CHECK-NEXT: [[R:%.*]] = insertelement <8 x float> [[Y:%.*]], float [[N ]], i32 7
102+ ; CHECK-NEXT: [[TMP1 :%.*]] = fneg <4 x float> [[X:%.*]]
103+ ; CHECK-NEXT: [[TMP2 :%.*]] = shufflevector <4 x float> [[TMP1]], <4 x float> poison, <8 x i32> <i32 poison, i32 poison, i32 poison, i32 3, i32 poison, i32 poison, i32 poison, i32 poison>
104+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <8 x float> [[Y:%.*]], <8 x float> [[TMP2 ]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 11>
111105; CHECK-NEXT: ret <8 x float> [[R]]
112106;
113107 %e = extractelement <4 x float > %x , i32 3
@@ -141,12 +135,20 @@ define <8 x float> @ext7_v8f32_use1(<8 x float> %x, <8 x float> %y) {
141135}
142136
143137define <8 x float > @ext7_v4f32v8f32_use1 (<4 x float > %x , <8 x float > %y ) {
144- ; CHECK-LABEL: @ext7_v4f32v8f32_use1(
145- ; CHECK-NEXT: [[E:%.*]] = extractelement <4 x float> [[X:%.*]], i32 3
146- ; CHECK-NEXT: call void @use(float [[E]])
147- ; CHECK-NEXT: [[N:%.*]] = fneg float [[E]]
148- ; CHECK-NEXT: [[R:%.*]] = insertelement <8 x float> [[Y:%.*]], float [[N]], i32 3
149- ; CHECK-NEXT: ret <8 x float> [[R]]
138+ ; SSE-LABEL: @ext7_v4f32v8f32_use1(
139+ ; SSE-NEXT: [[E:%.*]] = extractelement <4 x float> [[X:%.*]], i32 3
140+ ; SSE-NEXT: call void @use(float [[E]])
141+ ; SSE-NEXT: [[TMP1:%.*]] = fneg <4 x float> [[X]]
142+ ; SSE-NEXT: [[TMP2:%.*]] = shufflevector <4 x float> [[TMP1]], <4 x float> poison, <8 x i32> <i32 poison, i32 poison, i32 poison, i32 3, i32 poison, i32 poison, i32 poison, i32 poison>
143+ ; SSE-NEXT: [[R:%.*]] = shufflevector <8 x float> [[Y:%.*]], <8 x float> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 11, i32 4, i32 5, i32 6, i32 7>
144+ ; SSE-NEXT: ret <8 x float> [[R]]
145+ ;
146+ ; AVX-LABEL: @ext7_v4f32v8f32_use1(
147+ ; AVX-NEXT: [[E:%.*]] = extractelement <4 x float> [[X:%.*]], i32 3
148+ ; AVX-NEXT: call void @use(float [[E]])
149+ ; AVX-NEXT: [[N:%.*]] = fneg float [[E]]
150+ ; AVX-NEXT: [[R:%.*]] = insertelement <8 x float> [[Y:%.*]], float [[N]], i32 3
151+ ; AVX-NEXT: ret <8 x float> [[R]]
150152;
151153 %e = extractelement <4 x float > %x , i32 3
152154 call void @use (float %e )
@@ -220,9 +222,8 @@ define <4 x double> @ext_index_var_v2f64v4f64(<2 x double> %x, <4 x double> %y,
220222
221223define <2 x double > @ext1_v2f64_ins0 (<2 x double > %x , <2 x double > %y ) {
222224; CHECK-LABEL: @ext1_v2f64_ins0(
223- ; CHECK-NEXT: [[E:%.*]] = extractelement <2 x double> [[X:%.*]], i32 1
224- ; CHECK-NEXT: [[N:%.*]] = fneg nsz double [[E]]
225- ; CHECK-NEXT: [[R:%.*]] = insertelement <2 x double> [[Y:%.*]], double [[N]], i32 0
225+ ; CHECK-NEXT: [[TMP1:%.*]] = fneg nsz <2 x double> [[X:%.*]]
226+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x double> [[Y:%.*]], <2 x double> [[TMP1]], <2 x i32> <i32 3, i32 1>
226227; CHECK-NEXT: ret <2 x double> [[R]]
227228;
228229 %e = extractelement <2 x double > %x , i32 1
@@ -234,9 +235,9 @@ define <2 x double> @ext1_v2f64_ins0(<2 x double> %x, <2 x double> %y) {
234235; Negative test - extract from an index greater than the vector width of the destination
235236define <2 x double > @ext3_v4f64v2f64 (<4 x double > %x , <2 x double > %y ) {
236237; CHECK-LABEL: @ext3_v4f64v2f64(
237- ; CHECK-NEXT: [[E :%.*]] = extractelement <4 x double> [[X:%.*]], i32 3
238- ; CHECK-NEXT: [[N :%.*]] = fneg nsz double [[E]]
239- ; CHECK-NEXT: [[R:%.*]] = insertelement <2 x double> [[Y:%.*]], double [[N ]], i32 1
238+ ; CHECK-NEXT: [[TMP1 :%.*]] = fneg nsz <4 x double> [[X:%.*]]
239+ ; CHECK-NEXT: [[TMP2 :%.*]] = shufflevector <4 x double> [[TMP1]], <4 x double> poison, <2 x i32> <i32 poison, i32 3>
240+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x double> [[Y:%.*]], <2 x double> [[TMP2 ]], <2 x i32> <i32 0, i32 3>
240241; CHECK-NEXT: ret <2 x double> [[R]]
241242;
242243 %e = extractelement <4 x double > %x , i32 3
@@ -246,11 +247,17 @@ define <2 x double> @ext3_v4f64v2f64(<4 x double> %x, <2 x double> %y) {
246247}
247248
248249define <4 x double > @ext1_v2f64v4f64_ins0 (<2 x double > %x , <4 x double > %y ) {
249- ; CHECK-LABEL: @ext1_v2f64v4f64_ins0(
250- ; CHECK-NEXT: [[E:%.*]] = extractelement <2 x double> [[X:%.*]], i32 1
251- ; CHECK-NEXT: [[N:%.*]] = fneg nsz double [[E]]
252- ; CHECK-NEXT: [[R:%.*]] = insertelement <4 x double> [[Y:%.*]], double [[N]], i32 0
253- ; CHECK-NEXT: ret <4 x double> [[R]]
250+ ; SSE-LABEL: @ext1_v2f64v4f64_ins0(
251+ ; SSE-NEXT: [[TMP1:%.*]] = fneg nsz <2 x double> [[X:%.*]]
252+ ; SSE-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[TMP1]], <2 x double> poison, <4 x i32> <i32 poison, i32 1, i32 poison, i32 poison>
253+ ; SSE-NEXT: [[R:%.*]] = shufflevector <4 x double> [[Y:%.*]], <4 x double> [[TMP2]], <4 x i32> <i32 5, i32 1, i32 2, i32 3>
254+ ; SSE-NEXT: ret <4 x double> [[R]]
255+ ;
256+ ; AVX-LABEL: @ext1_v2f64v4f64_ins0(
257+ ; AVX-NEXT: [[E:%.*]] = extractelement <2 x double> [[X:%.*]], i32 1
258+ ; AVX-NEXT: [[N:%.*]] = fneg nsz double [[E]]
259+ ; AVX-NEXT: [[R:%.*]] = insertelement <4 x double> [[Y:%.*]], double [[N]], i32 0
260+ ; AVX-NEXT: ret <4 x double> [[R]]
254261;
255262 %e = extractelement <2 x double > %x , i32 1
256263 %n = fneg nsz double %e
0 commit comments