1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,-slow-unaligned-mem-32 | FileCheck %s --check-prefix=ALL --check-prefix=FAST32
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+slow-unaligned-mem-32 | FileCheck %s --check-prefix=ALL --check-prefix=SLOW32
4 define <4 x float> @merge_2_floats(float* nocapture %p) nounwind readonly {
6 %vecins = insertelement <4 x float> undef, float %tmp1, i32 0
7 %add.ptr = getelementptr float* %p, i32 1
8 %tmp5 = load float* %add.ptr
9 %vecins7 = insertelement <4 x float> %vecins, float %tmp5, i32 1
10 ret <4 x float> %vecins7
12 ; ALL-LABEL: merge_2_floats
17 define <4 x float> @merge_4_floats(float* %ptr) {
18 %a = load float* %ptr, align 8
19 %vec = insertelement <4 x float> undef, float %a, i32 0
20 %idx1 = getelementptr inbounds float* %ptr, i64 1
21 %b = load float* %idx1, align 8
22 %vec2 = insertelement <4 x float> %vec, float %b, i32 1
23 %idx3 = getelementptr inbounds float* %ptr, i64 2
24 %c = load float* %idx3, align 8
25 %vec4 = insertelement <4 x float> %vec2, float %c, i32 2
26 %idx5 = getelementptr inbounds float* %ptr, i64 3
27 %d = load float* %idx5, align 8
28 %vec6 = insertelement <4 x float> %vec4, float %d, i32 3
31 ; ALL-LABEL: merge_4_floats
36 ; PR21710 ( http://llvm.org/bugs/show_bug.cgi?id=21710 )
37 ; Make sure that 32-byte vectors are handled efficiently.
38 ; If the target has slow 32-byte accesses, we should still generate
41 define <8 x float> @merge_8_floats(float* %ptr) {
42 %a = load float* %ptr, align 4
43 %vec = insertelement <8 x float> undef, float %a, i32 0
44 %idx1 = getelementptr inbounds float* %ptr, i64 1
45 %b = load float* %idx1, align 4
46 %vec2 = insertelement <8 x float> %vec, float %b, i32 1
47 %idx3 = getelementptr inbounds float* %ptr, i64 2
48 %c = load float* %idx3, align 4
49 %vec4 = insertelement <8 x float> %vec2, float %c, i32 2
50 %idx5 = getelementptr inbounds float* %ptr, i64 3
51 %d = load float* %idx5, align 4
52 %vec6 = insertelement <8 x float> %vec4, float %d, i32 3
53 %idx7 = getelementptr inbounds float* %ptr, i64 4
54 %e = load float* %idx7, align 4
55 %vec8 = insertelement <8 x float> %vec6, float %e, i32 4
56 %idx9 = getelementptr inbounds float* %ptr, i64 5
57 %f = load float* %idx9, align 4
58 %vec10 = insertelement <8 x float> %vec8, float %f, i32 5
59 %idx11 = getelementptr inbounds float* %ptr, i64 6
60 %g = load float* %idx11, align 4
61 %vec12 = insertelement <8 x float> %vec10, float %g, i32 6
62 %idx13 = getelementptr inbounds float* %ptr, i64 7
63 %h = load float* %idx13, align 4
64 %vec14 = insertelement <8 x float> %vec12, float %h, i32 7
65 ret <8 x float> %vec14
67 ; ALL-LABEL: merge_8_floats
77 define <4 x double> @merge_4_doubles(double* %ptr) {
78 %a = load double* %ptr, align 8
79 %vec = insertelement <4 x double> undef, double %a, i32 0
80 %idx1 = getelementptr inbounds double* %ptr, i64 1
81 %b = load double* %idx1, align 8
82 %vec2 = insertelement <4 x double> %vec, double %b, i32 1
83 %idx3 = getelementptr inbounds double* %ptr, i64 2
84 %c = load double* %idx3, align 8
85 %vec4 = insertelement <4 x double> %vec2, double %c, i32 2
86 %idx5 = getelementptr inbounds double* %ptr, i64 3
87 %d = load double* %idx5, align 8
88 %vec6 = insertelement <4 x double> %vec4, double %d, i32 3
89 ret <4 x double> %vec6
91 ; ALL-LABEL: merge_4_doubles