• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mattr=+sse2,-sse4.1 | FileCheck %s --check-prefix=X32
3; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+sse2,-sse4.1 | FileCheck %s --check-prefix=X64
4
5define void @test1(<4 x float>* %F, float* %f) nounwind {
6; X32-LABEL: test1:
7; X32:       # BB#0: # %entry
8; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
9; X32-NEXT:    movl {{[0-9]+}}(%esp), %ecx
10; X32-NEXT:    movaps (%ecx), %xmm0
11; X32-NEXT:    addps %xmm0, %xmm0
12; X32-NEXT:    movss %xmm0, (%eax)
13; X32-NEXT:    retl
14;
15; X64-LABEL: test1:
16; X64:       # BB#0: # %entry
17; X64-NEXT:    movaps (%rdi), %xmm0
18; X64-NEXT:    addps %xmm0, %xmm0
19; X64-NEXT:    movss %xmm0, (%rsi)
20; X64-NEXT:    retq
21entry:
22  %tmp = load <4 x float>, <4 x float>* %F
23  %tmp7 = fadd <4 x float> %tmp, %tmp
24  %tmp2 = extractelement <4 x float> %tmp7, i32 0
25  store float %tmp2, float* %f
26  ret void
27}
28
29define float @test2(<4 x float>* %F, float* %f) nounwind {
30; X32-LABEL: test2:
31; X32:       # BB#0: # %entry
32; X32-NEXT:    pushl %eax
33; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
34; X32-NEXT:    movaps (%eax), %xmm0
35; X32-NEXT:    addps %xmm0, %xmm0
36; X32-NEXT:    shufpd {{.*#+}} xmm0 = xmm0[1,0]
37; X32-NEXT:    movss %xmm0, (%esp)
38; X32-NEXT:    flds (%esp)
39; X32-NEXT:    popl %eax
40; X32-NEXT:    retl
41;
42; X64-LABEL: test2:
43; X64:       # BB#0: # %entry
44; X64-NEXT:    movaps (%rdi), %xmm0
45; X64-NEXT:    addps %xmm0, %xmm0
46; X64-NEXT:    shufpd {{.*#+}} xmm0 = xmm0[1,0]
47; X64-NEXT:    retq
48entry:
49  %tmp = load <4 x float>, <4 x float>* %F
50  %tmp7 = fadd <4 x float> %tmp, %tmp
51  %tmp2 = extractelement <4 x float> %tmp7, i32 2
52  ret float %tmp2
53}
54
55define void @test3(float* %R, <4 x float>* %P1) nounwind {
56; X32-LABEL: test3:
57; X32:       # BB#0: # %entry
58; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
59; X32-NEXT:    movl {{[0-9]+}}(%esp), %ecx
60; X32-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
61; X32-NEXT:    movss %xmm0, (%eax)
62; X32-NEXT:    retl
63;
64; X64-LABEL: test3:
65; X64:       # BB#0: # %entry
66; X64-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
67; X64-NEXT:    movss %xmm0, (%rdi)
68; X64-NEXT:    retq
69entry:
70  %X = load <4 x float>, <4 x float>* %P1
71  %tmp = extractelement <4 x float> %X, i32 3
72  store float %tmp, float* %R
73  ret void
74}
75
76define double @test4(double %A) nounwind {
77; X32-LABEL: test4:
78; X32:       # BB#0: # %entry
79; X32-NEXT:    subl $12, %esp
80; X32-NEXT:    calll foo
81; X32-NEXT:    shufpd {{.*#+}} xmm0 = xmm0[1,0]
82; X32-NEXT:    addsd {{[0-9]+}}(%esp), %xmm0
83; X32-NEXT:    movsd %xmm0, (%esp)
84; X32-NEXT:    fldl (%esp)
85; X32-NEXT:    addl $12, %esp
86; X32-NEXT:    retl
87;
88; X64-LABEL: test4:
89; X64:       # BB#0: # %entry
90; X64-NEXT:    pushq %rax
91; X64-NEXT:    movsd %xmm0, (%rsp) # 8-byte Spill
92; X64-NEXT:    callq foo
93; X64-NEXT:    shufpd {{.*#+}} xmm0 = xmm0[1,0]
94; X64-NEXT:    addsd (%rsp), %xmm0 # 8-byte Folded Reload
95; X64-NEXT:    popq %rax
96; X64-NEXT:    retq
97entry:
98  %tmp1 = call <2 x double> @foo( )
99  %tmp2 = extractelement <2 x double> %tmp1, i32 1
100  %tmp3 = fadd double %tmp2, %A
101  ret double %tmp3
102}
103
104declare <2 x double> @foo()
105