add test to show suboptimal load merging behavior
[oota-llvm.git] / test / CodeGen / X86 / avx512-build-vector.ll
1 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s
2
3 define <16 x i32> @test1(i32* %x) {
4 ; CHECK-LABEL: test1:
5 ; CHECK:    vmovd (%rdi), %xmm
6 ; CHECK:    vmovdqa32
7 ; CHECK:    vpermt2d %zmm
8    %y = load i32, i32* %x, align 4
9    %res = insertelement <16 x i32>zeroinitializer, i32 %y, i32 4
10    ret <16 x i32>%res
11 }
12
13 define <16 x i32> @test2(<16 x i32> %x) {
14 ; CHECK-LABEL: test2:
15 ; CHECK:       ## BB#0:
16 ; CHECK-NEXT:    vpaddd {{.*}}(%rip){1to16}, %zmm0, %zmm0
17 ; CHECK-NEXT:    retq
18    %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
19    ret <16 x i32>%res
20 }
21
22 define <16 x float> @test3(<4 x float> %a) {
23 ; CHECK-LABEL: test3:
24 ; CHECK:       ## BB#0:
25 ; CHECK-NEXT:    vpermilpd {{.*#+}} xmm1 = xmm0[1,0]
26 ; CHECK-NEXT:    vxorps %xmm2, %xmm2, %xmm2
27 ; CHECK-NEXT:    vmovss %xmm0, %xmm2, %xmm0
28 ; CHECK-NEXT:    vmovss %xmm1, %xmm2, %xmm1
29 ; CHECK-NEXT:    vshufps {{.*#+}} xmm0 = xmm1[1,0],xmm0[0,1]
30 ; CHECK-NEXT:    vinsertf128 $1, %xmm0, %ymm2, %ymm0
31 ; CHECK-NEXT:    vxorps %ymm1, %ymm1, %ymm1
32 ; CHECK-NEXT:    vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
33 ; CHECK-NEXT:    retq
34   %b = extractelement <4 x float> %a, i32 2
35   %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
36   %b1 = extractelement <4 x float> %a, i32 0
37   %c1 = insertelement <16 x float> %c, float %b1, i32 6
38   ret <16 x float>%c1
39 }