1; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s
2
3define <16 x i32> @test1(i32* %x) {
4; CHECK-LABEL: test1:
5; CHECK:       ## BB#0:
6; CHECK-NEXT:    vmovd (%rdi), %xmm0
7; CHECK-NEXT:    vinserti128 $1, %xmm0, %ymm0, %ymm0
8; CHECK-NEXT:    vpxor %ymm1, %ymm1, %ymm1
9; CHECK-NEXT:    vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4],ymm1[5,6,7]
10; CHECK-NEXT:    vinserti64x4 $1, %ymm1, %zmm0, %zmm0
11; CHECK-NEXT:    retq
12   %y = load i32, i32* %x, align 4
13   %res = insertelement <16 x i32>zeroinitializer, i32 %y, i32 4
14   ret <16 x i32>%res
15}
16
17define <16 x i32> @test2(<16 x i32> %x) {
18; CHECK-LABEL: test2:
19; CHECK:       ## BB#0:
20; CHECK-NEXT:    vpaddd {{.*}}(%rip){1to16}, %zmm0, %zmm0
21; CHECK-NEXT:    retq
22   %res = add <16 x i32><i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>, %x
23   ret <16 x i32>%res
24}
25
26define <16 x float> @test3(<4 x float> %a) {
27; CHECK-LABEL: test3:
28; CHECK:       ## BB#0:
29; CHECK-NEXT:    vpermilpd {{.*#+}} xmm1 = xmm0[1,0]
30; CHECK-NEXT:    vxorps %xmm2, %xmm2, %xmm2
31; CHECK-NEXT:    vmovss %xmm0, %xmm2, %xmm0
32; CHECK-NEXT:    vmovss %xmm1, %xmm2, %xmm1
33; CHECK-NEXT:    vshufps {{.*#+}} xmm0 = xmm1[1,0],xmm0[0,1]
34; CHECK-NEXT:    vinsertf128 $1, %xmm0, %ymm2, %ymm0
35; CHECK-NEXT:    vxorps %ymm1, %ymm1, %ymm1
36; CHECK-NEXT:    vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
37; CHECK-NEXT:    retq
38  %b = extractelement <4 x float> %a, i32 2
39  %c = insertelement <16 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float undef, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %b, i32 5
40  %b1 = extractelement <4 x float> %a, i32 0
41  %c1 = insertelement <16 x float> %c, float %b1, i32 6
42  ret <16 x float>%c1
43}
44