llvm.org GIT mirror llvm / testing test / CodeGen / X86 / insert-into-constant-vector.ll
testing

Tree @testing (Download .tar.gz)

insert-into-constant-vector.ll @testingraw · history · blame

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-unknown-unknown   -mattr=+sse2     | FileCheck %s --check-prefix=X32SSE --check-prefix=X32SSE2
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2     | FileCheck %s --check-prefix=X64SSE --check-prefix=X64SSE2
; RUN: llc < %s -mtriple=i686-unknown-unknown   -mattr=+sse4.1   | FileCheck %s --check-prefix=X32SSE --check-prefix=X32SSE4
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1   | FileCheck %s --check-prefix=X64SSE --check-prefix=X64SSE4
; RUN: llc < %s -mtriple=i686-unknown-unknown   -mattr=+avx2     | FileCheck %s --check-prefix=X32AVX --check-prefix=X32AVX2
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2     | FileCheck %s --check-prefix=X64AVX --check-prefix=X64AVX2
; RUN: llc < %s -mtriple=i686-unknown-unknown   -mattr=+avx512f  | FileCheck %s --check-prefix=X32AVX --check-prefix=X32AVX512F
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f  | FileCheck %s --check-prefix=X64AVX --check-prefix=X64AVX512F

define <16 x i8> @elt0_v16i8(i8 %x) {
; X32SSE2-LABEL: elt0_v16i8:
; X32SSE2:       # BB#0:
; X32SSE2-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
; X32SSE2-NEXT:    movaps {{.*#+}} xmm0 = [0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]
; X32SSE2-NEXT:    andnps %xmm1, %xmm0
; X32SSE2-NEXT:    orps {{\.LCPI.*}}, %xmm0
; X32SSE2-NEXT:    retl
;
; X64SSE2-LABEL: elt0_v16i8:
; X64SSE2:       # BB#0:
; X64SSE2-NEXT:    movd %edi, %xmm1
; X64SSE2-NEXT:    movdqa {{.*#+}} xmm0 = [0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]
; X64SSE2-NEXT:    pandn %xmm1, %xmm0
; X64SSE2-NEXT:    por {{.*}}(%rip), %xmm0
; X64SSE2-NEXT:    retq
;
; X32SSE4-LABEL: elt0_v16i8:
; X32SSE4:       # BB#0:
; X32SSE4-NEXT:    movdqa {{.*#+}} xmm0 = <u,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15>
; X32SSE4-NEXT:    pinsrb $0, {{[0-9]+}}(%esp), %xmm0
; X32SSE4-NEXT:    retl
;
; X64SSE4-LABEL: elt0_v16i8:
; X64SSE4:       # BB#0:
; X64SSE4-NEXT:    movdqa {{.*#+}} xmm0 = <u,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15>
; X64SSE4-NEXT:    pinsrb $0, %edi, %xmm0
; X64SSE4-NEXT:    retq
;
; X32AVX-LABEL: elt0_v16i8:
; X32AVX:       # BB#0:
; X32AVX-NEXT:    vmovdqa {{.*#+}} xmm0 = <u,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15>
; X32AVX-NEXT:    vpinsrb $0, {{[0-9]+}}(%esp), %xmm0, %xmm0
; X32AVX-NEXT:    retl
;
; X64AVX-LABEL: elt0_v16i8:
; X64AVX:       # BB#0:
; X64AVX-NEXT:    vmovdqa {{.*#+}} xmm0 = <u,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15>
; X64AVX-NEXT:    vpinsrb $0, %edi, %xmm0, %xmm0
; X64AVX-NEXT:    retq
   %ins = insertelement <16 x i8> <i8 42, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, i8 %x, i32 0
   ret <16 x i8> %ins
}

define <8 x i16> @elt5_v8i16(i16 %x) {
; X32SSE-LABEL: elt5_v8i16:
; X32SSE:       # BB#0:
; X32SSE-NEXT:    movdqa {{.*#+}} xmm0 = <42,1,2,3,4,u,6,7>
; X32SSE-NEXT:    pinsrw $5, {{[0-9]+}}(%esp), %xmm0
; X32SSE-NEXT:    retl
;
; X64SSE-LABEL: elt5_v8i16:
; X64SSE:       # BB#0:
; X64SSE-NEXT:    movdqa {{.*#+}} xmm0 = <42,1,2,3,4,u,6,7>
; X64SSE-NEXT:    pinsrw $5, %edi, %xmm0
; X64SSE-NEXT:    retq
;
; X32AVX-LABEL: elt5_v8i16:
; X32AVX:       # BB#0:
; X32AVX-NEXT:    vmovdqa {{.*#+}} xmm0 = <42,1,2,3,4,u,6,7>
; X32AVX-NEXT:    vpinsrw $5, {{[0-9]+}}(%esp), %xmm0, %xmm0
; X32AVX-NEXT:    retl
;
; X64AVX-LABEL: elt5_v8i16:
; X64AVX:       # BB#0:
; X64AVX-NEXT:    vmovdqa {{.*#+}} xmm0 = <42,1,2,3,4,u,6,7>
; X64AVX-NEXT:    vpinsrw $5, %edi, %xmm0, %xmm0
; X64AVX-NEXT:    retq
   %ins = insertelement <8 x i16> <i16 42, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>, i16 %x, i32 5
   ret <8 x i16> %ins
}

define <4 x i32> @elt3_v4i32(i32 %x) {
; X32SSE2-LABEL: elt3_v4i32:
; X32SSE2:       # BB#0:
; X32SSE2-NEXT:    movaps {{.*#+}} xmm0 = <42,1,2,u>
; X32SSE2-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
; X32SSE2-NEXT:    shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
; X32SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,0]
; X32SSE2-NEXT:    retl
;
; X64SSE2-LABEL: elt3_v4i32:
; X64SSE2:       # BB#0:
; X64SSE2-NEXT:    movd %edi, %xmm1
; X64SSE2-NEXT:    movaps {{.*#+}} xmm0 = <42,1,2,u>
; X64SSE2-NEXT:    shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
; X64SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,0]
; X64SSE2-NEXT:    retq
;
; X32SSE4-LABEL: elt3_v4i32:
; X32SSE4:       # BB#0:
; X32SSE4-NEXT:    movdqa {{.*#+}} xmm0 = <42,1,2,u>
; X32SSE4-NEXT:    pinsrd $3, {{[0-9]+}}(%esp), %xmm0
; X32SSE4-NEXT:    retl
;
; X64SSE4-LABEL: elt3_v4i32:
; X64SSE4:       # BB#0:
; X64SSE4-NEXT:    movdqa {{.*#+}} xmm0 = <42,1,2,u>
; X64SSE4-NEXT:    pinsrd $3, %edi, %xmm0
; X64SSE4-NEXT:    retq
;
; X32AVX-LABEL: elt3_v4i32:
; X32AVX:       # BB#0:
; X32AVX-NEXT:    vmovdqa {{.*#+}} xmm0 = <42,1,2,u>
; X32AVX-NEXT:    vpinsrd $3, {{[0-9]+}}(%esp), %xmm0, %xmm0
; X32AVX-NEXT:    retl
;
; X64AVX-LABEL: elt3_v4i32:
; X64AVX:       # BB#0:
; X64AVX-NEXT:    vmovdqa {{.*#+}} xmm0 = <42,1,2,u>
; X64AVX-NEXT:    vpinsrd $3, %edi, %xmm0, %xmm0
; X64AVX-NEXT:    retq
   %ins = insertelement <4 x i32> <i32 42, i32 1, i32 2, i32 3>, i32 %x, i32 3
   ret <4 x i32> %ins
}

define <2 x i64> @elt0_v2i64(i64 %x) {
; X32SSE-LABEL: elt0_v2i64:
; X32SSE:       # BB#0:
; X32SSE-NEXT:    movl $1, %eax
; X32SSE-NEXT:    movd %eax, %xmm1
; X32SSE-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero
; X32SSE-NEXT:    punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
; X32SSE-NEXT:    retl
;
; X64SSE2-LABEL: elt0_v2i64:
; X64SSE2:       # BB#0:
; X64SSE2-NEXT:    movq %rdi, %xmm1
; X64SSE2-NEXT:    movapd {{.*#+}} xmm0 = <u,1>
; X64SSE2-NEXT:    movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
; X64SSE2-NEXT:    retq
;
; X64SSE4-LABEL: elt0_v2i64:
; X64SSE4:       # BB#0:
; X64SSE4-NEXT:    movdqa {{.*#+}} xmm0 = <u,1>
; X64SSE4-NEXT:    pinsrq $0, %rdi, %xmm0
; X64SSE4-NEXT:    retq
;
; X32AVX-LABEL: elt0_v2i64:
; X32AVX:       # BB#0:
; X32AVX-NEXT:    movl $1, %eax
; X32AVX-NEXT:    vmovd %eax, %xmm0
; X32AVX-NEXT:    vmovq {{.*#+}} xmm1 = mem[0],zero
; X32AVX-NEXT:    vpunpcklqdq {{.*#+}} xmm0 = xmm1[0],xmm0[0]
; X32AVX-NEXT:    retl
;
; X64AVX-LABEL: elt0_v2i64:
; X64AVX:       # BB#0:
; X64AVX-NEXT:    vmovdqa {{.*#+}} xmm0 = <u,1>
; X64AVX-NEXT:    vpinsrq $0, %rdi, %xmm0, %xmm0
; X64AVX-NEXT:    retq
   %ins = insertelement <2 x i64> <i64 42, i64 1>, i64 %x, i32 0
   ret <2 x i64> %ins
}

define <4 x float> @elt1_v4f32(float %x) {
; X32SSE2-LABEL: elt1_v4f32:
; X32SSE2:       # BB#0:
; X32SSE2-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; X32SSE2-NEXT:    movaps {{.*#+}} xmm1 = <42,u,2,3>
; X32SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[0,0]
; X32SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
; X32SSE2-NEXT:    retl
;
; X64SSE2-LABEL: elt1_v4f32:
; X64SSE2:       # BB#0:
; X64SSE2-NEXT:    movaps {{.*#+}} xmm1 = <42,u,2,3>
; X64SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[0,0]
; X64SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
; X64SSE2-NEXT:    retq
;
; X32SSE4-LABEL: elt1_v4f32:
; X32SSE4:       # BB#0:
; X32SSE4-NEXT:    movaps {{.*#+}} xmm0 = <42,u,2,3>
; X32SSE4-NEXT:    insertps {{.*#+}} xmm0 = xmm0[0],mem[0],xmm0[2,3]
; X32SSE4-NEXT:    retl
;
; X64SSE4-LABEL: elt1_v4f32:
; X64SSE4:       # BB#0:
; X64SSE4-NEXT:    movaps {{.*#+}} xmm1 = <42,u,2,3>
; X64SSE4-NEXT:    insertps {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[2,3]
; X64SSE4-NEXT:    movaps %xmm1, %xmm0
; X64SSE4-NEXT:    retq
;
; X32AVX-LABEL: elt1_v4f32:
; X32AVX:       # BB#0:
; X32AVX-NEXT:    vmovaps {{.*#+}} xmm0 = <42,u,2,3>
; X32AVX-NEXT:    vinsertps {{.*#+}} xmm0 = xmm0[0],mem[0],xmm0[2,3]
; X32AVX-NEXT:    retl
;
; X64AVX-LABEL: elt1_v4f32:
; X64AVX:       # BB#0:
; X64AVX-NEXT:    vmovaps {{.*#+}} xmm1 = <42,u,2,3>
; X64AVX-NEXT:    vinsertps {{.*#+}} xmm0 = xmm1[0],xmm0[0],xmm1[2,3]
; X64AVX-NEXT:    retq
   %ins = insertelement <4 x float> <float 42.0, float 1.0, float 2.0, float 3.0>, float %x, i32 1
   ret <4 x float> %ins
}

define <2 x double> @elt1_v2f64(double %x) {
; X32SSE-LABEL: elt1_v2f64:
; X32SSE:       # BB#0:
; X32SSE-NEXT:    movapd {{.*#+}} xmm0 = <42,u>
; X32SSE-NEXT:    movhpd {{.*#+}} xmm0 = xmm0[0],mem[0]
; X32SSE-NEXT:    retl
;
; X64SSE-LABEL: elt1_v2f64:
; X64SSE:       # BB#0:
; X64SSE-NEXT:    movaps {{.*#+}} xmm1 = <42,u>
; X64SSE-NEXT:    movlhps {{.*#+}} xmm1 = xmm1[0],xmm0[0]
; X64SSE-NEXT:    movaps %xmm1, %xmm0
; X64SSE-NEXT:    retq
;
; X32AVX-LABEL: elt1_v2f64:
; X32AVX:       # BB#0:
; X32AVX-NEXT:    vmovapd {{.*#+}} xmm0 = <42,u>
; X32AVX-NEXT:    vmovhpd {{.*#+}} xmm0 = xmm0[0],mem[0]
; X32AVX-NEXT:    retl
;
; X64AVX-LABEL: elt1_v2f64:
; X64AVX:       # BB#0:
; X64AVX-NEXT:    vmovaps {{.*#+}} xmm1 = <42,u>
; X64AVX-NEXT:    vmovlhps {{.*#+}} xmm0 = xmm1[0],xmm0[0]
; X64AVX-NEXT:    retq
   %ins = insertelement <2 x double> <double 42.0, double 1.0>, double %x, i32 1
   ret <2 x double> %ins
}

define <8 x i32> @elt7_v8i32(i32 %x) {
; X32SSE2-LABEL: elt7_v8i32:
; X32SSE2:       # BB#0:
; X32SSE2-NEXT:    movaps {{.*#+}} xmm1 = <4,5,6,u>
; X32SSE2-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; X32SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[2,0]
; X32SSE2-NEXT:    shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
; X32SSE2-NEXT:    movaps {{.*#+}} xmm0 = [42,1,2,3]
; X32SSE2-NEXT:    retl
;
; X64SSE2-LABEL: elt7_v8i32:
; X64SSE2:       # BB#0:
; X64SSE2-NEXT:    movd %edi, %xmm0
; X64SSE2-NEXT:    movaps {{.*#+}} xmm1 = <4,5,6,u>
; X64SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[2,0]
; X64SSE2-NEXT:    shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
; X64SSE2-NEXT:    movaps {{.*#+}} xmm0 = [42,1,2,3]
; X64SSE2-NEXT:    retq
;
; X32SSE4-LABEL: elt7_v8i32:
; X32SSE4:       # BB#0:
; X32SSE4-NEXT:    movdqa {{.*#+}} xmm1 = <4,5,6,u>
; X32SSE4-NEXT:    pinsrd $3, {{[0-9]+}}(%esp), %xmm1
; X32SSE4-NEXT:    movaps {{.*#+}} xmm0 = [42,1,2,3]
; X32SSE4-NEXT:    retl
;
; X64SSE4-LABEL: elt7_v8i32:
; X64SSE4:       # BB#0:
; X64SSE4-NEXT:    movdqa {{.*#+}} xmm1 = <4,5,6,u>
; X64SSE4-NEXT:    pinsrd $3, %edi, %xmm1
; X64SSE4-NEXT:    movaps {{.*#+}} xmm0 = [42,1,2,3]
; X64SSE4-NEXT:    retq
;
; X32AVX-LABEL: elt7_v8i32:
; X32AVX:       # BB#0:
; X32AVX-NEXT:    vmovdqa {{.*#+}} ymm0 = <42,1,2,3,4,5,6,u>
; X32AVX-NEXT:    vextracti128 $1, %ymm0, %xmm1
; X32AVX-NEXT:    vpinsrd $3, {{[0-9]+}}(%esp), %xmm1, %xmm1
; X32AVX-NEXT:    vinserti128 $1, %xmm1, %ymm0, %ymm0
; X32AVX-NEXT:    retl
;
; X64AVX-LABEL: elt7_v8i32:
; X64AVX:       # BB#0:
; X64AVX-NEXT:    vmovdqa {{.*#+}} ymm0 = <42,1,2,3,4,5,6,u>
; X64AVX-NEXT:    vextracti128 $1, %ymm0, %xmm1
; X64AVX-NEXT:    vpinsrd $3, %edi, %xmm1, %xmm1
; X64AVX-NEXT:    vinserti128 $1, %xmm1, %ymm0, %ymm0
; X64AVX-NEXT:    retq
   %ins = insertelement <8 x i32> <i32 42, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>, i32 %x, i32 7
   ret <8 x i32> %ins
}

define <8 x float> @elt6_v8f32(float %x) {
; X32SSE2-LABEL: elt6_v8f32:
; X32SSE2:       # BB#0:
; X32SSE2-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; X32SSE2-NEXT:    movaps {{.*#+}} xmm1 = <4,5,u,7>
; X32SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[3,0]
; X32SSE2-NEXT:    shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[0,2]
; X32SSE2-NEXT:    movaps {{.*#+}} xmm0 = [4.200000e+01,1.000000e+00,2.000000e+00,3.000000e+00]
; X32SSE2-NEXT:    retl
;
; X64SSE2-LABEL: elt6_v8f32:
; X64SSE2:       # BB#0:
; X64SSE2-NEXT:    movaps {{.*#+}} xmm1 = <4,5,u,7>
; X64SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[3,0]
; X64SSE2-NEXT:    shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[0,2]
; X64SSE2-NEXT:    movaps {{.*#+}} xmm0 = [4.200000e+01,1.000000e+00,2.000000e+00,3.000000e+00]
; X64SSE2-NEXT:    retq
;
; X32SSE4-LABEL: elt6_v8f32:
; X32SSE4:       # BB#0:
; X32SSE4-NEXT:    movaps {{.*#+}} xmm1 = <4,5,u,7>
; X32SSE4-NEXT:    insertps {{.*#+}} xmm1 = xmm1[0,1],mem[0],xmm1[3]
; X32SSE4-NEXT:    movaps {{.*#+}} xmm0 = [4.200000e+01,1.000000e+00,2.000000e+00,3.000000e+00]
; X32SSE4-NEXT:    retl
;
; X64SSE4-LABEL: elt6_v8f32:
; X64SSE4:       # BB#0:
; X64SSE4-NEXT:    movaps {{.*#+}} xmm1 = <4,5,u,7>
; X64SSE4-NEXT:    insertps {{.*#+}} xmm1 = xmm1[0,1],xmm0[0],xmm1[3]
; X64SSE4-NEXT:    movaps {{.*#+}} xmm0 = [4.200000e+01,1.000000e+00,2.000000e+00,3.000000e+00]
; X64SSE4-NEXT:    retq
;
; X32AVX-LABEL: elt6_v8f32:
; X32AVX:       # BB#0:
; X32AVX-NEXT:    vmovaps {{.*#+}} ymm0 = <42,1,2,3,4,5,u,7>
; X32AVX-NEXT:    vextractf128 $1, %ymm0, %xmm1
; X32AVX-NEXT:    vinsertps {{.*#+}} xmm1 = xmm1[0,1],mem[0],xmm1[3]
; X32AVX-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
; X32AVX-NEXT:    retl
;
; X64AVX-LABEL: elt6_v8f32:
; X64AVX:       # BB#0:
; X64AVX-NEXT:    vmovaps {{.*#+}} ymm1 = <42,1,2,3,4,5,u,7>
; X64AVX-NEXT:    vextractf128 $1, %ymm1, %xmm2
; X64AVX-NEXT:    vinsertps {{.*#+}} xmm0 = xmm2[0,1],xmm0[0],xmm2[3]
; X64AVX-NEXT:    vinsertf128 $1, %xmm0, %ymm1, %ymm0
; X64AVX-NEXT:    retq
   %ins = insertelement <8 x float> <float 42.0, float 1.0, float 2.0, float 3.0, float 4.0, float 5.0, float 6.0, float 7.0>, float %x, i32 6
   ret <8 x float> %ins
}

define <8 x i64> @elt5_v8i64(i64 %x) {
; X32SSE-LABEL: elt5_v8i64:
; X32SSE:       # BB#0:
; X32SSE-NEXT:    movl $4, %eax
; X32SSE-NEXT:    movd %eax, %xmm2
; X32SSE-NEXT:    movq {{.*#+}} xmm0 = mem[0],zero
; X32SSE-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm0[0]
; X32SSE-NEXT:    movaps {{.*#+}} xmm0 = [42,0,1,0]
; X32SSE-NEXT:    movaps {{.*#+}} xmm1 = [2,0,3,0]
; X32SSE-NEXT:    movaps {{.*#+}} xmm3 = [6,0,7,0]
; X32SSE-NEXT:    retl
;
; X64SSE2-LABEL: elt5_v8i64:
; X64SSE2:       # BB#0:
; X64SSE2-NEXT:    movq %rdi, %xmm0
; X64SSE2-NEXT:    movdqa {{.*#+}} xmm2 = <4,u>
; X64SSE2-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm0[0]
; X64SSE2-NEXT:    movaps {{.*#+}} xmm0 = [42,1]
; X64SSE2-NEXT:    movaps {{.*#+}} xmm1 = [2,3]
; X64SSE2-NEXT:    movaps {{.*#+}} xmm3 = [6,7]
; X64SSE2-NEXT:    retq
;
; X64SSE4-LABEL: elt5_v8i64:
; X64SSE4:       # BB#0:
; X64SSE4-NEXT:    movdqa {{.*#+}} xmm2 = <4,u>
; X64SSE4-NEXT:    pinsrq $1, %rdi, %xmm2
; X64SSE4-NEXT:    movaps {{.*#+}} xmm0 = [42,1]
; X64SSE4-NEXT:    movaps {{.*#+}} xmm1 = [2,3]
; X64SSE4-NEXT:    movaps {{.*#+}} xmm3 = [6,7]
; X64SSE4-NEXT:    retq
;
; X32AVX2-LABEL: elt5_v8i64:
; X32AVX2:       # BB#0:
; X32AVX2-NEXT:    movl $4, %eax
; X32AVX2-NEXT:    vmovd %eax, %xmm0
; X32AVX2-NEXT:    vmovq {{.*#+}} xmm1 = mem[0],zero
; X32AVX2-NEXT:    vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
; X32AVX2-NEXT:    vinserti128 $1, {{\.LCPI.*}}, %ymm0, %ymm1
; X32AVX2-NEXT:    vmovaps {{.*#+}} ymm0 = [42,0,1,0,2,0,3,0]
; X32AVX2-NEXT:    retl
;
; X64AVX2-LABEL: elt5_v8i64:
; X64AVX2:       # BB#0:
; X64AVX2-NEXT:    vmovdqa {{.*#+}} ymm0 = <4,u,6,7>
; X64AVX2-NEXT:    vpinsrq $1, %rdi, %xmm0, %xmm1
; X64AVX2-NEXT:    vpblendd {{.*#+}} ymm1 = ymm1[0,1,2,3],ymm0[4,5,6,7]
; X64AVX2-NEXT:    vmovaps {{.*#+}} ymm0 = [42,1,2,3]
; X64AVX2-NEXT:    retq
;
; X32AVX512F-LABEL: elt5_v8i64:
; X32AVX512F:       # BB#0:
; X32AVX512F-NEXT:    vmovdqa {{.*#+}} ymm0 = [42,0,1,0,2,0,3,0]
; X32AVX512F-NEXT:    movl $4, %eax
; X32AVX512F-NEXT:    vmovd %eax, %xmm1
; X32AVX512F-NEXT:    vmovq {{.*#+}} xmm2 = mem[0],zero
; X32AVX512F-NEXT:    vpunpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm2[0]
; X32AVX512F-NEXT:    vinserti128 $1, {{\.LCPI.*}}, %ymm1, %ymm1
; X32AVX512F-NEXT:    vinserti64x4 $1, %ymm1, %zmm0, %zmm0
; X32AVX512F-NEXT:    retl
;
; X64AVX512F-LABEL: elt5_v8i64:
; X64AVX512F:       # BB#0:
; X64AVX512F-NEXT:    vmovdqa64 {{.*#+}} zmm0 = <42,1,2,3,4,u,6,7>
; X64AVX512F-NEXT:    vextracti32x4 $2, %zmm0, %xmm1
; X64AVX512F-NEXT:    vpinsrq $1, %rdi, %xmm1, %xmm1
; X64AVX512F-NEXT:    vinserti32x4 $2, %xmm1, %zmm0, %zmm0
; X64AVX512F-NEXT:    retq
   %ins = insertelement <8 x i64> <i64 42, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7>, i64 %x, i32 5
   ret <8 x i64> %ins
}

define <8 x double> @elt1_v8f64(double %x) {
; X32SSE-LABEL: elt1_v8f64:
; X32SSE:       # BB#0:
; X32SSE-NEXT:    movapd {{.*#+}} xmm0 = <42,u>
; X32SSE-NEXT:    movhpd {{.*#+}} xmm0 = xmm0[0],mem[0]
; X32SSE-NEXT:    movaps {{.*#+}} xmm1 = [2.000000e+00,3.000000e+00]
; X32SSE-NEXT:    movaps {{.*#+}} xmm2 = [4.000000e+00,5.000000e+00]
; X32SSE-NEXT:    movaps {{.*#+}} xmm3 = [6.000000e+00,7.000000e+00]
; X32SSE-NEXT:    retl
;
; X64SSE-LABEL: elt1_v8f64:
; X64SSE:       # BB#0:
; X64SSE-NEXT:    movaps {{.*#+}} xmm4 = <42,u>
; X64SSE-NEXT:    movlhps {{.*#+}} xmm4 = xmm4[0],xmm0[0]
; X64SSE-NEXT:    movaps {{.*#+}} xmm1 = [2.000000e+00,3.000000e+00]
; X64SSE-NEXT:    movaps {{.*#+}} xmm2 = [4.000000e+00,5.000000e+00]
; X64SSE-NEXT:    movaps {{.*#+}} xmm3 = [6.000000e+00,7.000000e+00]
; X64SSE-NEXT:    movaps %xmm4, %xmm0
; X64SSE-NEXT:    retq
;
; X32AVX2-LABEL: elt1_v8f64:
; X32AVX2:       # BB#0:
; X32AVX2-NEXT:    vmovapd {{.*#+}} ymm0 = <42,u,2,3>
; X32AVX2-NEXT:    vmovhpd {{.*#+}} xmm1 = xmm0[0],mem[0]
; X32AVX2-NEXT:    vblendpd {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3]
; X32AVX2-NEXT:    vmovaps {{.*#+}} ymm1 = [4.000000e+00,5.000000e+00,6.000000e+00,7.000000e+00]
; X32AVX2-NEXT:    retl
;
; X64AVX2-LABEL: elt1_v8f64:
; X64AVX2:       # BB#0:
; X64AVX2-NEXT:    vmovapd {{.*#+}} ymm1 = <42,u,2,3>
; X64AVX2-NEXT:    vunpcklpd {{.*#+}} xmm0 = xmm1[0],xmm0[0]
; X64AVX2-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3]
; X64AVX2-NEXT:    vmovaps {{.*#+}} ymm1 = [4.000000e+00,5.000000e+00,6.000000e+00,7.000000e+00]
; X64AVX2-NEXT:    retq
;
; X32AVX512F-LABEL: elt1_v8f64:
; X32AVX512F:       # BB#0:
; X32AVX512F-NEXT:    vmovapd {{.*#+}} zmm0 = <42,u,2,3,4,5,6,7>
; X32AVX512F-NEXT:    vmovhpd {{.*#+}} xmm1 = xmm0[0],mem[0]
; X32AVX512F-NEXT:    vinsertf32x4 $0, %xmm1, %zmm0, %zmm0
; X32AVX512F-NEXT:    retl
;
; X64AVX512F-LABEL: elt1_v8f64:
; X64AVX512F:       # BB#0:
; X64AVX512F-NEXT:    vmovaps {{.*#+}} zmm1 = <42,u,2,3,4,5,6,7>
; X64AVX512F-NEXT:    vmovlhps {{.*#+}} xmm0 = xmm1[0],xmm0[0]
; X64AVX512F-NEXT:    vinsertf32x4 $0, %xmm0, %zmm1, %zmm0
; X64AVX512F-NEXT:    retq
   %ins = insertelement <8 x double> <double 42.0, double 1.0, double 2.0, double 3.0, double 4.0, double 5.0, double 6.0, double 7.0>, double %x, i32 1
   ret <8 x double> %ins
}