1; RUN: llc < %s -march=x86-64 -mcpu=nehalem | FileCheck %s
2
3; CHECK-LABEL: a:
4; CHECK: movdqu
5; CHECK: pshufd
6define <4 x float> @a(<4 x float>* %y) nounwind {
7  %x = load <4 x float>* %y, align 4
8  %a = extractelement <4 x float> %x, i32 0
9  %b = extractelement <4 x float> %x, i32 1
10  %c = extractelement <4 x float> %x, i32 2
11  %d = extractelement <4 x float> %x, i32 3
12  %p = insertelement <4 x float> undef, float %d, i32 0
13  %q = insertelement <4 x float> %p, float %c, i32 1
14  %r = insertelement <4 x float> %q, float %b, i32 2
15  %s = insertelement <4 x float> %r, float %a, i32 3
16  ret <4 x float> %s
17}
18
19; CHECK-LABEL: b:
20; CHECK: movups
21; CHECK: unpckhps
22define <4 x float> @b(<4 x float>* %y, <4 x float> %z) nounwind {
23  %x = load <4 x float>* %y, align 4
24  %a = extractelement <4 x float> %x, i32 2
25  %b = extractelement <4 x float> %x, i32 3
26  %c = extractelement <4 x float> %z, i32 2
27  %d = extractelement <4 x float> %z, i32 3
28  %p = insertelement <4 x float> undef, float %c, i32 0
29  %q = insertelement <4 x float> %p, float %a, i32 1
30  %r = insertelement <4 x float> %q, float %d, i32 2
31  %s = insertelement <4 x float> %r, float %b, i32 3
32  ret <4 x float> %s
33}
34
35; CHECK-LABEL: c:
36; CHECK: movupd
37; CHECK: shufpd
38define <2 x double> @c(<2 x double>* %y) nounwind {
39  %x = load <2 x double>* %y, align 8
40  %a = extractelement <2 x double> %x, i32 0
41  %c = extractelement <2 x double> %x, i32 1
42  %p = insertelement <2 x double> undef, double %c, i32 0
43  %r = insertelement <2 x double> %p, double %a, i32 1
44  ret <2 x double> %r
45}
46
47; CHECK-LABEL: d:
48; CHECK: movupd
49; CHECK: unpckhpd
50define <2 x double> @d(<2 x double>* %y, <2 x double> %z) nounwind {
51  %x = load <2 x double>* %y, align 8
52  %a = extractelement <2 x double> %x, i32 1
53  %c = extractelement <2 x double> %z, i32 1
54  %p = insertelement <2 x double> undef, double %c, i32 0
55  %r = insertelement <2 x double> %p, double %a, i32 1
56  ret <2 x double> %r
57}
58