1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=corei7 -mattr=+sse4.1 | FileCheck %s
3
4; rdar://12721174
5; We should not fold movss into pshufd since pshufd expects m128 while movss
6; loads from m32.
7define void @sample_test(<4 x float>* %source, <2 x float>* %dest) nounwind {
8; CHECK-LABEL: sample_test:
9; CHECK:       # %bb.0: # %entry
10; CHECK-NEXT:    subq $24, %rsp
11; CHECK-NEXT:    movq %rdi, {{[0-9]+}}(%rsp)
12; CHECK-NEXT:    movq %rsi, {{[0-9]+}}(%rsp)
13; CHECK-NEXT:    xorps %xmm0, %xmm0
14; CHECK-NEXT:    movlps %xmm0, (%rsp)
15; CHECK-NEXT:    unpcklps {{.*#+}} xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
16; CHECK-NEXT:    movlps %xmm0, (%rsp)
17; CHECK-NEXT:    movlps %xmm0, (%rsi)
18; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
19; CHECK-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
20; CHECK-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]
21; CHECK-NEXT:    callq ext
22; CHECK-NEXT:    addq $24, %rsp
23; CHECK-NEXT:    retq
24entry:
25  %source.addr = alloca <4 x float>*, align 8
26  %dest.addr = alloca <2 x float>*, align 8
27  %tmp = alloca <2 x float>, align 8
28  store <4 x float>* %source, <4 x float>** %source.addr, align 8
29  store <2 x float>* %dest, <2 x float>** %dest.addr, align 8
30  store <2 x float> zeroinitializer, <2 x float>* %tmp, align 8
31  %0 = load <4 x float>*, <4 x float>** %source.addr, align 8
32  %arrayidx = getelementptr inbounds <4 x float>, <4 x float>* %0, i64 0
33  %1 = load <4 x float>, <4 x float>* %arrayidx, align 16
34  %2 = extractelement <4 x float> %1, i32 0
35  %3 = load <2 x float>, <2 x float>* %tmp, align 8
36  %4 = insertelement <2 x float> %3, float %2, i32 1
37  store <2 x float> %4, <2 x float>* %tmp, align 8
38  %5 = load <2 x float>, <2 x float>* %tmp, align 8
39  %6 = load <2 x float>*, <2 x float>** %dest.addr, align 8
40  %arrayidx1 = getelementptr inbounds <2 x float>, <2 x float>* %6, i64 0
41  store <2 x float> %5, <2 x float>* %arrayidx1, align 8
42  %7 = load <2 x float>*, <2 x float>** %dest.addr, align 8
43  %arrayidx2 = getelementptr inbounds <2 x float>, <2 x float>* %7, i64 0
44  %8 = load <2 x float>, <2 x float>* %arrayidx2, align 8
45  %vecext = extractelement <2 x float> %8, i32 0
46  %9 = load <2 x float>*, <2 x float>** %dest.addr, align 8
47  %arrayidx3 = getelementptr inbounds <2 x float>, <2 x float>* %9, i64 0
48  %10 = load <2 x float>, <2 x float>* %arrayidx3, align 8
49  %vecext4 = extractelement <2 x float> %10, i32 1
50  call void @ext(float %vecext, float %vecext4)
51  ret void
52}
53declare void @ext(float, float)
54