1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --no_x86_scrub_sp --version 5
2 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu | FileCheck %s
4 define void @test_sincos_v4f32(<4 x float> %x, ptr noalias %out_sin, ptr noalias %out_cos) {
5 ; CHECK-LABEL: test_sincos_v4f32:
7 ; CHECK-NEXT: pushl %edi
8 ; CHECK-NEXT: .cfi_def_cfa_offset 8
9 ; CHECK-NEXT: pushl %esi
10 ; CHECK-NEXT: .cfi_def_cfa_offset 12
11 ; CHECK-NEXT: subl $52, %esp
12 ; CHECK-NEXT: .cfi_def_cfa_offset 64
13 ; CHECK-NEXT: .cfi_offset %esi, -12
14 ; CHECK-NEXT: .cfi_offset %edi, -8
15 ; CHECK-NEXT: movl 84(%esp), %esi
16 ; CHECK-NEXT: flds 76(%esp)
17 ; CHECK-NEXT: fstps {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
18 ; CHECK-NEXT: flds 64(%esp)
19 ; CHECK-NEXT: fstps {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
20 ; CHECK-NEXT: flds 72(%esp)
21 ; CHECK-NEXT: fstps {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
22 ; CHECK-NEXT: flds 68(%esp)
23 ; CHECK-NEXT: movl 80(%esp), %edi
24 ; CHECK-NEXT: leal 40(%esp), %eax
25 ; CHECK-NEXT: movl %eax, 8(%esp)
26 ; CHECK-NEXT: leal 4(%edi), %eax
27 ; CHECK-NEXT: movl %eax, 4(%esp)
28 ; CHECK-NEXT: fstps (%esp)
29 ; CHECK-NEXT: calll sincosf
30 ; CHECK-NEXT: leal 44(%esp), %eax
31 ; CHECK-NEXT: movl %eax, 8(%esp)
32 ; CHECK-NEXT: leal 8(%edi), %eax
33 ; CHECK-NEXT: movl %eax, 4(%esp)
34 ; CHECK-NEXT: flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
35 ; CHECK-NEXT: fstps (%esp)
36 ; CHECK-NEXT: calll sincosf
37 ; CHECK-NEXT: leal 36(%esp), %eax
38 ; CHECK-NEXT: movl %eax, 8(%esp)
39 ; CHECK-NEXT: movl %edi, 4(%esp)
40 ; CHECK-NEXT: flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
41 ; CHECK-NEXT: fstps (%esp)
42 ; CHECK-NEXT: calll sincosf
43 ; CHECK-NEXT: leal 48(%esp), %eax
44 ; CHECK-NEXT: movl %eax, 8(%esp)
45 ; CHECK-NEXT: addl $12, %edi
46 ; CHECK-NEXT: movl %edi, 4(%esp)
47 ; CHECK-NEXT: flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
48 ; CHECK-NEXT: fstps (%esp)
49 ; CHECK-NEXT: calll sincosf
50 ; CHECK-NEXT: flds 36(%esp)
51 ; CHECK-NEXT: flds 40(%esp)
52 ; CHECK-NEXT: flds 44(%esp)
53 ; CHECK-NEXT: flds 48(%esp)
54 ; CHECK-NEXT: fstps 12(%esi)
55 ; CHECK-NEXT: fstps 8(%esi)
56 ; CHECK-NEXT: fstps 4(%esi)
57 ; CHECK-NEXT: fstps (%esi)
58 ; CHECK-NEXT: addl $52, %esp
59 ; CHECK-NEXT: .cfi_def_cfa_offset 12
60 ; CHECK-NEXT: popl %esi
61 ; CHECK-NEXT: .cfi_def_cfa_offset 8
62 ; CHECK-NEXT: popl %edi
63 ; CHECK-NEXT: .cfi_def_cfa_offset 4
65 %result = call { <4 x float>, <4 x float> } @llvm.sincos.v4f32(<4 x float> %x)
66 %result.0 = extractvalue { <4 x float>, <4 x float> } %result, 0
67 %result.1 = extractvalue { <4 x float>, <4 x float> } %result, 1
68 store <4 x float> %result.0, ptr %out_sin, align 4
69 store <4 x float> %result.1, ptr %out_cos, align 4
73 define void @test_sincos_v2f64(<2 x double> %x, ptr noalias %out_sin, ptr noalias %out_cos) {
74 ; CHECK-LABEL: test_sincos_v2f64:
76 ; CHECK-NEXT: pushl %edi
77 ; CHECK-NEXT: .cfi_def_cfa_offset 8
78 ; CHECK-NEXT: pushl %esi
79 ; CHECK-NEXT: .cfi_def_cfa_offset 12
80 ; CHECK-NEXT: subl $52, %esp
81 ; CHECK-NEXT: .cfi_def_cfa_offset 64
82 ; CHECK-NEXT: .cfi_offset %esi, -12
83 ; CHECK-NEXT: .cfi_offset %edi, -8
84 ; CHECK-NEXT: movl 84(%esp), %esi
85 ; CHECK-NEXT: fldl 72(%esp)
86 ; CHECK-NEXT: fstpl {{[-0-9]+}}(%e{{[sb]}}p) # 8-byte Folded Spill
87 ; CHECK-NEXT: fldl 64(%esp)
88 ; CHECK-NEXT: movl 80(%esp), %edi
89 ; CHECK-NEXT: leal 24(%esp), %eax
90 ; CHECK-NEXT: movl %eax, 12(%esp)
91 ; CHECK-NEXT: movl %edi, 8(%esp)
92 ; CHECK-NEXT: fstpl (%esp)
93 ; CHECK-NEXT: calll sincos
94 ; CHECK-NEXT: leal 32(%esp), %eax
95 ; CHECK-NEXT: movl %eax, 12(%esp)
96 ; CHECK-NEXT: addl $8, %edi
97 ; CHECK-NEXT: movl %edi, 8(%esp)
98 ; CHECK-NEXT: fldl {{[-0-9]+}}(%e{{[sb]}}p) # 8-byte Folded Reload
99 ; CHECK-NEXT: fstpl (%esp)
100 ; CHECK-NEXT: calll sincos
101 ; CHECK-NEXT: fldl 24(%esp)
102 ; CHECK-NEXT: fldl 32(%esp)
103 ; CHECK-NEXT: fstpl 8(%esi)
104 ; CHECK-NEXT: fstpl (%esi)
105 ; CHECK-NEXT: addl $52, %esp
106 ; CHECK-NEXT: .cfi_def_cfa_offset 12
107 ; CHECK-NEXT: popl %esi
108 ; CHECK-NEXT: .cfi_def_cfa_offset 8
109 ; CHECK-NEXT: popl %edi
110 ; CHECK-NEXT: .cfi_def_cfa_offset 4
112 %result = call { <2 x double>, <2 x double> } @llvm.sincos.v2f64(<2 x double> %x)
113 %result.0 = extractvalue { <2 x double>, <2 x double> } %result, 0
114 %result.1 = extractvalue { <2 x double>, <2 x double> } %result, 1
115 store <2 x double> %result.0, ptr %out_sin, align 8
116 store <2 x double> %result.1, ptr %out_cos, align 8
120 declare void @foo(ptr, ptr)
122 define void @can_fold_with_call_in_chain(float %x, ptr noalias %a, ptr noalias %b) {
123 ; CHECK-LABEL: can_fold_with_call_in_chain:
124 ; CHECK: # %bb.0: # %entry
125 ; CHECK-NEXT: pushl %edi
126 ; CHECK-NEXT: .cfi_def_cfa_offset 8
127 ; CHECK-NEXT: pushl %esi
128 ; CHECK-NEXT: .cfi_def_cfa_offset 12
129 ; CHECK-NEXT: subl $20, %esp
130 ; CHECK-NEXT: .cfi_def_cfa_offset 32
131 ; CHECK-NEXT: .cfi_offset %esi, -12
132 ; CHECK-NEXT: .cfi_offset %edi, -8
133 ; CHECK-NEXT: flds 32(%esp)
134 ; CHECK-NEXT: fstps {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
135 ; CHECK-NEXT: movl 36(%esp), %edi
136 ; CHECK-NEXT: movl 40(%esp), %esi
137 ; CHECK-NEXT: movl %esi, 4(%esp)
138 ; CHECK-NEXT: movl %edi, (%esp)
139 ; CHECK-NEXT: calll foo@PLT
140 ; CHECK-NEXT: leal 16(%esp), %eax
141 ; CHECK-NEXT: movl %eax, 8(%esp)
142 ; CHECK-NEXT: movl %edi, 4(%esp)
143 ; CHECK-NEXT: flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
144 ; CHECK-NEXT: fstps (%esp)
145 ; CHECK-NEXT: calll sincosf
146 ; CHECK-NEXT: flds 16(%esp)
147 ; CHECK-NEXT: fstps (%esi)
148 ; CHECK-NEXT: addl $20, %esp
149 ; CHECK-NEXT: .cfi_def_cfa_offset 12
150 ; CHECK-NEXT: popl %esi
151 ; CHECK-NEXT: .cfi_def_cfa_offset 8
152 ; CHECK-NEXT: popl %edi
153 ; CHECK-NEXT: .cfi_def_cfa_offset 4
156 %sin = tail call float @llvm.sin.f32(float %x)
157 %cos = tail call float @llvm.cos.f32(float %x)
158 call void @foo(ptr %a, ptr %b)
159 store float %sin, ptr %a, align 4
160 store float %cos, ptr %b, align 4