1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-pc-windows-msvc -mattr=+avx512f,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=CHECK,X32,AVX512_32,AVX512_32_WIN,AVX512DQVL_32_WIN
3 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -mattr=+avx512f,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=CHECK,X32,AVX512_32,AVX512_32_LIN,AVX512DQVL_32_LIN
4 ; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc -mattr=+avx512f,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=CHECK,X64,AVX512_64,AVX512_64_WIN,AVX512DQVL_64_WIN
5 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=CHECK,X32,AVX512_64,AVX512_64_LIN,AVX512DQVL_64_LIN
6 ; RUN: llc < %s -mtriple=i386-pc-windows-msvc -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefixes=CHECK,X32,AVX512_32,AVX512_32_WIN,AVX512DQ_32_WIN
7 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefixes=CHECK,X32,AVX512_32,AVX512_32_LIN,AVX512DQ_32_LIN
8 ; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefixes=CHECK,X64,AVX512_64,AVX512_64_WIN,AVX512DQ_64_WIN
9 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefixes=CHECK,X32,AVX512_64,AVX512_64_LIN,AVX512DQ_64_LIN
10 ; RUN: llc < %s -mtriple=i386-pc-windows-msvc -mattr=+avx512f | FileCheck %s --check-prefixes=CHECK,X32,AVX512_32,AVX512_32_WIN,AVX512F_32_WIN
11 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -mattr=+avx512f | FileCheck %s --check-prefixes=CHECK,X32,AVX512_32,AVX512_32_LIN,AVX512F_32_LIN
12 ; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc -mattr=+avx512f | FileCheck %s --check-prefixes=CHECK,X64,AVX512_64,AVX512_64_WIN,AVX512F_64_WIN
13 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f | FileCheck %s --check-prefixes=CHECK,X32,AVX512_64,AVX512_64_LIN,AVX512F_64_LIN
14 ; RUN: llc < %s -mtriple=i386-pc-windows-msvc -mattr=+sse3 | FileCheck %s --check-prefixes=CHECK,X32,SSE3_32,SSE3_32_WIN
15 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -mattr=+sse3 | FileCheck %s --check-prefixes=CHECK,X32,SSE3_32,SSE3_32_LIN
16 ; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc -mattr=+sse3 | FileCheck %s --check-prefixes=CHECK,X64,SSE3_64,SSE3_64_WIN
17 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+sse3 | FileCheck %s --check-prefixes=CHECK,X64,SSE3_64,SSE3_64_LIN
18 ; RUN: llc < %s -mtriple=i386-pc-windows-msvc -mattr=+sse2 | FileCheck %s --check-prefixes=CHECK,X32,SSE2_32,SSE2_32_WIN
19 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -mattr=+sse2 | FileCheck %s --check-prefixes=CHECK,X32,SSE2_32,SSE2_32_LIN
20 ; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc -mattr=+sse2 | FileCheck %s --check-prefixes=CHECK,X64,SSE2_64,SSE2_64_WIN
21 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+sse2 | FileCheck %s --check-prefixes=CHECK,X64,SSE2_64,SSE2_64_LIN
22 ; RUN: llc < %s -mtriple=i386-pc-windows-msvc -mattr=-sse | FileCheck %s --check-prefixes=CHECK,X32,X87,X87_WIN
23 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -mattr=-sse | FileCheck %s --check-prefixes=CHECK,X32,X87,X87_LIN
25 ; Check that scalar FP conversions to signed and unsigned int64 are using
26 ; reasonable sequences, across platforms and target switches.
28 ; The signed case is straight forward, and the tests here basically
29 ; ensure successful compilation (f80 with avx512 was broken at one point).
31 ; For the unsigned case there are many possible sequences, so to avoid
32 ; a fragile test we just check for the presence of a few key instructions.
33 ; AVX512 on Intel64 can use vcvtts[ds]2usi directly for float and double.
34 ; Otherwise the sequence will involve an FP subtract (fsub, subss or subsd),
35 ; and a truncating conversion (cvtts[ds]2si, fisttp, or fnstcw+fist). When
36 ; both a subtract and fnstcw are needed, they can occur in either order.
38 ; The interesting subtargets are AVX512F (vcvtts[ds]2usi), SSE3 (fisttp),
39 ; SSE2 (cvtts[ds]2si) and vanilla X87 (fnstcw+fist, 32-bit only).
41 define i64 @f_to_u64(float %a) nounwind {
42 ; AVX512DQVL_32_WIN-LABEL: f_to_u64:
43 ; AVX512DQVL_32_WIN: # %bb.0:
44 ; AVX512DQVL_32_WIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
45 ; AVX512DQVL_32_WIN-NEXT: vcvttps2uqq %xmm0, %ymm0
46 ; AVX512DQVL_32_WIN-NEXT: vmovd %xmm0, %eax
47 ; AVX512DQVL_32_WIN-NEXT: vpextrd $1, %xmm0, %edx
48 ; AVX512DQVL_32_WIN-NEXT: vzeroupper
49 ; AVX512DQVL_32_WIN-NEXT: retl
51 ; AVX512DQVL_32_LIN-LABEL: f_to_u64:
52 ; AVX512DQVL_32_LIN: # %bb.0:
53 ; AVX512DQVL_32_LIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
54 ; AVX512DQVL_32_LIN-NEXT: vcvttps2uqq %xmm0, %ymm0
55 ; AVX512DQVL_32_LIN-NEXT: vmovd %xmm0, %eax
56 ; AVX512DQVL_32_LIN-NEXT: vpextrd $1, %xmm0, %edx
57 ; AVX512DQVL_32_LIN-NEXT: vzeroupper
58 ; AVX512DQVL_32_LIN-NEXT: retl
60 ; AVX512_64-LABEL: f_to_u64:
62 ; AVX512_64-NEXT: vcvttss2usi %xmm0, %rax
63 ; AVX512_64-NEXT: retq
65 ; AVX512DQ_32_WIN-LABEL: f_to_u64:
66 ; AVX512DQ_32_WIN: # %bb.0:
67 ; AVX512DQ_32_WIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
68 ; AVX512DQ_32_WIN-NEXT: vcvttps2uqq %ymm0, %zmm0
69 ; AVX512DQ_32_WIN-NEXT: vmovd %xmm0, %eax
70 ; AVX512DQ_32_WIN-NEXT: vpextrd $1, %xmm0, %edx
71 ; AVX512DQ_32_WIN-NEXT: vzeroupper
72 ; AVX512DQ_32_WIN-NEXT: retl
74 ; AVX512DQ_32_LIN-LABEL: f_to_u64:
75 ; AVX512DQ_32_LIN: # %bb.0:
76 ; AVX512DQ_32_LIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
77 ; AVX512DQ_32_LIN-NEXT: vcvttps2uqq %ymm0, %zmm0
78 ; AVX512DQ_32_LIN-NEXT: vmovd %xmm0, %eax
79 ; AVX512DQ_32_LIN-NEXT: vpextrd $1, %xmm0, %edx
80 ; AVX512DQ_32_LIN-NEXT: vzeroupper
81 ; AVX512DQ_32_LIN-NEXT: retl
83 ; AVX512F_32_WIN-LABEL: f_to_u64:
84 ; AVX512F_32_WIN: # %bb.0:
85 ; AVX512F_32_WIN-NEXT: pushl %ebp
86 ; AVX512F_32_WIN-NEXT: movl %esp, %ebp
87 ; AVX512F_32_WIN-NEXT: andl $-8, %esp
88 ; AVX512F_32_WIN-NEXT: subl $8, %esp
89 ; AVX512F_32_WIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
90 ; AVX512F_32_WIN-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
91 ; AVX512F_32_WIN-NEXT: vcmpltss %xmm1, %xmm0, %k1
92 ; AVX512F_32_WIN-NEXT: vsubss %xmm1, %xmm0, %xmm2
93 ; AVX512F_32_WIN-NEXT: vmovss %xmm0, %xmm0, %xmm2 {%k1}
94 ; AVX512F_32_WIN-NEXT: vmovss %xmm2, (%esp)
95 ; AVX512F_32_WIN-NEXT: flds (%esp)
96 ; AVX512F_32_WIN-NEXT: fisttpll (%esp)
97 ; AVX512F_32_WIN-NEXT: xorl %edx, %edx
98 ; AVX512F_32_WIN-NEXT: vucomiss %xmm0, %xmm1
99 ; AVX512F_32_WIN-NEXT: setbe %dl
100 ; AVX512F_32_WIN-NEXT: shll $31, %edx
101 ; AVX512F_32_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
102 ; AVX512F_32_WIN-NEXT: movl (%esp), %eax
103 ; AVX512F_32_WIN-NEXT: movl %ebp, %esp
104 ; AVX512F_32_WIN-NEXT: popl %ebp
105 ; AVX512F_32_WIN-NEXT: retl
107 ; AVX512F_32_LIN-LABEL: f_to_u64:
108 ; AVX512F_32_LIN: # %bb.0:
109 ; AVX512F_32_LIN-NEXT: subl $12, %esp
110 ; AVX512F_32_LIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
111 ; AVX512F_32_LIN-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
112 ; AVX512F_32_LIN-NEXT: vcmpltss %xmm1, %xmm0, %k1
113 ; AVX512F_32_LIN-NEXT: vsubss %xmm1, %xmm0, %xmm2
114 ; AVX512F_32_LIN-NEXT: vmovss %xmm0, %xmm0, %xmm2 {%k1}
115 ; AVX512F_32_LIN-NEXT: vmovss %xmm2, (%esp)
116 ; AVX512F_32_LIN-NEXT: flds (%esp)
117 ; AVX512F_32_LIN-NEXT: fisttpll (%esp)
118 ; AVX512F_32_LIN-NEXT: xorl %edx, %edx
119 ; AVX512F_32_LIN-NEXT: vucomiss %xmm0, %xmm1
120 ; AVX512F_32_LIN-NEXT: setbe %dl
121 ; AVX512F_32_LIN-NEXT: shll $31, %edx
122 ; AVX512F_32_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
123 ; AVX512F_32_LIN-NEXT: movl (%esp), %eax
124 ; AVX512F_32_LIN-NEXT: addl $12, %esp
125 ; AVX512F_32_LIN-NEXT: retl
127 ; SSE3_32_WIN-LABEL: f_to_u64:
128 ; SSE3_32_WIN: # %bb.0:
129 ; SSE3_32_WIN-NEXT: pushl %ebp
130 ; SSE3_32_WIN-NEXT: movl %esp, %ebp
131 ; SSE3_32_WIN-NEXT: andl $-8, %esp
132 ; SSE3_32_WIN-NEXT: subl $8, %esp
133 ; SSE3_32_WIN-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
134 ; SSE3_32_WIN-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
135 ; SSE3_32_WIN-NEXT: movaps %xmm0, %xmm2
136 ; SSE3_32_WIN-NEXT: cmpltss %xmm1, %xmm2
137 ; SSE3_32_WIN-NEXT: movaps %xmm2, %xmm3
138 ; SSE3_32_WIN-NEXT: andps %xmm0, %xmm2
139 ; SSE3_32_WIN-NEXT: xorl %edx, %edx
140 ; SSE3_32_WIN-NEXT: ucomiss %xmm0, %xmm1
141 ; SSE3_32_WIN-NEXT: subss %xmm1, %xmm0
142 ; SSE3_32_WIN-NEXT: andnps %xmm0, %xmm3
143 ; SSE3_32_WIN-NEXT: orps %xmm3, %xmm2
144 ; SSE3_32_WIN-NEXT: movss %xmm2, (%esp)
145 ; SSE3_32_WIN-NEXT: flds (%esp)
146 ; SSE3_32_WIN-NEXT: fisttpll (%esp)
147 ; SSE3_32_WIN-NEXT: setbe %dl
148 ; SSE3_32_WIN-NEXT: shll $31, %edx
149 ; SSE3_32_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
150 ; SSE3_32_WIN-NEXT: movl (%esp), %eax
151 ; SSE3_32_WIN-NEXT: movl %ebp, %esp
152 ; SSE3_32_WIN-NEXT: popl %ebp
153 ; SSE3_32_WIN-NEXT: retl
155 ; SSE3_32_LIN-LABEL: f_to_u64:
156 ; SSE3_32_LIN: # %bb.0:
157 ; SSE3_32_LIN-NEXT: subl $12, %esp
158 ; SSE3_32_LIN-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
159 ; SSE3_32_LIN-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
160 ; SSE3_32_LIN-NEXT: movaps %xmm0, %xmm2
161 ; SSE3_32_LIN-NEXT: cmpltss %xmm1, %xmm2
162 ; SSE3_32_LIN-NEXT: movaps %xmm2, %xmm3
163 ; SSE3_32_LIN-NEXT: andps %xmm0, %xmm2
164 ; SSE3_32_LIN-NEXT: xorl %edx, %edx
165 ; SSE3_32_LIN-NEXT: ucomiss %xmm0, %xmm1
166 ; SSE3_32_LIN-NEXT: subss %xmm1, %xmm0
167 ; SSE3_32_LIN-NEXT: andnps %xmm0, %xmm3
168 ; SSE3_32_LIN-NEXT: orps %xmm3, %xmm2
169 ; SSE3_32_LIN-NEXT: movss %xmm2, (%esp)
170 ; SSE3_32_LIN-NEXT: flds (%esp)
171 ; SSE3_32_LIN-NEXT: fisttpll (%esp)
172 ; SSE3_32_LIN-NEXT: setbe %dl
173 ; SSE3_32_LIN-NEXT: shll $31, %edx
174 ; SSE3_32_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
175 ; SSE3_32_LIN-NEXT: movl (%esp), %eax
176 ; SSE3_32_LIN-NEXT: addl $12, %esp
177 ; SSE3_32_LIN-NEXT: retl
179 ; SSE3_64-LABEL: f_to_u64:
181 ; SSE3_64-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
182 ; SSE3_64-NEXT: movaps %xmm0, %xmm2
183 ; SSE3_64-NEXT: subss %xmm1, %xmm2
184 ; SSE3_64-NEXT: cvttss2si %xmm2, %rax
185 ; SSE3_64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000
186 ; SSE3_64-NEXT: xorq %rax, %rcx
187 ; SSE3_64-NEXT: cvttss2si %xmm0, %rax
188 ; SSE3_64-NEXT: ucomiss %xmm1, %xmm0
189 ; SSE3_64-NEXT: cmovaeq %rcx, %rax
192 ; SSE2_32_WIN-LABEL: f_to_u64:
193 ; SSE2_32_WIN: # %bb.0:
194 ; SSE2_32_WIN-NEXT: pushl %ebp
195 ; SSE2_32_WIN-NEXT: movl %esp, %ebp
196 ; SSE2_32_WIN-NEXT: andl $-8, %esp
197 ; SSE2_32_WIN-NEXT: subl $16, %esp
198 ; SSE2_32_WIN-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
199 ; SSE2_32_WIN-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
200 ; SSE2_32_WIN-NEXT: movaps %xmm0, %xmm2
201 ; SSE2_32_WIN-NEXT: subss %xmm1, %xmm2
202 ; SSE2_32_WIN-NEXT: movaps %xmm0, %xmm3
203 ; SSE2_32_WIN-NEXT: cmpltss %xmm1, %xmm3
204 ; SSE2_32_WIN-NEXT: movaps %xmm3, %xmm4
205 ; SSE2_32_WIN-NEXT: andnps %xmm2, %xmm4
206 ; SSE2_32_WIN-NEXT: andps %xmm0, %xmm3
207 ; SSE2_32_WIN-NEXT: orps %xmm4, %xmm3
208 ; SSE2_32_WIN-NEXT: movss %xmm3, {{[0-9]+}}(%esp)
209 ; SSE2_32_WIN-NEXT: flds {{[0-9]+}}(%esp)
210 ; SSE2_32_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
211 ; SSE2_32_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
212 ; SSE2_32_WIN-NEXT: orl $3072, %eax # imm = 0xC00
213 ; SSE2_32_WIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
214 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
215 ; SSE2_32_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
216 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
217 ; SSE2_32_WIN-NEXT: xorl %edx, %edx
218 ; SSE2_32_WIN-NEXT: ucomiss %xmm0, %xmm1
219 ; SSE2_32_WIN-NEXT: setbe %dl
220 ; SSE2_32_WIN-NEXT: shll $31, %edx
221 ; SSE2_32_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
222 ; SSE2_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
223 ; SSE2_32_WIN-NEXT: movl %ebp, %esp
224 ; SSE2_32_WIN-NEXT: popl %ebp
225 ; SSE2_32_WIN-NEXT: retl
227 ; SSE2_32_LIN-LABEL: f_to_u64:
228 ; SSE2_32_LIN: # %bb.0:
229 ; SSE2_32_LIN-NEXT: subl $20, %esp
230 ; SSE2_32_LIN-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
231 ; SSE2_32_LIN-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
232 ; SSE2_32_LIN-NEXT: movaps %xmm0, %xmm2
233 ; SSE2_32_LIN-NEXT: subss %xmm1, %xmm2
234 ; SSE2_32_LIN-NEXT: movaps %xmm0, %xmm3
235 ; SSE2_32_LIN-NEXT: cmpltss %xmm1, %xmm3
236 ; SSE2_32_LIN-NEXT: movaps %xmm3, %xmm4
237 ; SSE2_32_LIN-NEXT: andnps %xmm2, %xmm4
238 ; SSE2_32_LIN-NEXT: andps %xmm0, %xmm3
239 ; SSE2_32_LIN-NEXT: orps %xmm4, %xmm3
240 ; SSE2_32_LIN-NEXT: movss %xmm3, {{[0-9]+}}(%esp)
241 ; SSE2_32_LIN-NEXT: flds {{[0-9]+}}(%esp)
242 ; SSE2_32_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
243 ; SSE2_32_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
244 ; SSE2_32_LIN-NEXT: orl $3072, %eax # imm = 0xC00
245 ; SSE2_32_LIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
246 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
247 ; SSE2_32_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
248 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
249 ; SSE2_32_LIN-NEXT: xorl %edx, %edx
250 ; SSE2_32_LIN-NEXT: ucomiss %xmm0, %xmm1
251 ; SSE2_32_LIN-NEXT: setbe %dl
252 ; SSE2_32_LIN-NEXT: shll $31, %edx
253 ; SSE2_32_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
254 ; SSE2_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
255 ; SSE2_32_LIN-NEXT: addl $20, %esp
256 ; SSE2_32_LIN-NEXT: retl
258 ; SSE2_64-LABEL: f_to_u64:
260 ; SSE2_64-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
261 ; SSE2_64-NEXT: movaps %xmm0, %xmm2
262 ; SSE2_64-NEXT: subss %xmm1, %xmm2
263 ; SSE2_64-NEXT: cvttss2si %xmm2, %rax
264 ; SSE2_64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000
265 ; SSE2_64-NEXT: xorq %rax, %rcx
266 ; SSE2_64-NEXT: cvttss2si %xmm0, %rax
267 ; SSE2_64-NEXT: ucomiss %xmm1, %xmm0
268 ; SSE2_64-NEXT: cmovaeq %rcx, %rax
271 ; X87_WIN-LABEL: f_to_u64:
273 ; X87_WIN-NEXT: pushl %ebp
274 ; X87_WIN-NEXT: movl %esp, %ebp
275 ; X87_WIN-NEXT: andl $-8, %esp
276 ; X87_WIN-NEXT: subl $16, %esp
277 ; X87_WIN-NEXT: flds 8(%ebp)
278 ; X87_WIN-NEXT: flds __real@5f000000
279 ; X87_WIN-NEXT: fld %st(1)
280 ; X87_WIN-NEXT: fsub %st(1), %st
281 ; X87_WIN-NEXT: fxch %st(1)
282 ; X87_WIN-NEXT: fucomp %st(2)
283 ; X87_WIN-NEXT: fnstsw %ax
284 ; X87_WIN-NEXT: # kill: def $ah killed $ah killed $ax
286 ; X87_WIN-NEXT: ja LBB0_2
287 ; X87_WIN-NEXT: # %bb.1:
288 ; X87_WIN-NEXT: fstp %st(1)
290 ; X87_WIN-NEXT: LBB0_2:
291 ; X87_WIN-NEXT: fstp %st(0)
292 ; X87_WIN-NEXT: setbe %al
293 ; X87_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
294 ; X87_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
295 ; X87_WIN-NEXT: orl $3072, %ecx # imm = 0xC00
296 ; X87_WIN-NEXT: movw %cx, {{[0-9]+}}(%esp)
297 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
298 ; X87_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
299 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
300 ; X87_WIN-NEXT: movzbl %al, %edx
301 ; X87_WIN-NEXT: shll $31, %edx
302 ; X87_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
303 ; X87_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
304 ; X87_WIN-NEXT: movl %ebp, %esp
305 ; X87_WIN-NEXT: popl %ebp
308 ; X87_LIN-LABEL: f_to_u64:
310 ; X87_LIN-NEXT: subl $20, %esp
311 ; X87_LIN-NEXT: flds {{[0-9]+}}(%esp)
312 ; X87_LIN-NEXT: flds {{\.LCPI.*}}
313 ; X87_LIN-NEXT: fld %st(1)
314 ; X87_LIN-NEXT: fsub %st(1), %st
315 ; X87_LIN-NEXT: fxch %st(1)
316 ; X87_LIN-NEXT: fucomp %st(2)
317 ; X87_LIN-NEXT: fnstsw %ax
318 ; X87_LIN-NEXT: # kill: def $ah killed $ah killed $ax
320 ; X87_LIN-NEXT: ja .LBB0_2
321 ; X87_LIN-NEXT: # %bb.1:
322 ; X87_LIN-NEXT: fstp %st(1)
324 ; X87_LIN-NEXT: .LBB0_2:
325 ; X87_LIN-NEXT: fstp %st(0)
326 ; X87_LIN-NEXT: setbe %al
327 ; X87_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
328 ; X87_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
329 ; X87_LIN-NEXT: orl $3072, %ecx # imm = 0xC00
330 ; X87_LIN-NEXT: movw %cx, {{[0-9]+}}(%esp)
331 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
332 ; X87_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
333 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
334 ; X87_LIN-NEXT: movzbl %al, %edx
335 ; X87_LIN-NEXT: shll $31, %edx
336 ; X87_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
337 ; X87_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
338 ; X87_LIN-NEXT: addl $20, %esp
340 %r = fptoui float %a to i64
344 define i64 @f_to_s64(float %a) nounwind {
345 ; AVX512DQVL_32_WIN-LABEL: f_to_s64:
346 ; AVX512DQVL_32_WIN: # %bb.0:
347 ; AVX512DQVL_32_WIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
348 ; AVX512DQVL_32_WIN-NEXT: vcvttps2qq %xmm0, %ymm0
349 ; AVX512DQVL_32_WIN-NEXT: vmovd %xmm0, %eax
350 ; AVX512DQVL_32_WIN-NEXT: vpextrd $1, %xmm0, %edx
351 ; AVX512DQVL_32_WIN-NEXT: vzeroupper
352 ; AVX512DQVL_32_WIN-NEXT: retl
354 ; AVX512DQVL_32_LIN-LABEL: f_to_s64:
355 ; AVX512DQVL_32_LIN: # %bb.0:
356 ; AVX512DQVL_32_LIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
357 ; AVX512DQVL_32_LIN-NEXT: vcvttps2qq %xmm0, %ymm0
358 ; AVX512DQVL_32_LIN-NEXT: vmovd %xmm0, %eax
359 ; AVX512DQVL_32_LIN-NEXT: vpextrd $1, %xmm0, %edx
360 ; AVX512DQVL_32_LIN-NEXT: vzeroupper
361 ; AVX512DQVL_32_LIN-NEXT: retl
363 ; AVX512_64-LABEL: f_to_s64:
364 ; AVX512_64: # %bb.0:
365 ; AVX512_64-NEXT: vcvttss2si %xmm0, %rax
366 ; AVX512_64-NEXT: retq
368 ; AVX512DQ_32_WIN-LABEL: f_to_s64:
369 ; AVX512DQ_32_WIN: # %bb.0:
370 ; AVX512DQ_32_WIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
371 ; AVX512DQ_32_WIN-NEXT: vcvttps2qq %ymm0, %zmm0
372 ; AVX512DQ_32_WIN-NEXT: vmovd %xmm0, %eax
373 ; AVX512DQ_32_WIN-NEXT: vpextrd $1, %xmm0, %edx
374 ; AVX512DQ_32_WIN-NEXT: vzeroupper
375 ; AVX512DQ_32_WIN-NEXT: retl
377 ; AVX512DQ_32_LIN-LABEL: f_to_s64:
378 ; AVX512DQ_32_LIN: # %bb.0:
379 ; AVX512DQ_32_LIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
380 ; AVX512DQ_32_LIN-NEXT: vcvttps2qq %ymm0, %zmm0
381 ; AVX512DQ_32_LIN-NEXT: vmovd %xmm0, %eax
382 ; AVX512DQ_32_LIN-NEXT: vpextrd $1, %xmm0, %edx
383 ; AVX512DQ_32_LIN-NEXT: vzeroupper
384 ; AVX512DQ_32_LIN-NEXT: retl
386 ; AVX512F_32_WIN-LABEL: f_to_s64:
387 ; AVX512F_32_WIN: # %bb.0:
388 ; AVX512F_32_WIN-NEXT: pushl %ebp
389 ; AVX512F_32_WIN-NEXT: movl %esp, %ebp
390 ; AVX512F_32_WIN-NEXT: andl $-8, %esp
391 ; AVX512F_32_WIN-NEXT: subl $8, %esp
392 ; AVX512F_32_WIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
393 ; AVX512F_32_WIN-NEXT: vmovss %xmm0, (%esp)
394 ; AVX512F_32_WIN-NEXT: flds (%esp)
395 ; AVX512F_32_WIN-NEXT: fisttpll (%esp)
396 ; AVX512F_32_WIN-NEXT: movl (%esp), %eax
397 ; AVX512F_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
398 ; AVX512F_32_WIN-NEXT: movl %ebp, %esp
399 ; AVX512F_32_WIN-NEXT: popl %ebp
400 ; AVX512F_32_WIN-NEXT: retl
402 ; AVX512F_32_LIN-LABEL: f_to_s64:
403 ; AVX512F_32_LIN: # %bb.0:
404 ; AVX512F_32_LIN-NEXT: subl $12, %esp
405 ; AVX512F_32_LIN-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
406 ; AVX512F_32_LIN-NEXT: vmovss %xmm0, (%esp)
407 ; AVX512F_32_LIN-NEXT: flds (%esp)
408 ; AVX512F_32_LIN-NEXT: fisttpll (%esp)
409 ; AVX512F_32_LIN-NEXT: movl (%esp), %eax
410 ; AVX512F_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
411 ; AVX512F_32_LIN-NEXT: addl $12, %esp
412 ; AVX512F_32_LIN-NEXT: retl
414 ; SSE3_32_WIN-LABEL: f_to_s64:
415 ; SSE3_32_WIN: # %bb.0:
416 ; SSE3_32_WIN-NEXT: pushl %ebp
417 ; SSE3_32_WIN-NEXT: movl %esp, %ebp
418 ; SSE3_32_WIN-NEXT: andl $-8, %esp
419 ; SSE3_32_WIN-NEXT: subl $8, %esp
420 ; SSE3_32_WIN-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
421 ; SSE3_32_WIN-NEXT: movss %xmm0, (%esp)
422 ; SSE3_32_WIN-NEXT: flds (%esp)
423 ; SSE3_32_WIN-NEXT: fisttpll (%esp)
424 ; SSE3_32_WIN-NEXT: movl (%esp), %eax
425 ; SSE3_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
426 ; SSE3_32_WIN-NEXT: movl %ebp, %esp
427 ; SSE3_32_WIN-NEXT: popl %ebp
428 ; SSE3_32_WIN-NEXT: retl
430 ; SSE3_32_LIN-LABEL: f_to_s64:
431 ; SSE3_32_LIN: # %bb.0:
432 ; SSE3_32_LIN-NEXT: subl $12, %esp
433 ; SSE3_32_LIN-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
434 ; SSE3_32_LIN-NEXT: movss %xmm0, (%esp)
435 ; SSE3_32_LIN-NEXT: flds (%esp)
436 ; SSE3_32_LIN-NEXT: fisttpll (%esp)
437 ; SSE3_32_LIN-NEXT: movl (%esp), %eax
438 ; SSE3_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
439 ; SSE3_32_LIN-NEXT: addl $12, %esp
440 ; SSE3_32_LIN-NEXT: retl
442 ; SSE3_64-LABEL: f_to_s64:
444 ; SSE3_64-NEXT: cvttss2si %xmm0, %rax
447 ; SSE2_32_WIN-LABEL: f_to_s64:
448 ; SSE2_32_WIN: # %bb.0:
449 ; SSE2_32_WIN-NEXT: pushl %ebp
450 ; SSE2_32_WIN-NEXT: movl %esp, %ebp
451 ; SSE2_32_WIN-NEXT: andl $-8, %esp
452 ; SSE2_32_WIN-NEXT: subl $16, %esp
453 ; SSE2_32_WIN-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
454 ; SSE2_32_WIN-NEXT: movss %xmm0, {{[0-9]+}}(%esp)
455 ; SSE2_32_WIN-NEXT: flds {{[0-9]+}}(%esp)
456 ; SSE2_32_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
457 ; SSE2_32_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
458 ; SSE2_32_WIN-NEXT: orl $3072, %eax # imm = 0xC00
459 ; SSE2_32_WIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
460 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
461 ; SSE2_32_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
462 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
463 ; SSE2_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
464 ; SSE2_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
465 ; SSE2_32_WIN-NEXT: movl %ebp, %esp
466 ; SSE2_32_WIN-NEXT: popl %ebp
467 ; SSE2_32_WIN-NEXT: retl
469 ; SSE2_32_LIN-LABEL: f_to_s64:
470 ; SSE2_32_LIN: # %bb.0:
471 ; SSE2_32_LIN-NEXT: subl $20, %esp
472 ; SSE2_32_LIN-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
473 ; SSE2_32_LIN-NEXT: movss %xmm0, {{[0-9]+}}(%esp)
474 ; SSE2_32_LIN-NEXT: flds {{[0-9]+}}(%esp)
475 ; SSE2_32_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
476 ; SSE2_32_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
477 ; SSE2_32_LIN-NEXT: orl $3072, %eax # imm = 0xC00
478 ; SSE2_32_LIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
479 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
480 ; SSE2_32_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
481 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
482 ; SSE2_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
483 ; SSE2_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
484 ; SSE2_32_LIN-NEXT: addl $20, %esp
485 ; SSE2_32_LIN-NEXT: retl
487 ; SSE2_64-LABEL: f_to_s64:
489 ; SSE2_64-NEXT: cvttss2si %xmm0, %rax
492 ; X87_WIN-LABEL: f_to_s64:
494 ; X87_WIN-NEXT: pushl %ebp
495 ; X87_WIN-NEXT: movl %esp, %ebp
496 ; X87_WIN-NEXT: andl $-8, %esp
497 ; X87_WIN-NEXT: subl $16, %esp
498 ; X87_WIN-NEXT: flds 8(%ebp)
499 ; X87_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
500 ; X87_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
501 ; X87_WIN-NEXT: orl $3072, %eax # imm = 0xC00
502 ; X87_WIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
503 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
504 ; X87_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
505 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
506 ; X87_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
507 ; X87_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
508 ; X87_WIN-NEXT: movl %ebp, %esp
509 ; X87_WIN-NEXT: popl %ebp
512 ; X87_LIN-LABEL: f_to_s64:
514 ; X87_LIN-NEXT: subl $20, %esp
515 ; X87_LIN-NEXT: flds {{[0-9]+}}(%esp)
516 ; X87_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
517 ; X87_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
518 ; X87_LIN-NEXT: orl $3072, %eax # imm = 0xC00
519 ; X87_LIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
520 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
521 ; X87_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
522 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
523 ; X87_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
524 ; X87_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
525 ; X87_LIN-NEXT: addl $20, %esp
527 %r = fptosi float %a to i64
531 define i64 @d_to_u64(double %a) nounwind {
532 ; AVX512DQVL_32_WIN-LABEL: d_to_u64:
533 ; AVX512DQVL_32_WIN: # %bb.0:
534 ; AVX512DQVL_32_WIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
535 ; AVX512DQVL_32_WIN-NEXT: vcvttpd2uqq %ymm0, %ymm0
536 ; AVX512DQVL_32_WIN-NEXT: vmovd %xmm0, %eax
537 ; AVX512DQVL_32_WIN-NEXT: vpextrd $1, %xmm0, %edx
538 ; AVX512DQVL_32_WIN-NEXT: vzeroupper
539 ; AVX512DQVL_32_WIN-NEXT: retl
541 ; AVX512DQVL_32_LIN-LABEL: d_to_u64:
542 ; AVX512DQVL_32_LIN: # %bb.0:
543 ; AVX512DQVL_32_LIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
544 ; AVX512DQVL_32_LIN-NEXT: vcvttpd2uqq %ymm0, %ymm0
545 ; AVX512DQVL_32_LIN-NEXT: vmovd %xmm0, %eax
546 ; AVX512DQVL_32_LIN-NEXT: vpextrd $1, %xmm0, %edx
547 ; AVX512DQVL_32_LIN-NEXT: vzeroupper
548 ; AVX512DQVL_32_LIN-NEXT: retl
550 ; AVX512_64-LABEL: d_to_u64:
551 ; AVX512_64: # %bb.0:
552 ; AVX512_64-NEXT: vcvttsd2usi %xmm0, %rax
553 ; AVX512_64-NEXT: retq
555 ; AVX512DQ_32_WIN-LABEL: d_to_u64:
556 ; AVX512DQ_32_WIN: # %bb.0:
557 ; AVX512DQ_32_WIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
558 ; AVX512DQ_32_WIN-NEXT: vcvttpd2uqq %zmm0, %zmm0
559 ; AVX512DQ_32_WIN-NEXT: vmovd %xmm0, %eax
560 ; AVX512DQ_32_WIN-NEXT: vpextrd $1, %xmm0, %edx
561 ; AVX512DQ_32_WIN-NEXT: vzeroupper
562 ; AVX512DQ_32_WIN-NEXT: retl
564 ; AVX512DQ_32_LIN-LABEL: d_to_u64:
565 ; AVX512DQ_32_LIN: # %bb.0:
566 ; AVX512DQ_32_LIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
567 ; AVX512DQ_32_LIN-NEXT: vcvttpd2uqq %zmm0, %zmm0
568 ; AVX512DQ_32_LIN-NEXT: vmovd %xmm0, %eax
569 ; AVX512DQ_32_LIN-NEXT: vpextrd $1, %xmm0, %edx
570 ; AVX512DQ_32_LIN-NEXT: vzeroupper
571 ; AVX512DQ_32_LIN-NEXT: retl
573 ; AVX512F_32_WIN-LABEL: d_to_u64:
574 ; AVX512F_32_WIN: # %bb.0:
575 ; AVX512F_32_WIN-NEXT: pushl %ebp
576 ; AVX512F_32_WIN-NEXT: movl %esp, %ebp
577 ; AVX512F_32_WIN-NEXT: andl $-8, %esp
578 ; AVX512F_32_WIN-NEXT: subl $8, %esp
579 ; AVX512F_32_WIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
580 ; AVX512F_32_WIN-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
581 ; AVX512F_32_WIN-NEXT: vcmpltsd %xmm1, %xmm0, %k1
582 ; AVX512F_32_WIN-NEXT: vsubsd %xmm1, %xmm0, %xmm2
583 ; AVX512F_32_WIN-NEXT: vmovsd %xmm0, %xmm0, %xmm2 {%k1}
584 ; AVX512F_32_WIN-NEXT: vmovsd %xmm2, (%esp)
585 ; AVX512F_32_WIN-NEXT: fldl (%esp)
586 ; AVX512F_32_WIN-NEXT: fisttpll (%esp)
587 ; AVX512F_32_WIN-NEXT: xorl %edx, %edx
588 ; AVX512F_32_WIN-NEXT: vucomisd %xmm0, %xmm1
589 ; AVX512F_32_WIN-NEXT: setbe %dl
590 ; AVX512F_32_WIN-NEXT: shll $31, %edx
591 ; AVX512F_32_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
592 ; AVX512F_32_WIN-NEXT: movl (%esp), %eax
593 ; AVX512F_32_WIN-NEXT: movl %ebp, %esp
594 ; AVX512F_32_WIN-NEXT: popl %ebp
595 ; AVX512F_32_WIN-NEXT: retl
597 ; AVX512F_32_LIN-LABEL: d_to_u64:
598 ; AVX512F_32_LIN: # %bb.0:
599 ; AVX512F_32_LIN-NEXT: subl $12, %esp
600 ; AVX512F_32_LIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
601 ; AVX512F_32_LIN-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
602 ; AVX512F_32_LIN-NEXT: vcmpltsd %xmm1, %xmm0, %k1
603 ; AVX512F_32_LIN-NEXT: vsubsd %xmm1, %xmm0, %xmm2
604 ; AVX512F_32_LIN-NEXT: vmovsd %xmm0, %xmm0, %xmm2 {%k1}
605 ; AVX512F_32_LIN-NEXT: vmovsd %xmm2, (%esp)
606 ; AVX512F_32_LIN-NEXT: fldl (%esp)
607 ; AVX512F_32_LIN-NEXT: fisttpll (%esp)
608 ; AVX512F_32_LIN-NEXT: xorl %edx, %edx
609 ; AVX512F_32_LIN-NEXT: vucomisd %xmm0, %xmm1
610 ; AVX512F_32_LIN-NEXT: setbe %dl
611 ; AVX512F_32_LIN-NEXT: shll $31, %edx
612 ; AVX512F_32_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
613 ; AVX512F_32_LIN-NEXT: movl (%esp), %eax
614 ; AVX512F_32_LIN-NEXT: addl $12, %esp
615 ; AVX512F_32_LIN-NEXT: retl
617 ; SSE3_32_WIN-LABEL: d_to_u64:
618 ; SSE3_32_WIN: # %bb.0:
619 ; SSE3_32_WIN-NEXT: pushl %ebp
620 ; SSE3_32_WIN-NEXT: movl %esp, %ebp
621 ; SSE3_32_WIN-NEXT: andl $-8, %esp
622 ; SSE3_32_WIN-NEXT: subl $8, %esp
623 ; SSE3_32_WIN-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
624 ; SSE3_32_WIN-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
625 ; SSE3_32_WIN-NEXT: movapd %xmm0, %xmm2
626 ; SSE3_32_WIN-NEXT: cmpltsd %xmm1, %xmm2
627 ; SSE3_32_WIN-NEXT: movapd %xmm2, %xmm3
628 ; SSE3_32_WIN-NEXT: andpd %xmm0, %xmm2
629 ; SSE3_32_WIN-NEXT: xorl %edx, %edx
630 ; SSE3_32_WIN-NEXT: ucomisd %xmm0, %xmm1
631 ; SSE3_32_WIN-NEXT: subsd %xmm1, %xmm0
632 ; SSE3_32_WIN-NEXT: andnpd %xmm0, %xmm3
633 ; SSE3_32_WIN-NEXT: orpd %xmm3, %xmm2
634 ; SSE3_32_WIN-NEXT: movlpd %xmm2, (%esp)
635 ; SSE3_32_WIN-NEXT: fldl (%esp)
636 ; SSE3_32_WIN-NEXT: fisttpll (%esp)
637 ; SSE3_32_WIN-NEXT: setbe %dl
638 ; SSE3_32_WIN-NEXT: shll $31, %edx
639 ; SSE3_32_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
640 ; SSE3_32_WIN-NEXT: movl (%esp), %eax
641 ; SSE3_32_WIN-NEXT: movl %ebp, %esp
642 ; SSE3_32_WIN-NEXT: popl %ebp
643 ; SSE3_32_WIN-NEXT: retl
645 ; SSE3_32_LIN-LABEL: d_to_u64:
646 ; SSE3_32_LIN: # %bb.0:
647 ; SSE3_32_LIN-NEXT: subl $12, %esp
648 ; SSE3_32_LIN-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
649 ; SSE3_32_LIN-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
650 ; SSE3_32_LIN-NEXT: movapd %xmm0, %xmm2
651 ; SSE3_32_LIN-NEXT: cmpltsd %xmm1, %xmm2
652 ; SSE3_32_LIN-NEXT: movapd %xmm2, %xmm3
653 ; SSE3_32_LIN-NEXT: andpd %xmm0, %xmm2
654 ; SSE3_32_LIN-NEXT: xorl %edx, %edx
655 ; SSE3_32_LIN-NEXT: ucomisd %xmm0, %xmm1
656 ; SSE3_32_LIN-NEXT: subsd %xmm1, %xmm0
657 ; SSE3_32_LIN-NEXT: andnpd %xmm0, %xmm3
658 ; SSE3_32_LIN-NEXT: orpd %xmm3, %xmm2
659 ; SSE3_32_LIN-NEXT: movlpd %xmm2, (%esp)
660 ; SSE3_32_LIN-NEXT: fldl (%esp)
661 ; SSE3_32_LIN-NEXT: fisttpll (%esp)
662 ; SSE3_32_LIN-NEXT: setbe %dl
663 ; SSE3_32_LIN-NEXT: shll $31, %edx
664 ; SSE3_32_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
665 ; SSE3_32_LIN-NEXT: movl (%esp), %eax
666 ; SSE3_32_LIN-NEXT: addl $12, %esp
667 ; SSE3_32_LIN-NEXT: retl
669 ; SSE3_64-LABEL: d_to_u64:
671 ; SSE3_64-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
672 ; SSE3_64-NEXT: movapd %xmm0, %xmm2
673 ; SSE3_64-NEXT: subsd %xmm1, %xmm2
674 ; SSE3_64-NEXT: cvttsd2si %xmm2, %rax
675 ; SSE3_64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000
676 ; SSE3_64-NEXT: xorq %rax, %rcx
677 ; SSE3_64-NEXT: cvttsd2si %xmm0, %rax
678 ; SSE3_64-NEXT: ucomisd %xmm1, %xmm0
679 ; SSE3_64-NEXT: cmovaeq %rcx, %rax
682 ; SSE2_32_WIN-LABEL: d_to_u64:
683 ; SSE2_32_WIN: # %bb.0:
684 ; SSE2_32_WIN-NEXT: pushl %ebp
685 ; SSE2_32_WIN-NEXT: movl %esp, %ebp
686 ; SSE2_32_WIN-NEXT: andl $-8, %esp
687 ; SSE2_32_WIN-NEXT: subl $16, %esp
688 ; SSE2_32_WIN-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
689 ; SSE2_32_WIN-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
690 ; SSE2_32_WIN-NEXT: movapd %xmm0, %xmm2
691 ; SSE2_32_WIN-NEXT: subsd %xmm1, %xmm2
692 ; SSE2_32_WIN-NEXT: movapd %xmm0, %xmm3
693 ; SSE2_32_WIN-NEXT: cmpltsd %xmm1, %xmm3
694 ; SSE2_32_WIN-NEXT: movapd %xmm3, %xmm4
695 ; SSE2_32_WIN-NEXT: andnpd %xmm2, %xmm4
696 ; SSE2_32_WIN-NEXT: andpd %xmm0, %xmm3
697 ; SSE2_32_WIN-NEXT: orpd %xmm4, %xmm3
698 ; SSE2_32_WIN-NEXT: movlpd %xmm3, {{[0-9]+}}(%esp)
699 ; SSE2_32_WIN-NEXT: fldl {{[0-9]+}}(%esp)
700 ; SSE2_32_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
701 ; SSE2_32_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
702 ; SSE2_32_WIN-NEXT: orl $3072, %eax # imm = 0xC00
703 ; SSE2_32_WIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
704 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
705 ; SSE2_32_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
706 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
707 ; SSE2_32_WIN-NEXT: xorl %edx, %edx
708 ; SSE2_32_WIN-NEXT: ucomisd %xmm0, %xmm1
709 ; SSE2_32_WIN-NEXT: setbe %dl
710 ; SSE2_32_WIN-NEXT: shll $31, %edx
711 ; SSE2_32_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
712 ; SSE2_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
713 ; SSE2_32_WIN-NEXT: movl %ebp, %esp
714 ; SSE2_32_WIN-NEXT: popl %ebp
715 ; SSE2_32_WIN-NEXT: retl
717 ; SSE2_32_LIN-LABEL: d_to_u64:
718 ; SSE2_32_LIN: # %bb.0:
719 ; SSE2_32_LIN-NEXT: subl $20, %esp
720 ; SSE2_32_LIN-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
721 ; SSE2_32_LIN-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
722 ; SSE2_32_LIN-NEXT: movapd %xmm0, %xmm2
723 ; SSE2_32_LIN-NEXT: subsd %xmm1, %xmm2
724 ; SSE2_32_LIN-NEXT: movapd %xmm0, %xmm3
725 ; SSE2_32_LIN-NEXT: cmpltsd %xmm1, %xmm3
726 ; SSE2_32_LIN-NEXT: movapd %xmm3, %xmm4
727 ; SSE2_32_LIN-NEXT: andnpd %xmm2, %xmm4
728 ; SSE2_32_LIN-NEXT: andpd %xmm0, %xmm3
729 ; SSE2_32_LIN-NEXT: orpd %xmm4, %xmm3
730 ; SSE2_32_LIN-NEXT: movlpd %xmm3, {{[0-9]+}}(%esp)
731 ; SSE2_32_LIN-NEXT: fldl {{[0-9]+}}(%esp)
732 ; SSE2_32_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
733 ; SSE2_32_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
734 ; SSE2_32_LIN-NEXT: orl $3072, %eax # imm = 0xC00
735 ; SSE2_32_LIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
736 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
737 ; SSE2_32_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
738 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
739 ; SSE2_32_LIN-NEXT: xorl %edx, %edx
740 ; SSE2_32_LIN-NEXT: ucomisd %xmm0, %xmm1
741 ; SSE2_32_LIN-NEXT: setbe %dl
742 ; SSE2_32_LIN-NEXT: shll $31, %edx
743 ; SSE2_32_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
744 ; SSE2_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
745 ; SSE2_32_LIN-NEXT: addl $20, %esp
746 ; SSE2_32_LIN-NEXT: retl
748 ; SSE2_64-LABEL: d_to_u64:
750 ; SSE2_64-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
751 ; SSE2_64-NEXT: movapd %xmm0, %xmm2
752 ; SSE2_64-NEXT: subsd %xmm1, %xmm2
753 ; SSE2_64-NEXT: cvttsd2si %xmm2, %rax
754 ; SSE2_64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000
755 ; SSE2_64-NEXT: xorq %rax, %rcx
756 ; SSE2_64-NEXT: cvttsd2si %xmm0, %rax
757 ; SSE2_64-NEXT: ucomisd %xmm1, %xmm0
758 ; SSE2_64-NEXT: cmovaeq %rcx, %rax
761 ; X87_WIN-LABEL: d_to_u64:
763 ; X87_WIN-NEXT: pushl %ebp
764 ; X87_WIN-NEXT: movl %esp, %ebp
765 ; X87_WIN-NEXT: andl $-8, %esp
766 ; X87_WIN-NEXT: subl $16, %esp
767 ; X87_WIN-NEXT: fldl 8(%ebp)
768 ; X87_WIN-NEXT: flds __real@5f000000
769 ; X87_WIN-NEXT: fld %st(1)
770 ; X87_WIN-NEXT: fsub %st(1), %st
771 ; X87_WIN-NEXT: fxch %st(1)
772 ; X87_WIN-NEXT: fucomp %st(2)
773 ; X87_WIN-NEXT: fnstsw %ax
774 ; X87_WIN-NEXT: # kill: def $ah killed $ah killed $ax
776 ; X87_WIN-NEXT: ja LBB2_2
777 ; X87_WIN-NEXT: # %bb.1:
778 ; X87_WIN-NEXT: fstp %st(1)
780 ; X87_WIN-NEXT: LBB2_2:
781 ; X87_WIN-NEXT: fstp %st(0)
782 ; X87_WIN-NEXT: setbe %al
783 ; X87_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
784 ; X87_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
785 ; X87_WIN-NEXT: orl $3072, %ecx # imm = 0xC00
786 ; X87_WIN-NEXT: movw %cx, {{[0-9]+}}(%esp)
787 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
788 ; X87_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
789 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
790 ; X87_WIN-NEXT: movzbl %al, %edx
791 ; X87_WIN-NEXT: shll $31, %edx
792 ; X87_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
793 ; X87_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
794 ; X87_WIN-NEXT: movl %ebp, %esp
795 ; X87_WIN-NEXT: popl %ebp
798 ; X87_LIN-LABEL: d_to_u64:
800 ; X87_LIN-NEXT: subl $20, %esp
801 ; X87_LIN-NEXT: fldl {{[0-9]+}}(%esp)
802 ; X87_LIN-NEXT: flds {{\.LCPI.*}}
803 ; X87_LIN-NEXT: fld %st(1)
804 ; X87_LIN-NEXT: fsub %st(1), %st
805 ; X87_LIN-NEXT: fxch %st(1)
806 ; X87_LIN-NEXT: fucomp %st(2)
807 ; X87_LIN-NEXT: fnstsw %ax
808 ; X87_LIN-NEXT: # kill: def $ah killed $ah killed $ax
810 ; X87_LIN-NEXT: ja .LBB2_2
811 ; X87_LIN-NEXT: # %bb.1:
812 ; X87_LIN-NEXT: fstp %st(1)
814 ; X87_LIN-NEXT: .LBB2_2:
815 ; X87_LIN-NEXT: fstp %st(0)
816 ; X87_LIN-NEXT: setbe %al
817 ; X87_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
818 ; X87_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
819 ; X87_LIN-NEXT: orl $3072, %ecx # imm = 0xC00
820 ; X87_LIN-NEXT: movw %cx, {{[0-9]+}}(%esp)
821 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
822 ; X87_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
823 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
824 ; X87_LIN-NEXT: movzbl %al, %edx
825 ; X87_LIN-NEXT: shll $31, %edx
826 ; X87_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
827 ; X87_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
828 ; X87_LIN-NEXT: addl $20, %esp
830 %r = fptoui double %a to i64
834 define i64 @d_to_s64(double %a) nounwind {
835 ; AVX512DQVL_32_WIN-LABEL: d_to_s64:
836 ; AVX512DQVL_32_WIN: # %bb.0:
837 ; AVX512DQVL_32_WIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
838 ; AVX512DQVL_32_WIN-NEXT: vcvttpd2qq %ymm0, %ymm0
839 ; AVX512DQVL_32_WIN-NEXT: vmovd %xmm0, %eax
840 ; AVX512DQVL_32_WIN-NEXT: vpextrd $1, %xmm0, %edx
841 ; AVX512DQVL_32_WIN-NEXT: vzeroupper
842 ; AVX512DQVL_32_WIN-NEXT: retl
844 ; AVX512DQVL_32_LIN-LABEL: d_to_s64:
845 ; AVX512DQVL_32_LIN: # %bb.0:
846 ; AVX512DQVL_32_LIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
847 ; AVX512DQVL_32_LIN-NEXT: vcvttpd2qq %ymm0, %ymm0
848 ; AVX512DQVL_32_LIN-NEXT: vmovd %xmm0, %eax
849 ; AVX512DQVL_32_LIN-NEXT: vpextrd $1, %xmm0, %edx
850 ; AVX512DQVL_32_LIN-NEXT: vzeroupper
851 ; AVX512DQVL_32_LIN-NEXT: retl
853 ; AVX512_64-LABEL: d_to_s64:
854 ; AVX512_64: # %bb.0:
855 ; AVX512_64-NEXT: vcvttsd2si %xmm0, %rax
856 ; AVX512_64-NEXT: retq
858 ; AVX512DQ_32_WIN-LABEL: d_to_s64:
859 ; AVX512DQ_32_WIN: # %bb.0:
860 ; AVX512DQ_32_WIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
861 ; AVX512DQ_32_WIN-NEXT: vcvttpd2qq %zmm0, %zmm0
862 ; AVX512DQ_32_WIN-NEXT: vmovd %xmm0, %eax
863 ; AVX512DQ_32_WIN-NEXT: vpextrd $1, %xmm0, %edx
864 ; AVX512DQ_32_WIN-NEXT: vzeroupper
865 ; AVX512DQ_32_WIN-NEXT: retl
867 ; AVX512DQ_32_LIN-LABEL: d_to_s64:
868 ; AVX512DQ_32_LIN: # %bb.0:
869 ; AVX512DQ_32_LIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
870 ; AVX512DQ_32_LIN-NEXT: vcvttpd2qq %zmm0, %zmm0
871 ; AVX512DQ_32_LIN-NEXT: vmovd %xmm0, %eax
872 ; AVX512DQ_32_LIN-NEXT: vpextrd $1, %xmm0, %edx
873 ; AVX512DQ_32_LIN-NEXT: vzeroupper
874 ; AVX512DQ_32_LIN-NEXT: retl
876 ; AVX512F_32_WIN-LABEL: d_to_s64:
877 ; AVX512F_32_WIN: # %bb.0:
878 ; AVX512F_32_WIN-NEXT: pushl %ebp
879 ; AVX512F_32_WIN-NEXT: movl %esp, %ebp
880 ; AVX512F_32_WIN-NEXT: andl $-8, %esp
881 ; AVX512F_32_WIN-NEXT: subl $8, %esp
882 ; AVX512F_32_WIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
883 ; AVX512F_32_WIN-NEXT: vmovsd %xmm0, (%esp)
884 ; AVX512F_32_WIN-NEXT: fldl (%esp)
885 ; AVX512F_32_WIN-NEXT: fisttpll (%esp)
886 ; AVX512F_32_WIN-NEXT: movl (%esp), %eax
887 ; AVX512F_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
888 ; AVX512F_32_WIN-NEXT: movl %ebp, %esp
889 ; AVX512F_32_WIN-NEXT: popl %ebp
890 ; AVX512F_32_WIN-NEXT: retl
892 ; AVX512F_32_LIN-LABEL: d_to_s64:
893 ; AVX512F_32_LIN: # %bb.0:
894 ; AVX512F_32_LIN-NEXT: subl $12, %esp
895 ; AVX512F_32_LIN-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
896 ; AVX512F_32_LIN-NEXT: vmovsd %xmm0, (%esp)
897 ; AVX512F_32_LIN-NEXT: fldl (%esp)
898 ; AVX512F_32_LIN-NEXT: fisttpll (%esp)
899 ; AVX512F_32_LIN-NEXT: movl (%esp), %eax
900 ; AVX512F_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
901 ; AVX512F_32_LIN-NEXT: addl $12, %esp
902 ; AVX512F_32_LIN-NEXT: retl
904 ; SSE3_32_WIN-LABEL: d_to_s64:
905 ; SSE3_32_WIN: # %bb.0:
906 ; SSE3_32_WIN-NEXT: pushl %ebp
907 ; SSE3_32_WIN-NEXT: movl %esp, %ebp
908 ; SSE3_32_WIN-NEXT: andl $-8, %esp
909 ; SSE3_32_WIN-NEXT: subl $8, %esp
910 ; SSE3_32_WIN-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
911 ; SSE3_32_WIN-NEXT: movsd %xmm0, (%esp)
912 ; SSE3_32_WIN-NEXT: fldl (%esp)
913 ; SSE3_32_WIN-NEXT: fisttpll (%esp)
914 ; SSE3_32_WIN-NEXT: movl (%esp), %eax
915 ; SSE3_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
916 ; SSE3_32_WIN-NEXT: movl %ebp, %esp
917 ; SSE3_32_WIN-NEXT: popl %ebp
918 ; SSE3_32_WIN-NEXT: retl
920 ; SSE3_32_LIN-LABEL: d_to_s64:
921 ; SSE3_32_LIN: # %bb.0:
922 ; SSE3_32_LIN-NEXT: subl $12, %esp
923 ; SSE3_32_LIN-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
924 ; SSE3_32_LIN-NEXT: movsd %xmm0, (%esp)
925 ; SSE3_32_LIN-NEXT: fldl (%esp)
926 ; SSE3_32_LIN-NEXT: fisttpll (%esp)
927 ; SSE3_32_LIN-NEXT: movl (%esp), %eax
928 ; SSE3_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
929 ; SSE3_32_LIN-NEXT: addl $12, %esp
930 ; SSE3_32_LIN-NEXT: retl
932 ; SSE3_64-LABEL: d_to_s64:
934 ; SSE3_64-NEXT: cvttsd2si %xmm0, %rax
937 ; SSE2_32_WIN-LABEL: d_to_s64:
938 ; SSE2_32_WIN: # %bb.0:
939 ; SSE2_32_WIN-NEXT: pushl %ebp
940 ; SSE2_32_WIN-NEXT: movl %esp, %ebp
941 ; SSE2_32_WIN-NEXT: andl $-8, %esp
942 ; SSE2_32_WIN-NEXT: subl $16, %esp
943 ; SSE2_32_WIN-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
944 ; SSE2_32_WIN-NEXT: movsd %xmm0, {{[0-9]+}}(%esp)
945 ; SSE2_32_WIN-NEXT: fldl {{[0-9]+}}(%esp)
946 ; SSE2_32_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
947 ; SSE2_32_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
948 ; SSE2_32_WIN-NEXT: orl $3072, %eax # imm = 0xC00
949 ; SSE2_32_WIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
950 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
951 ; SSE2_32_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
952 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
953 ; SSE2_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
954 ; SSE2_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
955 ; SSE2_32_WIN-NEXT: movl %ebp, %esp
956 ; SSE2_32_WIN-NEXT: popl %ebp
957 ; SSE2_32_WIN-NEXT: retl
959 ; SSE2_32_LIN-LABEL: d_to_s64:
960 ; SSE2_32_LIN: # %bb.0:
961 ; SSE2_32_LIN-NEXT: subl $20, %esp
962 ; SSE2_32_LIN-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
963 ; SSE2_32_LIN-NEXT: movsd %xmm0, {{[0-9]+}}(%esp)
964 ; SSE2_32_LIN-NEXT: fldl {{[0-9]+}}(%esp)
965 ; SSE2_32_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
966 ; SSE2_32_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
967 ; SSE2_32_LIN-NEXT: orl $3072, %eax # imm = 0xC00
968 ; SSE2_32_LIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
969 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
970 ; SSE2_32_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
971 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
972 ; SSE2_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
973 ; SSE2_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
974 ; SSE2_32_LIN-NEXT: addl $20, %esp
975 ; SSE2_32_LIN-NEXT: retl
977 ; SSE2_64-LABEL: d_to_s64:
979 ; SSE2_64-NEXT: cvttsd2si %xmm0, %rax
982 ; X87_WIN-LABEL: d_to_s64:
984 ; X87_WIN-NEXT: pushl %ebp
985 ; X87_WIN-NEXT: movl %esp, %ebp
986 ; X87_WIN-NEXT: andl $-8, %esp
987 ; X87_WIN-NEXT: subl $16, %esp
988 ; X87_WIN-NEXT: fldl 8(%ebp)
989 ; X87_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
990 ; X87_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
991 ; X87_WIN-NEXT: orl $3072, %eax # imm = 0xC00
992 ; X87_WIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
993 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
994 ; X87_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
995 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
996 ; X87_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
997 ; X87_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
998 ; X87_WIN-NEXT: movl %ebp, %esp
999 ; X87_WIN-NEXT: popl %ebp
1000 ; X87_WIN-NEXT: retl
1002 ; X87_LIN-LABEL: d_to_s64:
1004 ; X87_LIN-NEXT: subl $20, %esp
1005 ; X87_LIN-NEXT: fldl {{[0-9]+}}(%esp)
1006 ; X87_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
1007 ; X87_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1008 ; X87_LIN-NEXT: orl $3072, %eax # imm = 0xC00
1009 ; X87_LIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
1010 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1011 ; X87_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
1012 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1013 ; X87_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
1014 ; X87_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
1015 ; X87_LIN-NEXT: addl $20, %esp
1016 ; X87_LIN-NEXT: retl
1017 %r = fptosi double %a to i64
1021 define i64 @x_to_u64(x86_fp80 %a) nounwind {
1022 ; AVX512_32_WIN-LABEL: x_to_u64:
1023 ; AVX512_32_WIN: # %bb.0:
1024 ; AVX512_32_WIN-NEXT: pushl %ebp
1025 ; AVX512_32_WIN-NEXT: movl %esp, %ebp
1026 ; AVX512_32_WIN-NEXT: andl $-8, %esp
1027 ; AVX512_32_WIN-NEXT: subl $8, %esp
1028 ; AVX512_32_WIN-NEXT: fldt 8(%ebp)
1029 ; AVX512_32_WIN-NEXT: flds __real@5f000000
1030 ; AVX512_32_WIN-NEXT: fld %st(1)
1031 ; AVX512_32_WIN-NEXT: fsub %st(1), %st
1032 ; AVX512_32_WIN-NEXT: xorl %edx, %edx
1033 ; AVX512_32_WIN-NEXT: fxch %st(1)
1034 ; AVX512_32_WIN-NEXT: fucompi %st(2), %st
1035 ; AVX512_32_WIN-NEXT: fcmovnbe %st(1), %st
1036 ; AVX512_32_WIN-NEXT: fstp %st(1)
1037 ; AVX512_32_WIN-NEXT: fisttpll (%esp)
1038 ; AVX512_32_WIN-NEXT: setbe %dl
1039 ; AVX512_32_WIN-NEXT: shll $31, %edx
1040 ; AVX512_32_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
1041 ; AVX512_32_WIN-NEXT: movl (%esp), %eax
1042 ; AVX512_32_WIN-NEXT: movl %ebp, %esp
1043 ; AVX512_32_WIN-NEXT: popl %ebp
1044 ; AVX512_32_WIN-NEXT: retl
1046 ; AVX512_32_LIN-LABEL: x_to_u64:
1047 ; AVX512_32_LIN: # %bb.0:
1048 ; AVX512_32_LIN-NEXT: subl $12, %esp
1049 ; AVX512_32_LIN-NEXT: fldt {{[0-9]+}}(%esp)
1050 ; AVX512_32_LIN-NEXT: flds {{\.LCPI.*}}
1051 ; AVX512_32_LIN-NEXT: fld %st(1)
1052 ; AVX512_32_LIN-NEXT: fsub %st(1), %st
1053 ; AVX512_32_LIN-NEXT: xorl %edx, %edx
1054 ; AVX512_32_LIN-NEXT: fxch %st(1)
1055 ; AVX512_32_LIN-NEXT: fucompi %st(2), %st
1056 ; AVX512_32_LIN-NEXT: fcmovnbe %st(1), %st
1057 ; AVX512_32_LIN-NEXT: fstp %st(1)
1058 ; AVX512_32_LIN-NEXT: fisttpll (%esp)
1059 ; AVX512_32_LIN-NEXT: setbe %dl
1060 ; AVX512_32_LIN-NEXT: shll $31, %edx
1061 ; AVX512_32_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
1062 ; AVX512_32_LIN-NEXT: movl (%esp), %eax
1063 ; AVX512_32_LIN-NEXT: addl $12, %esp
1064 ; AVX512_32_LIN-NEXT: retl
1066 ; AVX512_64_WIN-LABEL: x_to_u64:
1067 ; AVX512_64_WIN: # %bb.0:
1068 ; AVX512_64_WIN-NEXT: pushq %rax
1069 ; AVX512_64_WIN-NEXT: fldt (%rcx)
1070 ; AVX512_64_WIN-NEXT: flds __real@{{.*}}(%rip)
1071 ; AVX512_64_WIN-NEXT: fld %st(1)
1072 ; AVX512_64_WIN-NEXT: fsub %st(1), %st
1073 ; AVX512_64_WIN-NEXT: xorl %eax, %eax
1074 ; AVX512_64_WIN-NEXT: fxch %st(1)
1075 ; AVX512_64_WIN-NEXT: fucompi %st(2), %st
1076 ; AVX512_64_WIN-NEXT: fcmovnbe %st(1), %st
1077 ; AVX512_64_WIN-NEXT: fstp %st(1)
1078 ; AVX512_64_WIN-NEXT: fisttpll (%rsp)
1079 ; AVX512_64_WIN-NEXT: setbe %al
1080 ; AVX512_64_WIN-NEXT: shlq $63, %rax
1081 ; AVX512_64_WIN-NEXT: xorq (%rsp), %rax
1082 ; AVX512_64_WIN-NEXT: popq %rcx
1083 ; AVX512_64_WIN-NEXT: retq
1085 ; AVX512_64_LIN-LABEL: x_to_u64:
1086 ; AVX512_64_LIN: # %bb.0:
1087 ; AVX512_64_LIN-NEXT: fldt {{[0-9]+}}(%rsp)
1088 ; AVX512_64_LIN-NEXT: flds {{.*}}(%rip)
1089 ; AVX512_64_LIN-NEXT: fld %st(1)
1090 ; AVX512_64_LIN-NEXT: fsub %st(1), %st
1091 ; AVX512_64_LIN-NEXT: xorl %eax, %eax
1092 ; AVX512_64_LIN-NEXT: fxch %st(1)
1093 ; AVX512_64_LIN-NEXT: fucompi %st(2), %st
1094 ; AVX512_64_LIN-NEXT: fcmovnbe %st(1), %st
1095 ; AVX512_64_LIN-NEXT: fstp %st(1)
1096 ; AVX512_64_LIN-NEXT: fisttpll -{{[0-9]+}}(%rsp)
1097 ; AVX512_64_LIN-NEXT: setbe %al
1098 ; AVX512_64_LIN-NEXT: shlq $63, %rax
1099 ; AVX512_64_LIN-NEXT: xorq -{{[0-9]+}}(%rsp), %rax
1100 ; AVX512_64_LIN-NEXT: retq
1102 ; SSE3_32_WIN-LABEL: x_to_u64:
1103 ; SSE3_32_WIN: # %bb.0:
1104 ; SSE3_32_WIN-NEXT: pushl %ebp
1105 ; SSE3_32_WIN-NEXT: movl %esp, %ebp
1106 ; SSE3_32_WIN-NEXT: andl $-8, %esp
1107 ; SSE3_32_WIN-NEXT: subl $8, %esp
1108 ; SSE3_32_WIN-NEXT: fldt 8(%ebp)
1109 ; SSE3_32_WIN-NEXT: flds __real@5f000000
1110 ; SSE3_32_WIN-NEXT: fld %st(1)
1111 ; SSE3_32_WIN-NEXT: fsub %st(1), %st
1112 ; SSE3_32_WIN-NEXT: xorl %edx, %edx
1113 ; SSE3_32_WIN-NEXT: fxch %st(1)
1114 ; SSE3_32_WIN-NEXT: fucompi %st(2), %st
1115 ; SSE3_32_WIN-NEXT: fcmovnbe %st(1), %st
1116 ; SSE3_32_WIN-NEXT: fstp %st(1)
1117 ; SSE3_32_WIN-NEXT: fisttpll (%esp)
1118 ; SSE3_32_WIN-NEXT: setbe %dl
1119 ; SSE3_32_WIN-NEXT: shll $31, %edx
1120 ; SSE3_32_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
1121 ; SSE3_32_WIN-NEXT: movl (%esp), %eax
1122 ; SSE3_32_WIN-NEXT: movl %ebp, %esp
1123 ; SSE3_32_WIN-NEXT: popl %ebp
1124 ; SSE3_32_WIN-NEXT: retl
1126 ; SSE3_32_LIN-LABEL: x_to_u64:
1127 ; SSE3_32_LIN: # %bb.0:
1128 ; SSE3_32_LIN-NEXT: subl $12, %esp
1129 ; SSE3_32_LIN-NEXT: fldt {{[0-9]+}}(%esp)
1130 ; SSE3_32_LIN-NEXT: flds {{\.LCPI.*}}
1131 ; SSE3_32_LIN-NEXT: fld %st(1)
1132 ; SSE3_32_LIN-NEXT: fsub %st(1), %st
1133 ; SSE3_32_LIN-NEXT: xorl %edx, %edx
1134 ; SSE3_32_LIN-NEXT: fxch %st(1)
1135 ; SSE3_32_LIN-NEXT: fucompi %st(2), %st
1136 ; SSE3_32_LIN-NEXT: fcmovnbe %st(1), %st
1137 ; SSE3_32_LIN-NEXT: fstp %st(1)
1138 ; SSE3_32_LIN-NEXT: fisttpll (%esp)
1139 ; SSE3_32_LIN-NEXT: setbe %dl
1140 ; SSE3_32_LIN-NEXT: shll $31, %edx
1141 ; SSE3_32_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
1142 ; SSE3_32_LIN-NEXT: movl (%esp), %eax
1143 ; SSE3_32_LIN-NEXT: addl $12, %esp
1144 ; SSE3_32_LIN-NEXT: retl
1146 ; SSE3_64_WIN-LABEL: x_to_u64:
1147 ; SSE3_64_WIN: # %bb.0:
1148 ; SSE3_64_WIN-NEXT: pushq %rax
1149 ; SSE3_64_WIN-NEXT: fldt (%rcx)
1150 ; SSE3_64_WIN-NEXT: flds __real@{{.*}}(%rip)
1151 ; SSE3_64_WIN-NEXT: fld %st(1)
1152 ; SSE3_64_WIN-NEXT: fsub %st(1), %st
1153 ; SSE3_64_WIN-NEXT: xorl %eax, %eax
1154 ; SSE3_64_WIN-NEXT: fxch %st(1)
1155 ; SSE3_64_WIN-NEXT: fucompi %st(2), %st
1156 ; SSE3_64_WIN-NEXT: fcmovnbe %st(1), %st
1157 ; SSE3_64_WIN-NEXT: fstp %st(1)
1158 ; SSE3_64_WIN-NEXT: fisttpll (%rsp)
1159 ; SSE3_64_WIN-NEXT: setbe %al
1160 ; SSE3_64_WIN-NEXT: shlq $63, %rax
1161 ; SSE3_64_WIN-NEXT: xorq (%rsp), %rax
1162 ; SSE3_64_WIN-NEXT: popq %rcx
1163 ; SSE3_64_WIN-NEXT: retq
1165 ; SSE3_64_LIN-LABEL: x_to_u64:
1166 ; SSE3_64_LIN: # %bb.0:
1167 ; SSE3_64_LIN-NEXT: fldt {{[0-9]+}}(%rsp)
1168 ; SSE3_64_LIN-NEXT: flds {{.*}}(%rip)
1169 ; SSE3_64_LIN-NEXT: fld %st(1)
1170 ; SSE3_64_LIN-NEXT: fsub %st(1), %st
1171 ; SSE3_64_LIN-NEXT: xorl %eax, %eax
1172 ; SSE3_64_LIN-NEXT: fxch %st(1)
1173 ; SSE3_64_LIN-NEXT: fucompi %st(2), %st
1174 ; SSE3_64_LIN-NEXT: fcmovnbe %st(1), %st
1175 ; SSE3_64_LIN-NEXT: fstp %st(1)
1176 ; SSE3_64_LIN-NEXT: fisttpll -{{[0-9]+}}(%rsp)
1177 ; SSE3_64_LIN-NEXT: setbe %al
1178 ; SSE3_64_LIN-NEXT: shlq $63, %rax
1179 ; SSE3_64_LIN-NEXT: xorq -{{[0-9]+}}(%rsp), %rax
1180 ; SSE3_64_LIN-NEXT: retq
1182 ; SSE2_32_WIN-LABEL: x_to_u64:
1183 ; SSE2_32_WIN: # %bb.0:
1184 ; SSE2_32_WIN-NEXT: pushl %ebp
1185 ; SSE2_32_WIN-NEXT: movl %esp, %ebp
1186 ; SSE2_32_WIN-NEXT: andl $-8, %esp
1187 ; SSE2_32_WIN-NEXT: subl $16, %esp
1188 ; SSE2_32_WIN-NEXT: fldt 8(%ebp)
1189 ; SSE2_32_WIN-NEXT: flds __real@5f000000
1190 ; SSE2_32_WIN-NEXT: fld %st(1)
1191 ; SSE2_32_WIN-NEXT: fsub %st(1), %st
1192 ; SSE2_32_WIN-NEXT: xorl %edx, %edx
1193 ; SSE2_32_WIN-NEXT: fxch %st(1)
1194 ; SSE2_32_WIN-NEXT: fucompi %st(2), %st
1195 ; SSE2_32_WIN-NEXT: fcmovnbe %st(1), %st
1196 ; SSE2_32_WIN-NEXT: fstp %st(1)
1197 ; SSE2_32_WIN-NEXT: setbe %dl
1198 ; SSE2_32_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
1199 ; SSE2_32_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1200 ; SSE2_32_WIN-NEXT: orl $3072, %eax # imm = 0xC00
1201 ; SSE2_32_WIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
1202 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
1203 ; SSE2_32_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
1204 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
1205 ; SSE2_32_WIN-NEXT: shll $31, %edx
1206 ; SSE2_32_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
1207 ; SSE2_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
1208 ; SSE2_32_WIN-NEXT: movl %ebp, %esp
1209 ; SSE2_32_WIN-NEXT: popl %ebp
1210 ; SSE2_32_WIN-NEXT: retl
1212 ; SSE2_32_LIN-LABEL: x_to_u64:
1213 ; SSE2_32_LIN: # %bb.0:
1214 ; SSE2_32_LIN-NEXT: subl $20, %esp
1215 ; SSE2_32_LIN-NEXT: fldt {{[0-9]+}}(%esp)
1216 ; SSE2_32_LIN-NEXT: flds {{\.LCPI.*}}
1217 ; SSE2_32_LIN-NEXT: fld %st(1)
1218 ; SSE2_32_LIN-NEXT: fsub %st(1), %st
1219 ; SSE2_32_LIN-NEXT: xorl %edx, %edx
1220 ; SSE2_32_LIN-NEXT: fxch %st(1)
1221 ; SSE2_32_LIN-NEXT: fucompi %st(2), %st
1222 ; SSE2_32_LIN-NEXT: fcmovnbe %st(1), %st
1223 ; SSE2_32_LIN-NEXT: fstp %st(1)
1224 ; SSE2_32_LIN-NEXT: setbe %dl
1225 ; SSE2_32_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
1226 ; SSE2_32_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1227 ; SSE2_32_LIN-NEXT: orl $3072, %eax # imm = 0xC00
1228 ; SSE2_32_LIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
1229 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1230 ; SSE2_32_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
1231 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1232 ; SSE2_32_LIN-NEXT: shll $31, %edx
1233 ; SSE2_32_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
1234 ; SSE2_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
1235 ; SSE2_32_LIN-NEXT: addl $20, %esp
1236 ; SSE2_32_LIN-NEXT: retl
1238 ; SSE2_64_WIN-LABEL: x_to_u64:
1239 ; SSE2_64_WIN: # %bb.0:
1240 ; SSE2_64_WIN-NEXT: subq $16, %rsp
1241 ; SSE2_64_WIN-NEXT: fldt (%rcx)
1242 ; SSE2_64_WIN-NEXT: flds __real@{{.*}}(%rip)
1243 ; SSE2_64_WIN-NEXT: fld %st(1)
1244 ; SSE2_64_WIN-NEXT: fsub %st(1), %st
1245 ; SSE2_64_WIN-NEXT: xorl %eax, %eax
1246 ; SSE2_64_WIN-NEXT: fxch %st(1)
1247 ; SSE2_64_WIN-NEXT: fucompi %st(2), %st
1248 ; SSE2_64_WIN-NEXT: fcmovnbe %st(1), %st
1249 ; SSE2_64_WIN-NEXT: fstp %st(1)
1250 ; SSE2_64_WIN-NEXT: setbe %al
1251 ; SSE2_64_WIN-NEXT: fnstcw {{[0-9]+}}(%rsp)
1252 ; SSE2_64_WIN-NEXT: movzwl {{[0-9]+}}(%rsp), %ecx
1253 ; SSE2_64_WIN-NEXT: orl $3072, %ecx # imm = 0xC00
1254 ; SSE2_64_WIN-NEXT: movw %cx, {{[0-9]+}}(%rsp)
1255 ; SSE2_64_WIN-NEXT: fldcw {{[0-9]+}}(%rsp)
1256 ; SSE2_64_WIN-NEXT: fistpll {{[0-9]+}}(%rsp)
1257 ; SSE2_64_WIN-NEXT: fldcw {{[0-9]+}}(%rsp)
1258 ; SSE2_64_WIN-NEXT: shlq $63, %rax
1259 ; SSE2_64_WIN-NEXT: xorq {{[0-9]+}}(%rsp), %rax
1260 ; SSE2_64_WIN-NEXT: addq $16, %rsp
1261 ; SSE2_64_WIN-NEXT: retq
1263 ; SSE2_64_LIN-LABEL: x_to_u64:
1264 ; SSE2_64_LIN: # %bb.0:
1265 ; SSE2_64_LIN-NEXT: fldt {{[0-9]+}}(%rsp)
1266 ; SSE2_64_LIN-NEXT: flds {{.*}}(%rip)
1267 ; SSE2_64_LIN-NEXT: fld %st(1)
1268 ; SSE2_64_LIN-NEXT: fsub %st(1), %st
1269 ; SSE2_64_LIN-NEXT: xorl %eax, %eax
1270 ; SSE2_64_LIN-NEXT: fxch %st(1)
1271 ; SSE2_64_LIN-NEXT: fucompi %st(2), %st
1272 ; SSE2_64_LIN-NEXT: fcmovnbe %st(1), %st
1273 ; SSE2_64_LIN-NEXT: fstp %st(1)
1274 ; SSE2_64_LIN-NEXT: setbe %al
1275 ; SSE2_64_LIN-NEXT: fnstcw -{{[0-9]+}}(%rsp)
1276 ; SSE2_64_LIN-NEXT: movzwl -{{[0-9]+}}(%rsp), %ecx
1277 ; SSE2_64_LIN-NEXT: orl $3072, %ecx # imm = 0xC00
1278 ; SSE2_64_LIN-NEXT: movw %cx, -{{[0-9]+}}(%rsp)
1279 ; SSE2_64_LIN-NEXT: fldcw -{{[0-9]+}}(%rsp)
1280 ; SSE2_64_LIN-NEXT: fistpll -{{[0-9]+}}(%rsp)
1281 ; SSE2_64_LIN-NEXT: fldcw -{{[0-9]+}}(%rsp)
1282 ; SSE2_64_LIN-NEXT: shlq $63, %rax
1283 ; SSE2_64_LIN-NEXT: xorq -{{[0-9]+}}(%rsp), %rax
1284 ; SSE2_64_LIN-NEXT: retq
1286 ; X87_WIN-LABEL: x_to_u64:
1288 ; X87_WIN-NEXT: pushl %ebp
1289 ; X87_WIN-NEXT: movl %esp, %ebp
1290 ; X87_WIN-NEXT: andl $-8, %esp
1291 ; X87_WIN-NEXT: subl $16, %esp
1292 ; X87_WIN-NEXT: fldt 8(%ebp)
1293 ; X87_WIN-NEXT: flds __real@5f000000
1294 ; X87_WIN-NEXT: fld %st(1)
1295 ; X87_WIN-NEXT: fsub %st(1), %st
1296 ; X87_WIN-NEXT: fxch %st(1)
1297 ; X87_WIN-NEXT: fucomp %st(2)
1298 ; X87_WIN-NEXT: fnstsw %ax
1299 ; X87_WIN-NEXT: # kill: def $ah killed $ah killed $ax
1300 ; X87_WIN-NEXT: sahf
1301 ; X87_WIN-NEXT: ja LBB4_2
1302 ; X87_WIN-NEXT: # %bb.1:
1303 ; X87_WIN-NEXT: fstp %st(1)
1304 ; X87_WIN-NEXT: fldz
1305 ; X87_WIN-NEXT: LBB4_2:
1306 ; X87_WIN-NEXT: fstp %st(0)
1307 ; X87_WIN-NEXT: setbe %al
1308 ; X87_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
1309 ; X87_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
1310 ; X87_WIN-NEXT: orl $3072, %ecx # imm = 0xC00
1311 ; X87_WIN-NEXT: movw %cx, {{[0-9]+}}(%esp)
1312 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
1313 ; X87_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
1314 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
1315 ; X87_WIN-NEXT: movzbl %al, %edx
1316 ; X87_WIN-NEXT: shll $31, %edx
1317 ; X87_WIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
1318 ; X87_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
1319 ; X87_WIN-NEXT: movl %ebp, %esp
1320 ; X87_WIN-NEXT: popl %ebp
1321 ; X87_WIN-NEXT: retl
1323 ; X87_LIN-LABEL: x_to_u64:
1325 ; X87_LIN-NEXT: subl $20, %esp
1326 ; X87_LIN-NEXT: fldt {{[0-9]+}}(%esp)
1327 ; X87_LIN-NEXT: flds {{\.LCPI.*}}
1328 ; X87_LIN-NEXT: fld %st(1)
1329 ; X87_LIN-NEXT: fsub %st(1), %st
1330 ; X87_LIN-NEXT: fxch %st(1)
1331 ; X87_LIN-NEXT: fucomp %st(2)
1332 ; X87_LIN-NEXT: fnstsw %ax
1333 ; X87_LIN-NEXT: # kill: def $ah killed $ah killed $ax
1334 ; X87_LIN-NEXT: sahf
1335 ; X87_LIN-NEXT: ja .LBB4_2
1336 ; X87_LIN-NEXT: # %bb.1:
1337 ; X87_LIN-NEXT: fstp %st(1)
1338 ; X87_LIN-NEXT: fldz
1339 ; X87_LIN-NEXT: .LBB4_2:
1340 ; X87_LIN-NEXT: fstp %st(0)
1341 ; X87_LIN-NEXT: setbe %al
1342 ; X87_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
1343 ; X87_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
1344 ; X87_LIN-NEXT: orl $3072, %ecx # imm = 0xC00
1345 ; X87_LIN-NEXT: movw %cx, {{[0-9]+}}(%esp)
1346 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1347 ; X87_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
1348 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1349 ; X87_LIN-NEXT: movzbl %al, %edx
1350 ; X87_LIN-NEXT: shll $31, %edx
1351 ; X87_LIN-NEXT: xorl {{[0-9]+}}(%esp), %edx
1352 ; X87_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
1353 ; X87_LIN-NEXT: addl $20, %esp
1354 ; X87_LIN-NEXT: retl
1355 %r = fptoui x86_fp80 %a to i64
1359 define i64 @x_to_s64(x86_fp80 %a) nounwind {
1360 ; AVX512_32_WIN-LABEL: x_to_s64:
1361 ; AVX512_32_WIN: # %bb.0:
1362 ; AVX512_32_WIN-NEXT: pushl %ebp
1363 ; AVX512_32_WIN-NEXT: movl %esp, %ebp
1364 ; AVX512_32_WIN-NEXT: andl $-8, %esp
1365 ; AVX512_32_WIN-NEXT: subl $8, %esp
1366 ; AVX512_32_WIN-NEXT: fldt 8(%ebp)
1367 ; AVX512_32_WIN-NEXT: fisttpll (%esp)
1368 ; AVX512_32_WIN-NEXT: movl (%esp), %eax
1369 ; AVX512_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
1370 ; AVX512_32_WIN-NEXT: movl %ebp, %esp
1371 ; AVX512_32_WIN-NEXT: popl %ebp
1372 ; AVX512_32_WIN-NEXT: retl
1374 ; AVX512_32_LIN-LABEL: x_to_s64:
1375 ; AVX512_32_LIN: # %bb.0:
1376 ; AVX512_32_LIN-NEXT: subl $12, %esp
1377 ; AVX512_32_LIN-NEXT: fldt {{[0-9]+}}(%esp)
1378 ; AVX512_32_LIN-NEXT: fisttpll (%esp)
1379 ; AVX512_32_LIN-NEXT: movl (%esp), %eax
1380 ; AVX512_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
1381 ; AVX512_32_LIN-NEXT: addl $12, %esp
1382 ; AVX512_32_LIN-NEXT: retl
1384 ; AVX512_64_WIN-LABEL: x_to_s64:
1385 ; AVX512_64_WIN: # %bb.0:
1386 ; AVX512_64_WIN-NEXT: pushq %rax
1387 ; AVX512_64_WIN-NEXT: fldt (%rcx)
1388 ; AVX512_64_WIN-NEXT: fisttpll (%rsp)
1389 ; AVX512_64_WIN-NEXT: movq (%rsp), %rax
1390 ; AVX512_64_WIN-NEXT: popq %rcx
1391 ; AVX512_64_WIN-NEXT: retq
1393 ; AVX512_64_LIN-LABEL: x_to_s64:
1394 ; AVX512_64_LIN: # %bb.0:
1395 ; AVX512_64_LIN-NEXT: fldt {{[0-9]+}}(%rsp)
1396 ; AVX512_64_LIN-NEXT: fisttpll -{{[0-9]+}}(%rsp)
1397 ; AVX512_64_LIN-NEXT: movq -{{[0-9]+}}(%rsp), %rax
1398 ; AVX512_64_LIN-NEXT: retq
1400 ; SSE3_32_WIN-LABEL: x_to_s64:
1401 ; SSE3_32_WIN: # %bb.0:
1402 ; SSE3_32_WIN-NEXT: pushl %ebp
1403 ; SSE3_32_WIN-NEXT: movl %esp, %ebp
1404 ; SSE3_32_WIN-NEXT: andl $-8, %esp
1405 ; SSE3_32_WIN-NEXT: subl $8, %esp
1406 ; SSE3_32_WIN-NEXT: fldt 8(%ebp)
1407 ; SSE3_32_WIN-NEXT: fisttpll (%esp)
1408 ; SSE3_32_WIN-NEXT: movl (%esp), %eax
1409 ; SSE3_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
1410 ; SSE3_32_WIN-NEXT: movl %ebp, %esp
1411 ; SSE3_32_WIN-NEXT: popl %ebp
1412 ; SSE3_32_WIN-NEXT: retl
1414 ; SSE3_32_LIN-LABEL: x_to_s64:
1415 ; SSE3_32_LIN: # %bb.0:
1416 ; SSE3_32_LIN-NEXT: subl $12, %esp
1417 ; SSE3_32_LIN-NEXT: fldt {{[0-9]+}}(%esp)
1418 ; SSE3_32_LIN-NEXT: fisttpll (%esp)
1419 ; SSE3_32_LIN-NEXT: movl (%esp), %eax
1420 ; SSE3_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
1421 ; SSE3_32_LIN-NEXT: addl $12, %esp
1422 ; SSE3_32_LIN-NEXT: retl
1424 ; SSE3_64_WIN-LABEL: x_to_s64:
1425 ; SSE3_64_WIN: # %bb.0:
1426 ; SSE3_64_WIN-NEXT: pushq %rax
1427 ; SSE3_64_WIN-NEXT: fldt (%rcx)
1428 ; SSE3_64_WIN-NEXT: fisttpll (%rsp)
1429 ; SSE3_64_WIN-NEXT: movq (%rsp), %rax
1430 ; SSE3_64_WIN-NEXT: popq %rcx
1431 ; SSE3_64_WIN-NEXT: retq
1433 ; SSE3_64_LIN-LABEL: x_to_s64:
1434 ; SSE3_64_LIN: # %bb.0:
1435 ; SSE3_64_LIN-NEXT: fldt {{[0-9]+}}(%rsp)
1436 ; SSE3_64_LIN-NEXT: fisttpll -{{[0-9]+}}(%rsp)
1437 ; SSE3_64_LIN-NEXT: movq -{{[0-9]+}}(%rsp), %rax
1438 ; SSE3_64_LIN-NEXT: retq
1440 ; SSE2_32_WIN-LABEL: x_to_s64:
1441 ; SSE2_32_WIN: # %bb.0:
1442 ; SSE2_32_WIN-NEXT: pushl %ebp
1443 ; SSE2_32_WIN-NEXT: movl %esp, %ebp
1444 ; SSE2_32_WIN-NEXT: andl $-8, %esp
1445 ; SSE2_32_WIN-NEXT: subl $16, %esp
1446 ; SSE2_32_WIN-NEXT: fldt 8(%ebp)
1447 ; SSE2_32_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
1448 ; SSE2_32_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1449 ; SSE2_32_WIN-NEXT: orl $3072, %eax # imm = 0xC00
1450 ; SSE2_32_WIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
1451 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
1452 ; SSE2_32_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
1453 ; SSE2_32_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
1454 ; SSE2_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
1455 ; SSE2_32_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
1456 ; SSE2_32_WIN-NEXT: movl %ebp, %esp
1457 ; SSE2_32_WIN-NEXT: popl %ebp
1458 ; SSE2_32_WIN-NEXT: retl
1460 ; SSE2_32_LIN-LABEL: x_to_s64:
1461 ; SSE2_32_LIN: # %bb.0:
1462 ; SSE2_32_LIN-NEXT: subl $20, %esp
1463 ; SSE2_32_LIN-NEXT: fldt {{[0-9]+}}(%esp)
1464 ; SSE2_32_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
1465 ; SSE2_32_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1466 ; SSE2_32_LIN-NEXT: orl $3072, %eax # imm = 0xC00
1467 ; SSE2_32_LIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
1468 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1469 ; SSE2_32_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
1470 ; SSE2_32_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1471 ; SSE2_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
1472 ; SSE2_32_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
1473 ; SSE2_32_LIN-NEXT: addl $20, %esp
1474 ; SSE2_32_LIN-NEXT: retl
1476 ; SSE2_64_WIN-LABEL: x_to_s64:
1477 ; SSE2_64_WIN: # %bb.0:
1478 ; SSE2_64_WIN-NEXT: subq $16, %rsp
1479 ; SSE2_64_WIN-NEXT: fldt (%rcx)
1480 ; SSE2_64_WIN-NEXT: fnstcw {{[0-9]+}}(%rsp)
1481 ; SSE2_64_WIN-NEXT: movzwl {{[0-9]+}}(%rsp), %eax
1482 ; SSE2_64_WIN-NEXT: orl $3072, %eax # imm = 0xC00
1483 ; SSE2_64_WIN-NEXT: movw %ax, {{[0-9]+}}(%rsp)
1484 ; SSE2_64_WIN-NEXT: fldcw {{[0-9]+}}(%rsp)
1485 ; SSE2_64_WIN-NEXT: fistpll {{[0-9]+}}(%rsp)
1486 ; SSE2_64_WIN-NEXT: fldcw {{[0-9]+}}(%rsp)
1487 ; SSE2_64_WIN-NEXT: movq {{[0-9]+}}(%rsp), %rax
1488 ; SSE2_64_WIN-NEXT: addq $16, %rsp
1489 ; SSE2_64_WIN-NEXT: retq
1491 ; SSE2_64_LIN-LABEL: x_to_s64:
1492 ; SSE2_64_LIN: # %bb.0:
1493 ; SSE2_64_LIN-NEXT: fldt {{[0-9]+}}(%rsp)
1494 ; SSE2_64_LIN-NEXT: fnstcw -{{[0-9]+}}(%rsp)
1495 ; SSE2_64_LIN-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
1496 ; SSE2_64_LIN-NEXT: orl $3072, %eax # imm = 0xC00
1497 ; SSE2_64_LIN-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
1498 ; SSE2_64_LIN-NEXT: fldcw -{{[0-9]+}}(%rsp)
1499 ; SSE2_64_LIN-NEXT: fistpll -{{[0-9]+}}(%rsp)
1500 ; SSE2_64_LIN-NEXT: fldcw -{{[0-9]+}}(%rsp)
1501 ; SSE2_64_LIN-NEXT: movq -{{[0-9]+}}(%rsp), %rax
1502 ; SSE2_64_LIN-NEXT: retq
1504 ; X87_WIN-LABEL: x_to_s64:
1506 ; X87_WIN-NEXT: pushl %ebp
1507 ; X87_WIN-NEXT: movl %esp, %ebp
1508 ; X87_WIN-NEXT: andl $-8, %esp
1509 ; X87_WIN-NEXT: subl $16, %esp
1510 ; X87_WIN-NEXT: fldt 8(%ebp)
1511 ; X87_WIN-NEXT: fnstcw {{[0-9]+}}(%esp)
1512 ; X87_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1513 ; X87_WIN-NEXT: orl $3072, %eax # imm = 0xC00
1514 ; X87_WIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
1515 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
1516 ; X87_WIN-NEXT: fistpll {{[0-9]+}}(%esp)
1517 ; X87_WIN-NEXT: fldcw {{[0-9]+}}(%esp)
1518 ; X87_WIN-NEXT: movl {{[0-9]+}}(%esp), %eax
1519 ; X87_WIN-NEXT: movl {{[0-9]+}}(%esp), %edx
1520 ; X87_WIN-NEXT: movl %ebp, %esp
1521 ; X87_WIN-NEXT: popl %ebp
1522 ; X87_WIN-NEXT: retl
1524 ; X87_LIN-LABEL: x_to_s64:
1526 ; X87_LIN-NEXT: subl $20, %esp
1527 ; X87_LIN-NEXT: fldt {{[0-9]+}}(%esp)
1528 ; X87_LIN-NEXT: fnstcw {{[0-9]+}}(%esp)
1529 ; X87_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1530 ; X87_LIN-NEXT: orl $3072, %eax # imm = 0xC00
1531 ; X87_LIN-NEXT: movw %ax, {{[0-9]+}}(%esp)
1532 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1533 ; X87_LIN-NEXT: fistpll {{[0-9]+}}(%esp)
1534 ; X87_LIN-NEXT: fldcw {{[0-9]+}}(%esp)
1535 ; X87_LIN-NEXT: movl {{[0-9]+}}(%esp), %eax
1536 ; X87_LIN-NEXT: movl {{[0-9]+}}(%esp), %edx
1537 ; X87_LIN-NEXT: addl $20, %esp
1538 ; X87_LIN-NEXT: retl
1539 %r = fptosi x86_fp80 %a to i64
1543 define i64 @t_to_u64(fp128 %a) nounwind {
1544 ; AVX512_32_WIN-LABEL: t_to_u64:
1545 ; AVX512_32_WIN: # %bb.0:
1546 ; AVX512_32_WIN-NEXT: subl $16, %esp
1547 ; AVX512_32_WIN-NEXT: vmovups {{[0-9]+}}(%esp), %xmm0
1548 ; AVX512_32_WIN-NEXT: vmovups %xmm0, (%esp)
1549 ; AVX512_32_WIN-NEXT: calll ___fixunstfdi
1550 ; AVX512_32_WIN-NEXT: addl $16, %esp
1551 ; AVX512_32_WIN-NEXT: retl
1553 ; AVX512_32_LIN-LABEL: t_to_u64:
1554 ; AVX512_32_LIN: # %bb.0:
1555 ; AVX512_32_LIN-NEXT: subl $28, %esp
1556 ; AVX512_32_LIN-NEXT: vmovaps {{[0-9]+}}(%esp), %xmm0
1557 ; AVX512_32_LIN-NEXT: vmovups %xmm0, (%esp)
1558 ; AVX512_32_LIN-NEXT: calll __fixunstfdi
1559 ; AVX512_32_LIN-NEXT: addl $28, %esp
1560 ; AVX512_32_LIN-NEXT: retl
1562 ; AVX512_64_WIN-LABEL: t_to_u64:
1563 ; AVX512_64_WIN: # %bb.0:
1564 ; AVX512_64_WIN-NEXT: subq $40, %rsp
1565 ; AVX512_64_WIN-NEXT: callq __fixunstfdi
1566 ; AVX512_64_WIN-NEXT: addq $40, %rsp
1567 ; AVX512_64_WIN-NEXT: retq
1569 ; AVX512_64_LIN-LABEL: t_to_u64:
1570 ; AVX512_64_LIN: # %bb.0:
1571 ; AVX512_64_LIN-NEXT: pushq %rax
1572 ; AVX512_64_LIN-NEXT: callq __fixunstfdi
1573 ; AVX512_64_LIN-NEXT: popq %rcx
1574 ; AVX512_64_LIN-NEXT: retq
1576 ; SSE3_32_WIN-LABEL: t_to_u64:
1577 ; SSE3_32_WIN: # %bb.0:
1578 ; SSE3_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1579 ; SSE3_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1580 ; SSE3_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1581 ; SSE3_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1582 ; SSE3_32_WIN-NEXT: calll ___fixunstfdi
1583 ; SSE3_32_WIN-NEXT: addl $16, %esp
1584 ; SSE3_32_WIN-NEXT: retl
1586 ; SSE3_32_LIN-LABEL: t_to_u64:
1587 ; SSE3_32_LIN: # %bb.0:
1588 ; SSE3_32_LIN-NEXT: subl $12, %esp
1589 ; SSE3_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1590 ; SSE3_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1591 ; SSE3_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1592 ; SSE3_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1593 ; SSE3_32_LIN-NEXT: calll __fixunstfdi
1594 ; SSE3_32_LIN-NEXT: addl $28, %esp
1595 ; SSE3_32_LIN-NEXT: retl
1597 ; SSE3_64_WIN-LABEL: t_to_u64:
1598 ; SSE3_64_WIN: # %bb.0:
1599 ; SSE3_64_WIN-NEXT: subq $40, %rsp
1600 ; SSE3_64_WIN-NEXT: callq __fixunstfdi
1601 ; SSE3_64_WIN-NEXT: addq $40, %rsp
1602 ; SSE3_64_WIN-NEXT: retq
1604 ; SSE3_64_LIN-LABEL: t_to_u64:
1605 ; SSE3_64_LIN: # %bb.0:
1606 ; SSE3_64_LIN-NEXT: pushq %rax
1607 ; SSE3_64_LIN-NEXT: callq __fixunstfdi
1608 ; SSE3_64_LIN-NEXT: popq %rcx
1609 ; SSE3_64_LIN-NEXT: retq
1611 ; SSE2_32_WIN-LABEL: t_to_u64:
1612 ; SSE2_32_WIN: # %bb.0:
1613 ; SSE2_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1614 ; SSE2_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1615 ; SSE2_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1616 ; SSE2_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1617 ; SSE2_32_WIN-NEXT: calll ___fixunstfdi
1618 ; SSE2_32_WIN-NEXT: addl $16, %esp
1619 ; SSE2_32_WIN-NEXT: retl
1621 ; SSE2_32_LIN-LABEL: t_to_u64:
1622 ; SSE2_32_LIN: # %bb.0:
1623 ; SSE2_32_LIN-NEXT: subl $12, %esp
1624 ; SSE2_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1625 ; SSE2_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1626 ; SSE2_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1627 ; SSE2_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1628 ; SSE2_32_LIN-NEXT: calll __fixunstfdi
1629 ; SSE2_32_LIN-NEXT: addl $28, %esp
1630 ; SSE2_32_LIN-NEXT: retl
1632 ; SSE2_64_WIN-LABEL: t_to_u64:
1633 ; SSE2_64_WIN: # %bb.0:
1634 ; SSE2_64_WIN-NEXT: subq $40, %rsp
1635 ; SSE2_64_WIN-NEXT: callq __fixunstfdi
1636 ; SSE2_64_WIN-NEXT: addq $40, %rsp
1637 ; SSE2_64_WIN-NEXT: retq
1639 ; SSE2_64_LIN-LABEL: t_to_u64:
1640 ; SSE2_64_LIN: # %bb.0:
1641 ; SSE2_64_LIN-NEXT: pushq %rax
1642 ; SSE2_64_LIN-NEXT: callq __fixunstfdi
1643 ; SSE2_64_LIN-NEXT: popq %rcx
1644 ; SSE2_64_LIN-NEXT: retq
1646 ; X87_WIN-LABEL: t_to_u64:
1648 ; X87_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1649 ; X87_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1650 ; X87_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1651 ; X87_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1652 ; X87_WIN-NEXT: calll ___fixunstfdi
1653 ; X87_WIN-NEXT: addl $16, %esp
1654 ; X87_WIN-NEXT: retl
1656 ; X87_LIN-LABEL: t_to_u64:
1658 ; X87_LIN-NEXT: subl $12, %esp
1659 ; X87_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1660 ; X87_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1661 ; X87_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1662 ; X87_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1663 ; X87_LIN-NEXT: calll __fixunstfdi
1664 ; X87_LIN-NEXT: addl $28, %esp
1665 ; X87_LIN-NEXT: retl
1666 %r = fptoui fp128 %a to i64
1670 define i64 @t_to_s64(fp128 %a) nounwind {
1671 ; AVX512_32_WIN-LABEL: t_to_s64:
1672 ; AVX512_32_WIN: # %bb.0:
1673 ; AVX512_32_WIN-NEXT: subl $16, %esp
1674 ; AVX512_32_WIN-NEXT: vmovups {{[0-9]+}}(%esp), %xmm0
1675 ; AVX512_32_WIN-NEXT: vmovups %xmm0, (%esp)
1676 ; AVX512_32_WIN-NEXT: calll ___fixtfdi
1677 ; AVX512_32_WIN-NEXT: addl $16, %esp
1678 ; AVX512_32_WIN-NEXT: retl
1680 ; AVX512_32_LIN-LABEL: t_to_s64:
1681 ; AVX512_32_LIN: # %bb.0:
1682 ; AVX512_32_LIN-NEXT: subl $28, %esp
1683 ; AVX512_32_LIN-NEXT: vmovaps {{[0-9]+}}(%esp), %xmm0
1684 ; AVX512_32_LIN-NEXT: vmovups %xmm0, (%esp)
1685 ; AVX512_32_LIN-NEXT: calll __fixtfdi
1686 ; AVX512_32_LIN-NEXT: addl $28, %esp
1687 ; AVX512_32_LIN-NEXT: retl
1689 ; AVX512_64_WIN-LABEL: t_to_s64:
1690 ; AVX512_64_WIN: # %bb.0:
1691 ; AVX512_64_WIN-NEXT: subq $40, %rsp
1692 ; AVX512_64_WIN-NEXT: callq __fixtfdi
1693 ; AVX512_64_WIN-NEXT: addq $40, %rsp
1694 ; AVX512_64_WIN-NEXT: retq
1696 ; AVX512_64_LIN-LABEL: t_to_s64:
1697 ; AVX512_64_LIN: # %bb.0:
1698 ; AVX512_64_LIN-NEXT: pushq %rax
1699 ; AVX512_64_LIN-NEXT: callq __fixtfdi
1700 ; AVX512_64_LIN-NEXT: popq %rcx
1701 ; AVX512_64_LIN-NEXT: retq
1703 ; SSE3_32_WIN-LABEL: t_to_s64:
1704 ; SSE3_32_WIN: # %bb.0:
1705 ; SSE3_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1706 ; SSE3_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1707 ; SSE3_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1708 ; SSE3_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1709 ; SSE3_32_WIN-NEXT: calll ___fixtfdi
1710 ; SSE3_32_WIN-NEXT: addl $16, %esp
1711 ; SSE3_32_WIN-NEXT: retl
1713 ; SSE3_32_LIN-LABEL: t_to_s64:
1714 ; SSE3_32_LIN: # %bb.0:
1715 ; SSE3_32_LIN-NEXT: subl $12, %esp
1716 ; SSE3_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1717 ; SSE3_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1718 ; SSE3_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1719 ; SSE3_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1720 ; SSE3_32_LIN-NEXT: calll __fixtfdi
1721 ; SSE3_32_LIN-NEXT: addl $28, %esp
1722 ; SSE3_32_LIN-NEXT: retl
1724 ; SSE3_64_WIN-LABEL: t_to_s64:
1725 ; SSE3_64_WIN: # %bb.0:
1726 ; SSE3_64_WIN-NEXT: subq $40, %rsp
1727 ; SSE3_64_WIN-NEXT: callq __fixtfdi
1728 ; SSE3_64_WIN-NEXT: addq $40, %rsp
1729 ; SSE3_64_WIN-NEXT: retq
1731 ; SSE3_64_LIN-LABEL: t_to_s64:
1732 ; SSE3_64_LIN: # %bb.0:
1733 ; SSE3_64_LIN-NEXT: pushq %rax
1734 ; SSE3_64_LIN-NEXT: callq __fixtfdi
1735 ; SSE3_64_LIN-NEXT: popq %rcx
1736 ; SSE3_64_LIN-NEXT: retq
1738 ; SSE2_32_WIN-LABEL: t_to_s64:
1739 ; SSE2_32_WIN: # %bb.0:
1740 ; SSE2_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1741 ; SSE2_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1742 ; SSE2_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1743 ; SSE2_32_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1744 ; SSE2_32_WIN-NEXT: calll ___fixtfdi
1745 ; SSE2_32_WIN-NEXT: addl $16, %esp
1746 ; SSE2_32_WIN-NEXT: retl
1748 ; SSE2_32_LIN-LABEL: t_to_s64:
1749 ; SSE2_32_LIN: # %bb.0:
1750 ; SSE2_32_LIN-NEXT: subl $12, %esp
1751 ; SSE2_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1752 ; SSE2_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1753 ; SSE2_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1754 ; SSE2_32_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1755 ; SSE2_32_LIN-NEXT: calll __fixtfdi
1756 ; SSE2_32_LIN-NEXT: addl $28, %esp
1757 ; SSE2_32_LIN-NEXT: retl
1759 ; SSE2_64_WIN-LABEL: t_to_s64:
1760 ; SSE2_64_WIN: # %bb.0:
1761 ; SSE2_64_WIN-NEXT: subq $40, %rsp
1762 ; SSE2_64_WIN-NEXT: callq __fixtfdi
1763 ; SSE2_64_WIN-NEXT: addq $40, %rsp
1764 ; SSE2_64_WIN-NEXT: retq
1766 ; SSE2_64_LIN-LABEL: t_to_s64:
1767 ; SSE2_64_LIN: # %bb.0:
1768 ; SSE2_64_LIN-NEXT: pushq %rax
1769 ; SSE2_64_LIN-NEXT: callq __fixtfdi
1770 ; SSE2_64_LIN-NEXT: popq %rcx
1771 ; SSE2_64_LIN-NEXT: retq
1773 ; X87_WIN-LABEL: t_to_s64:
1775 ; X87_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1776 ; X87_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1777 ; X87_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1778 ; X87_WIN-NEXT: pushl {{[0-9]+}}(%esp)
1779 ; X87_WIN-NEXT: calll ___fixtfdi
1780 ; X87_WIN-NEXT: addl $16, %esp
1781 ; X87_WIN-NEXT: retl
1783 ; X87_LIN-LABEL: t_to_s64:
1785 ; X87_LIN-NEXT: subl $12, %esp
1786 ; X87_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1787 ; X87_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1788 ; X87_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1789 ; X87_LIN-NEXT: pushl {{[0-9]+}}(%esp)
1790 ; X87_LIN-NEXT: calll __fixtfdi
1791 ; X87_LIN-NEXT: addl $28, %esp
1792 ; X87_LIN-NEXT: retl
1793 %r = fptosi fp128 %a to i64