1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-linux | FileCheck %s --check-prefix=X86-X87
3 ; RUN: llc < %s -mtriple=i686-linux -mattr=+sse2 | FileCheck %s --check-prefix=X86-SSE
4 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=X64
7 ; 32-bit float to unsigned integer
10 declare i1 @llvm.fptoui.sat.i1.f32 (float)
11 declare i8 @llvm.fptoui.sat.i8.f32 (float)
12 declare i13 @llvm.fptoui.sat.i13.f32 (float)
13 declare i16 @llvm.fptoui.sat.i16.f32 (float)
14 declare i19 @llvm.fptoui.sat.i19.f32 (float)
15 declare i32 @llvm.fptoui.sat.i32.f32 (float)
16 declare i50 @llvm.fptoui.sat.i50.f32 (float)
17 declare i64 @llvm.fptoui.sat.i64.f32 (float)
18 declare i100 @llvm.fptoui.sat.i100.f32(float)
19 declare i128 @llvm.fptoui.sat.i128.f32(float)
21 define i1 @test_unsigned_i1_f32(float %f) nounwind {
22 ; X86-X87-LABEL: test_unsigned_i1_f32:
24 ; X86-X87-NEXT: subl $8, %esp
25 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
26 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
27 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
28 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
29 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
30 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
31 ; X86-X87-NEXT: fists {{[0-9]+}}(%esp)
32 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
34 ; X86-X87-NEXT: fxch %st(1)
35 ; X86-X87-NEXT: fucom %st(1)
36 ; X86-X87-NEXT: fstp %st(1)
37 ; X86-X87-NEXT: fnstsw %ax
38 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
40 ; X86-X87-NEXT: jb .LBB0_1
41 ; X86-X87-NEXT: # %bb.2:
42 ; X86-X87-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
43 ; X86-X87-NEXT: jmp .LBB0_3
44 ; X86-X87-NEXT: .LBB0_1:
45 ; X86-X87-NEXT: xorl %ecx, %ecx
46 ; X86-X87-NEXT: .LBB0_3:
48 ; X86-X87-NEXT: fxch %st(1)
49 ; X86-X87-NEXT: fucompp
50 ; X86-X87-NEXT: fnstsw %ax
51 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
53 ; X86-X87-NEXT: movb $1, %al
54 ; X86-X87-NEXT: ja .LBB0_5
55 ; X86-X87-NEXT: # %bb.4:
56 ; X86-X87-NEXT: movl %ecx, %eax
57 ; X86-X87-NEXT: .LBB0_5:
58 ; X86-X87-NEXT: addl $8, %esp
61 ; X86-SSE-LABEL: test_unsigned_i1_f32:
63 ; X86-SSE-NEXT: xorps %xmm0, %xmm0
64 ; X86-SSE-NEXT: maxss {{[0-9]+}}(%esp), %xmm0
65 ; X86-SSE-NEXT: movss {{.*#+}} xmm1 = [1.0E+0,0.0E+0,0.0E+0,0.0E+0]
66 ; X86-SSE-NEXT: minss %xmm0, %xmm1
67 ; X86-SSE-NEXT: cvttss2si %xmm1, %eax
68 ; X86-SSE-NEXT: # kill: def $al killed $al killed $eax
71 ; X64-LABEL: test_unsigned_i1_f32:
73 ; X64-NEXT: xorps %xmm1, %xmm1
74 ; X64-NEXT: maxss %xmm0, %xmm1
75 ; X64-NEXT: movss {{.*#+}} xmm0 = [1.0E+0,0.0E+0,0.0E+0,0.0E+0]
76 ; X64-NEXT: minss %xmm1, %xmm0
77 ; X64-NEXT: cvttss2si %xmm0, %eax
78 ; X64-NEXT: # kill: def $al killed $al killed $eax
80 %x = call i1 @llvm.fptoui.sat.i1.f32(float %f)
84 define i8 @test_unsigned_i8_f32(float %f) nounwind {
85 ; X86-X87-LABEL: test_unsigned_i8_f32:
87 ; X86-X87-NEXT: subl $8, %esp
88 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
89 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
90 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
91 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
92 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
93 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
94 ; X86-X87-NEXT: fists {{[0-9]+}}(%esp)
95 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
97 ; X86-X87-NEXT: fxch %st(1)
98 ; X86-X87-NEXT: fucom %st(1)
99 ; X86-X87-NEXT: fstp %st(1)
100 ; X86-X87-NEXT: fnstsw %ax
101 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
103 ; X86-X87-NEXT: jb .LBB1_1
104 ; X86-X87-NEXT: # %bb.2:
105 ; X86-X87-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
106 ; X86-X87-NEXT: jmp .LBB1_3
107 ; X86-X87-NEXT: .LBB1_1:
108 ; X86-X87-NEXT: xorl %ecx, %ecx
109 ; X86-X87-NEXT: .LBB1_3:
110 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
111 ; X86-X87-NEXT: fxch %st(1)
112 ; X86-X87-NEXT: fucompp
113 ; X86-X87-NEXT: fnstsw %ax
114 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
116 ; X86-X87-NEXT: movb $-1, %al
117 ; X86-X87-NEXT: ja .LBB1_5
118 ; X86-X87-NEXT: # %bb.4:
119 ; X86-X87-NEXT: movl %ecx, %eax
120 ; X86-X87-NEXT: .LBB1_5:
121 ; X86-X87-NEXT: addl $8, %esp
124 ; X86-SSE-LABEL: test_unsigned_i8_f32:
126 ; X86-SSE-NEXT: xorps %xmm0, %xmm0
127 ; X86-SSE-NEXT: maxss {{[0-9]+}}(%esp), %xmm0
128 ; X86-SSE-NEXT: movss {{.*#+}} xmm1 = [2.55E+2,0.0E+0,0.0E+0,0.0E+0]
129 ; X86-SSE-NEXT: minss %xmm0, %xmm1
130 ; X86-SSE-NEXT: cvttss2si %xmm1, %eax
131 ; X86-SSE-NEXT: # kill: def $al killed $al killed $eax
134 ; X64-LABEL: test_unsigned_i8_f32:
136 ; X64-NEXT: xorps %xmm1, %xmm1
137 ; X64-NEXT: maxss %xmm0, %xmm1
138 ; X64-NEXT: movss {{.*#+}} xmm0 = [2.55E+2,0.0E+0,0.0E+0,0.0E+0]
139 ; X64-NEXT: minss %xmm1, %xmm0
140 ; X64-NEXT: cvttss2si %xmm0, %eax
141 ; X64-NEXT: # kill: def $al killed $al killed $eax
143 %x = call i8 @llvm.fptoui.sat.i8.f32(float %f)
147 define i13 @test_unsigned_i13_f32(float %f) nounwind {
148 ; X86-X87-LABEL: test_unsigned_i13_f32:
150 ; X86-X87-NEXT: subl $8, %esp
151 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
152 ; X86-X87-NEXT: fnstcw (%esp)
153 ; X86-X87-NEXT: movzwl (%esp), %eax
154 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
155 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
156 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
157 ; X86-X87-NEXT: fistl {{[0-9]+}}(%esp)
158 ; X86-X87-NEXT: fldcw (%esp)
160 ; X86-X87-NEXT: fxch %st(1)
161 ; X86-X87-NEXT: fucom %st(1)
162 ; X86-X87-NEXT: fstp %st(1)
163 ; X86-X87-NEXT: fnstsw %ax
164 ; X86-X87-NEXT: xorl %ecx, %ecx
165 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
167 ; X86-X87-NEXT: jb .LBB2_2
168 ; X86-X87-NEXT: # %bb.1:
169 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
170 ; X86-X87-NEXT: .LBB2_2:
171 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
172 ; X86-X87-NEXT: fxch %st(1)
173 ; X86-X87-NEXT: fucompp
174 ; X86-X87-NEXT: fnstsw %ax
175 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
177 ; X86-X87-NEXT: movl $8191, %eax # imm = 0x1FFF
178 ; X86-X87-NEXT: ja .LBB2_4
179 ; X86-X87-NEXT: # %bb.3:
180 ; X86-X87-NEXT: movl %ecx, %eax
181 ; X86-X87-NEXT: .LBB2_4:
182 ; X86-X87-NEXT: # kill: def $ax killed $ax killed $eax
183 ; X86-X87-NEXT: addl $8, %esp
186 ; X86-SSE-LABEL: test_unsigned_i13_f32:
188 ; X86-SSE-NEXT: xorps %xmm0, %xmm0
189 ; X86-SSE-NEXT: maxss {{[0-9]+}}(%esp), %xmm0
190 ; X86-SSE-NEXT: movss {{.*#+}} xmm1 = [8.191E+3,0.0E+0,0.0E+0,0.0E+0]
191 ; X86-SSE-NEXT: minss %xmm0, %xmm1
192 ; X86-SSE-NEXT: cvttss2si %xmm1, %eax
193 ; X86-SSE-NEXT: # kill: def $ax killed $ax killed $eax
196 ; X64-LABEL: test_unsigned_i13_f32:
198 ; X64-NEXT: xorps %xmm1, %xmm1
199 ; X64-NEXT: maxss %xmm0, %xmm1
200 ; X64-NEXT: movss {{.*#+}} xmm0 = [8.191E+3,0.0E+0,0.0E+0,0.0E+0]
201 ; X64-NEXT: minss %xmm1, %xmm0
202 ; X64-NEXT: cvttss2si %xmm0, %eax
203 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
205 %x = call i13 @llvm.fptoui.sat.i13.f32(float %f)
209 define i16 @test_unsigned_i16_f32(float %f) nounwind {
210 ; X86-X87-LABEL: test_unsigned_i16_f32:
212 ; X86-X87-NEXT: subl $8, %esp
213 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
214 ; X86-X87-NEXT: fnstcw (%esp)
215 ; X86-X87-NEXT: movzwl (%esp), %eax
216 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
217 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
218 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
219 ; X86-X87-NEXT: fistl {{[0-9]+}}(%esp)
220 ; X86-X87-NEXT: fldcw (%esp)
222 ; X86-X87-NEXT: fxch %st(1)
223 ; X86-X87-NEXT: fucom %st(1)
224 ; X86-X87-NEXT: fstp %st(1)
225 ; X86-X87-NEXT: fnstsw %ax
226 ; X86-X87-NEXT: xorl %ecx, %ecx
227 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
229 ; X86-X87-NEXT: jb .LBB3_2
230 ; X86-X87-NEXT: # %bb.1:
231 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
232 ; X86-X87-NEXT: .LBB3_2:
233 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
234 ; X86-X87-NEXT: fxch %st(1)
235 ; X86-X87-NEXT: fucompp
236 ; X86-X87-NEXT: fnstsw %ax
237 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
239 ; X86-X87-NEXT: movl $65535, %eax # imm = 0xFFFF
240 ; X86-X87-NEXT: ja .LBB3_4
241 ; X86-X87-NEXT: # %bb.3:
242 ; X86-X87-NEXT: movl %ecx, %eax
243 ; X86-X87-NEXT: .LBB3_4:
244 ; X86-X87-NEXT: # kill: def $ax killed $ax killed $eax
245 ; X86-X87-NEXT: addl $8, %esp
248 ; X86-SSE-LABEL: test_unsigned_i16_f32:
250 ; X86-SSE-NEXT: xorps %xmm0, %xmm0
251 ; X86-SSE-NEXT: maxss {{[0-9]+}}(%esp), %xmm0
252 ; X86-SSE-NEXT: movss {{.*#+}} xmm1 = [6.5535E+4,0.0E+0,0.0E+0,0.0E+0]
253 ; X86-SSE-NEXT: minss %xmm0, %xmm1
254 ; X86-SSE-NEXT: cvttss2si %xmm1, %eax
255 ; X86-SSE-NEXT: # kill: def $ax killed $ax killed $eax
258 ; X64-LABEL: test_unsigned_i16_f32:
260 ; X64-NEXT: xorps %xmm1, %xmm1
261 ; X64-NEXT: maxss %xmm0, %xmm1
262 ; X64-NEXT: movss {{.*#+}} xmm0 = [6.5535E+4,0.0E+0,0.0E+0,0.0E+0]
263 ; X64-NEXT: minss %xmm1, %xmm0
264 ; X64-NEXT: cvttss2si %xmm0, %eax
265 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
267 %x = call i16 @llvm.fptoui.sat.i16.f32(float %f)
271 define i19 @test_unsigned_i19_f32(float %f) nounwind {
272 ; X86-X87-LABEL: test_unsigned_i19_f32:
274 ; X86-X87-NEXT: subl $20, %esp
275 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
276 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
277 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
278 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
279 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
280 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
281 ; X86-X87-NEXT: fld %st(0)
282 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
283 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
285 ; X86-X87-NEXT: fxch %st(1)
286 ; X86-X87-NEXT: fucom %st(1)
287 ; X86-X87-NEXT: fstp %st(1)
288 ; X86-X87-NEXT: fnstsw %ax
289 ; X86-X87-NEXT: xorl %ecx, %ecx
290 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
292 ; X86-X87-NEXT: jb .LBB4_2
293 ; X86-X87-NEXT: # %bb.1:
294 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
295 ; X86-X87-NEXT: .LBB4_2:
296 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
297 ; X86-X87-NEXT: fxch %st(1)
298 ; X86-X87-NEXT: fucompp
299 ; X86-X87-NEXT: fnstsw %ax
300 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
302 ; X86-X87-NEXT: movl $524287, %eax # imm = 0x7FFFF
303 ; X86-X87-NEXT: ja .LBB4_4
304 ; X86-X87-NEXT: # %bb.3:
305 ; X86-X87-NEXT: movl %ecx, %eax
306 ; X86-X87-NEXT: .LBB4_4:
307 ; X86-X87-NEXT: addl $20, %esp
310 ; X86-SSE-LABEL: test_unsigned_i19_f32:
312 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
313 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
314 ; X86-SSE-NEXT: maxss %xmm1, %xmm0
315 ; X86-SSE-NEXT: minss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
316 ; X86-SSE-NEXT: cvttss2si %xmm0, %eax
319 ; X64-LABEL: test_unsigned_i19_f32:
321 ; X64-NEXT: xorps %xmm1, %xmm1
322 ; X64-NEXT: maxss %xmm1, %xmm0
323 ; X64-NEXT: minss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
324 ; X64-NEXT: cvttss2si %xmm0, %eax
326 %x = call i19 @llvm.fptoui.sat.i19.f32(float %f)
330 define i32 @test_unsigned_i32_f32(float %f) nounwind {
331 ; X86-X87-LABEL: test_unsigned_i32_f32:
333 ; X86-X87-NEXT: subl $20, %esp
334 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
335 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
336 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
337 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
338 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
339 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
340 ; X86-X87-NEXT: fld %st(0)
341 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
342 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
344 ; X86-X87-NEXT: fxch %st(1)
345 ; X86-X87-NEXT: fucom %st(1)
346 ; X86-X87-NEXT: fstp %st(1)
347 ; X86-X87-NEXT: fnstsw %ax
348 ; X86-X87-NEXT: xorl %ecx, %ecx
349 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
351 ; X86-X87-NEXT: jb .LBB5_2
352 ; X86-X87-NEXT: # %bb.1:
353 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
354 ; X86-X87-NEXT: .LBB5_2:
355 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
356 ; X86-X87-NEXT: fxch %st(1)
357 ; X86-X87-NEXT: fucompp
358 ; X86-X87-NEXT: fnstsw %ax
359 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
361 ; X86-X87-NEXT: movl $-1, %eax
362 ; X86-X87-NEXT: ja .LBB5_4
363 ; X86-X87-NEXT: # %bb.3:
364 ; X86-X87-NEXT: movl %ecx, %eax
365 ; X86-X87-NEXT: .LBB5_4:
366 ; X86-X87-NEXT: addl $20, %esp
369 ; X86-SSE-LABEL: test_unsigned_i32_f32:
371 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
372 ; X86-SSE-NEXT: cvttss2si %xmm0, %eax
373 ; X86-SSE-NEXT: movl %eax, %ecx
374 ; X86-SSE-NEXT: sarl $31, %ecx
375 ; X86-SSE-NEXT: movaps %xmm0, %xmm1
376 ; X86-SSE-NEXT: subss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
377 ; X86-SSE-NEXT: cvttss2si %xmm1, %edx
378 ; X86-SSE-NEXT: andl %ecx, %edx
379 ; X86-SSE-NEXT: orl %eax, %edx
380 ; X86-SSE-NEXT: xorl %ecx, %ecx
381 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
382 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
383 ; X86-SSE-NEXT: cmovael %edx, %ecx
384 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
385 ; X86-SSE-NEXT: movl $-1, %eax
386 ; X86-SSE-NEXT: cmovbel %ecx, %eax
389 ; X64-LABEL: test_unsigned_i32_f32:
391 ; X64-NEXT: cvttss2si %xmm0, %rax
392 ; X64-NEXT: xorl %ecx, %ecx
393 ; X64-NEXT: xorps %xmm1, %xmm1
394 ; X64-NEXT: ucomiss %xmm1, %xmm0
395 ; X64-NEXT: cmovael %eax, %ecx
396 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
397 ; X64-NEXT: movl $-1, %eax
398 ; X64-NEXT: cmovbel %ecx, %eax
400 %x = call i32 @llvm.fptoui.sat.i32.f32(float %f)
404 define i50 @test_unsigned_i50_f32(float %f) nounwind {
405 ; X86-X87-LABEL: test_unsigned_i50_f32:
407 ; X86-X87-NEXT: pushl %esi
408 ; X86-X87-NEXT: subl $16, %esp
409 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
410 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
411 ; X86-X87-NEXT: fucom %st(1)
412 ; X86-X87-NEXT: fnstsw %ax
413 ; X86-X87-NEXT: xorl %ecx, %ecx
414 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
416 ; X86-X87-NEXT: setbe %al
418 ; X86-X87-NEXT: jbe .LBB6_2
419 ; X86-X87-NEXT: # %bb.1:
420 ; X86-X87-NEXT: fstp %st(1)
421 ; X86-X87-NEXT: fld %st(0)
422 ; X86-X87-NEXT: fxch %st(1)
423 ; X86-X87-NEXT: .LBB6_2:
424 ; X86-X87-NEXT: fxch %st(1)
425 ; X86-X87-NEXT: fsubr %st(2), %st
426 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
427 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %edx
428 ; X86-X87-NEXT: orl $3072, %edx # imm = 0xC00
429 ; X86-X87-NEXT: movw %dx, {{[0-9]+}}(%esp)
430 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
431 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
432 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
433 ; X86-X87-NEXT: movb %al, %cl
434 ; X86-X87-NEXT: shll $31, %ecx
435 ; X86-X87-NEXT: xorl {{[0-9]+}}(%esp), %ecx
436 ; X86-X87-NEXT: fxch %st(1)
437 ; X86-X87-NEXT: fucom %st(1)
438 ; X86-X87-NEXT: fstp %st(1)
439 ; X86-X87-NEXT: fnstsw %ax
440 ; X86-X87-NEXT: xorl %edx, %edx
441 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
443 ; X86-X87-NEXT: movl $0, %esi
444 ; X86-X87-NEXT: jb .LBB6_4
445 ; X86-X87-NEXT: # %bb.3:
446 ; X86-X87-NEXT: movl %ecx, %esi
447 ; X86-X87-NEXT: .LBB6_4:
448 ; X86-X87-NEXT: jb .LBB6_6
449 ; X86-X87-NEXT: # %bb.5:
450 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edx
451 ; X86-X87-NEXT: .LBB6_6:
452 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
453 ; X86-X87-NEXT: fxch %st(1)
454 ; X86-X87-NEXT: fucompp
455 ; X86-X87-NEXT: fnstsw %ax
456 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
458 ; X86-X87-NEXT: movl $-1, %eax
459 ; X86-X87-NEXT: ja .LBB6_8
460 ; X86-X87-NEXT: # %bb.7:
461 ; X86-X87-NEXT: movl %edx, %eax
462 ; X86-X87-NEXT: .LBB6_8:
463 ; X86-X87-NEXT: movl $262143, %edx # imm = 0x3FFFF
464 ; X86-X87-NEXT: ja .LBB6_10
465 ; X86-X87-NEXT: # %bb.9:
466 ; X86-X87-NEXT: movl %esi, %edx
467 ; X86-X87-NEXT: .LBB6_10:
468 ; X86-X87-NEXT: addl $16, %esp
469 ; X86-X87-NEXT: popl %esi
472 ; X86-SSE-LABEL: test_unsigned_i50_f32:
474 ; X86-SSE-NEXT: pushl %esi
475 ; X86-SSE-NEXT: subl $16, %esp
476 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
477 ; X86-SSE-NEXT: movss {{.*#+}} xmm2 = [9.22337203E+18,0.0E+0,0.0E+0,0.0E+0]
478 ; X86-SSE-NEXT: ucomiss %xmm0, %xmm2
479 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
480 ; X86-SSE-NEXT: jbe .LBB6_2
481 ; X86-SSE-NEXT: # %bb.1:
482 ; X86-SSE-NEXT: xorps %xmm2, %xmm2
483 ; X86-SSE-NEXT: .LBB6_2:
484 ; X86-SSE-NEXT: movaps %xmm0, %xmm3
485 ; X86-SSE-NEXT: subss %xmm2, %xmm3
486 ; X86-SSE-NEXT: movss %xmm3, {{[0-9]+}}(%esp)
487 ; X86-SSE-NEXT: setbe %cl
488 ; X86-SSE-NEXT: flds {{[0-9]+}}(%esp)
489 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
490 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
491 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
492 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
493 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
494 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
495 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
496 ; X86-SSE-NEXT: xorl %eax, %eax
497 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
498 ; X86-SSE-NEXT: movl $0, %esi
499 ; X86-SSE-NEXT: jb .LBB6_4
500 ; X86-SSE-NEXT: # %bb.3:
501 ; X86-SSE-NEXT: movzbl %cl, %eax
502 ; X86-SSE-NEXT: shll $31, %eax
503 ; X86-SSE-NEXT: xorl {{[0-9]+}}(%esp), %eax
504 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
505 ; X86-SSE-NEXT: .LBB6_4:
506 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
507 ; X86-SSE-NEXT: movl $262143, %edx # imm = 0x3FFFF
508 ; X86-SSE-NEXT: cmovbel %eax, %edx
509 ; X86-SSE-NEXT: movl $-1, %eax
510 ; X86-SSE-NEXT: cmovbel %esi, %eax
511 ; X86-SSE-NEXT: addl $16, %esp
512 ; X86-SSE-NEXT: popl %esi
515 ; X64-LABEL: test_unsigned_i50_f32:
517 ; X64-NEXT: cvttss2si %xmm0, %rax
518 ; X64-NEXT: xorl %ecx, %ecx
519 ; X64-NEXT: xorps %xmm1, %xmm1
520 ; X64-NEXT: ucomiss %xmm1, %xmm0
521 ; X64-NEXT: cmovaeq %rax, %rcx
522 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
523 ; X64-NEXT: movabsq $1125899906842623, %rax # imm = 0x3FFFFFFFFFFFF
524 ; X64-NEXT: cmovbeq %rcx, %rax
526 %x = call i50 @llvm.fptoui.sat.i50.f32(float %f)
530 define i64 @test_unsigned_i64_f32(float %f) nounwind {
531 ; X86-X87-LABEL: test_unsigned_i64_f32:
533 ; X86-X87-NEXT: pushl %edi
534 ; X86-X87-NEXT: pushl %esi
535 ; X86-X87-NEXT: subl $20, %esp
536 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
537 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
538 ; X86-X87-NEXT: fucom %st(1)
539 ; X86-X87-NEXT: fnstsw %ax
540 ; X86-X87-NEXT: xorl %ecx, %ecx
541 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
543 ; X86-X87-NEXT: setbe %al
545 ; X86-X87-NEXT: jbe .LBB7_2
546 ; X86-X87-NEXT: # %bb.1:
547 ; X86-X87-NEXT: fstp %st(1)
548 ; X86-X87-NEXT: fld %st(0)
549 ; X86-X87-NEXT: fxch %st(1)
550 ; X86-X87-NEXT: .LBB7_2:
551 ; X86-X87-NEXT: fxch %st(1)
552 ; X86-X87-NEXT: fsubr %st(2), %st
553 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
554 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %edx
555 ; X86-X87-NEXT: orl $3072, %edx # imm = 0xC00
556 ; X86-X87-NEXT: movw %dx, {{[0-9]+}}(%esp)
557 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
558 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
559 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
560 ; X86-X87-NEXT: movb %al, %cl
561 ; X86-X87-NEXT: shll $31, %ecx
562 ; X86-X87-NEXT: xorl {{[0-9]+}}(%esp), %ecx
563 ; X86-X87-NEXT: fxch %st(1)
564 ; X86-X87-NEXT: fucom %st(1)
565 ; X86-X87-NEXT: fstp %st(1)
566 ; X86-X87-NEXT: fnstsw %ax
567 ; X86-X87-NEXT: xorl %esi, %esi
568 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
570 ; X86-X87-NEXT: movl $0, %edi
571 ; X86-X87-NEXT: jb .LBB7_4
572 ; X86-X87-NEXT: # %bb.3:
573 ; X86-X87-NEXT: movl %ecx, %edi
574 ; X86-X87-NEXT: .LBB7_4:
575 ; X86-X87-NEXT: jb .LBB7_6
576 ; X86-X87-NEXT: # %bb.5:
577 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %esi
578 ; X86-X87-NEXT: .LBB7_6:
579 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
580 ; X86-X87-NEXT: fxch %st(1)
581 ; X86-X87-NEXT: fucompp
582 ; X86-X87-NEXT: fnstsw %ax
583 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
585 ; X86-X87-NEXT: movl $-1, %eax
586 ; X86-X87-NEXT: movl $-1, %edx
587 ; X86-X87-NEXT: ja .LBB7_8
588 ; X86-X87-NEXT: # %bb.7:
589 ; X86-X87-NEXT: movl %esi, %eax
590 ; X86-X87-NEXT: movl %edi, %edx
591 ; X86-X87-NEXT: .LBB7_8:
592 ; X86-X87-NEXT: addl $20, %esp
593 ; X86-X87-NEXT: popl %esi
594 ; X86-X87-NEXT: popl %edi
597 ; X86-SSE-LABEL: test_unsigned_i64_f32:
599 ; X86-SSE-NEXT: subl $20, %esp
600 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
601 ; X86-SSE-NEXT: movss {{.*#+}} xmm2 = [9.22337203E+18,0.0E+0,0.0E+0,0.0E+0]
602 ; X86-SSE-NEXT: ucomiss %xmm0, %xmm2
603 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
604 ; X86-SSE-NEXT: jbe .LBB7_2
605 ; X86-SSE-NEXT: # %bb.1:
606 ; X86-SSE-NEXT: xorps %xmm2, %xmm2
607 ; X86-SSE-NEXT: .LBB7_2:
608 ; X86-SSE-NEXT: movaps %xmm0, %xmm3
609 ; X86-SSE-NEXT: subss %xmm2, %xmm3
610 ; X86-SSE-NEXT: movss %xmm3, {{[0-9]+}}(%esp)
611 ; X86-SSE-NEXT: setbe %cl
612 ; X86-SSE-NEXT: flds {{[0-9]+}}(%esp)
613 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
614 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
615 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
616 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
617 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
618 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
619 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
620 ; X86-SSE-NEXT: xorl %edx, %edx
621 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
622 ; X86-SSE-NEXT: movl $0, %eax
623 ; X86-SSE-NEXT: jb .LBB7_4
624 ; X86-SSE-NEXT: # %bb.3:
625 ; X86-SSE-NEXT: movzbl %cl, %edx
626 ; X86-SSE-NEXT: shll $31, %edx
627 ; X86-SSE-NEXT: xorl {{[0-9]+}}(%esp), %edx
628 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
629 ; X86-SSE-NEXT: .LBB7_4:
630 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
631 ; X86-SSE-NEXT: movl $-1, %ecx
632 ; X86-SSE-NEXT: cmoval %ecx, %edx
633 ; X86-SSE-NEXT: cmoval %ecx, %eax
634 ; X86-SSE-NEXT: addl $20, %esp
637 ; X64-LABEL: test_unsigned_i64_f32:
639 ; X64-NEXT: cvttss2si %xmm0, %rax
640 ; X64-NEXT: movq %rax, %rcx
641 ; X64-NEXT: sarq $63, %rcx
642 ; X64-NEXT: movaps %xmm0, %xmm1
643 ; X64-NEXT: subss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
644 ; X64-NEXT: cvttss2si %xmm1, %rdx
645 ; X64-NEXT: andq %rcx, %rdx
646 ; X64-NEXT: orq %rax, %rdx
647 ; X64-NEXT: xorl %ecx, %ecx
648 ; X64-NEXT: xorps %xmm1, %xmm1
649 ; X64-NEXT: ucomiss %xmm1, %xmm0
650 ; X64-NEXT: cmovaeq %rdx, %rcx
651 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
652 ; X64-NEXT: movq $-1, %rax
653 ; X64-NEXT: cmovbeq %rcx, %rax
655 %x = call i64 @llvm.fptoui.sat.i64.f32(float %f)
659 define i100 @test_unsigned_i100_f32(float %f) nounwind {
660 ; X86-X87-LABEL: test_unsigned_i100_f32:
662 ; X86-X87-NEXT: pushl %ebp
663 ; X86-X87-NEXT: pushl %ebx
664 ; X86-X87-NEXT: pushl %edi
665 ; X86-X87-NEXT: pushl %esi
666 ; X86-X87-NEXT: subl $44, %esp
667 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
668 ; X86-X87-NEXT: fsts {{[0-9]+}}(%esp)
669 ; X86-X87-NEXT: leal {{[0-9]+}}(%esp), %eax
670 ; X86-X87-NEXT: movl %eax, (%esp)
672 ; X86-X87-NEXT: fxch %st(1)
673 ; X86-X87-NEXT: fsts {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
674 ; X86-X87-NEXT: fucompp
675 ; X86-X87-NEXT: fnstsw %ax
676 ; X86-X87-NEXT: movl %eax, %ebx
677 ; X86-X87-NEXT: calll __fixunssfti
678 ; X86-X87-NEXT: subl $4, %esp
679 ; X86-X87-NEXT: xorl %edi, %edi
680 ; X86-X87-NEXT: movb %bh, %ah
682 ; X86-X87-NEXT: movl $0, %eax
683 ; X86-X87-NEXT: jb .LBB8_2
684 ; X86-X87-NEXT: # %bb.1:
685 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %eax
686 ; X86-X87-NEXT: .LBB8_2:
687 ; X86-X87-NEXT: movl $0, %esi
688 ; X86-X87-NEXT: movl $0, %ebx
689 ; X86-X87-NEXT: jb .LBB8_4
690 ; X86-X87-NEXT: # %bb.3:
691 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ebx
692 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %esi
693 ; X86-X87-NEXT: .LBB8_4:
694 ; X86-X87-NEXT: jb .LBB8_6
695 ; X86-X87-NEXT: # %bb.5:
696 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edi
697 ; X86-X87-NEXT: .LBB8_6:
698 ; X86-X87-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
699 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
700 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
701 ; X86-X87-NEXT: flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
702 ; X86-X87-NEXT: fucompp
703 ; X86-X87-NEXT: fnstsw %ax
704 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
706 ; X86-X87-NEXT: movl $15, %eax
707 ; X86-X87-NEXT: ja .LBB8_8
708 ; X86-X87-NEXT: # %bb.7:
709 ; X86-X87-NEXT: movl %edi, %eax
710 ; X86-X87-NEXT: .LBB8_8:
711 ; X86-X87-NEXT: movl $-1, %edi
712 ; X86-X87-NEXT: movl $-1, %ebp
713 ; X86-X87-NEXT: movl $-1, %edx
714 ; X86-X87-NEXT: ja .LBB8_10
715 ; X86-X87-NEXT: # %bb.9:
716 ; X86-X87-NEXT: movl %ebx, %edi
717 ; X86-X87-NEXT: movl %esi, %ebp
718 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
719 ; X86-X87-NEXT: .LBB8_10:
720 ; X86-X87-NEXT: movl %edx, 8(%ecx)
721 ; X86-X87-NEXT: movl %ebp, 4(%ecx)
722 ; X86-X87-NEXT: movl %edi, (%ecx)
723 ; X86-X87-NEXT: andl $15, %eax
724 ; X86-X87-NEXT: movb %al, 12(%ecx)
725 ; X86-X87-NEXT: movl %ecx, %eax
726 ; X86-X87-NEXT: addl $44, %esp
727 ; X86-X87-NEXT: popl %esi
728 ; X86-X87-NEXT: popl %edi
729 ; X86-X87-NEXT: popl %ebx
730 ; X86-X87-NEXT: popl %ebp
731 ; X86-X87-NEXT: retl $4
733 ; X86-SSE-LABEL: test_unsigned_i100_f32:
735 ; X86-SSE-NEXT: pushl %ebx
736 ; X86-SSE-NEXT: pushl %edi
737 ; X86-SSE-NEXT: pushl %esi
738 ; X86-SSE-NEXT: subl $32, %esp
739 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
740 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
741 ; X86-SSE-NEXT: movss %xmm0, {{[0-9]+}}(%esp)
742 ; X86-SSE-NEXT: leal {{[0-9]+}}(%esp), %eax
743 ; X86-SSE-NEXT: movl %eax, (%esp)
744 ; X86-SSE-NEXT: calll __fixunssfti
745 ; X86-SSE-NEXT: subl $4, %esp
746 ; X86-SSE-NEXT: xorl %eax, %eax
747 ; X86-SSE-NEXT: xorps %xmm0, %xmm0
748 ; X86-SSE-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
749 ; X86-SSE-NEXT: ucomiss %xmm0, %xmm1
750 ; X86-SSE-NEXT: movaps %xmm1, %xmm0
751 ; X86-SSE-NEXT: movl $0, %ecx
752 ; X86-SSE-NEXT: movl $0, %edx
753 ; X86-SSE-NEXT: movl $0, %edi
754 ; X86-SSE-NEXT: jb .LBB8_2
755 ; X86-SSE-NEXT: # %bb.1:
756 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
757 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
758 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edx
759 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edi
760 ; X86-SSE-NEXT: .LBB8_2:
761 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
762 ; X86-SSE-NEXT: movl $15, %ebx
763 ; X86-SSE-NEXT: cmovbel %edi, %ebx
764 ; X86-SSE-NEXT: movl $-1, %edi
765 ; X86-SSE-NEXT: cmoval %edi, %edx
766 ; X86-SSE-NEXT: cmoval %edi, %ecx
767 ; X86-SSE-NEXT: cmoval %edi, %eax
768 ; X86-SSE-NEXT: movl %eax, 8(%esi)
769 ; X86-SSE-NEXT: movl %ecx, 4(%esi)
770 ; X86-SSE-NEXT: movl %edx, (%esi)
771 ; X86-SSE-NEXT: andl $15, %ebx
772 ; X86-SSE-NEXT: movb %bl, 12(%esi)
773 ; X86-SSE-NEXT: movl %esi, %eax
774 ; X86-SSE-NEXT: addl $32, %esp
775 ; X86-SSE-NEXT: popl %esi
776 ; X86-SSE-NEXT: popl %edi
777 ; X86-SSE-NEXT: popl %ebx
778 ; X86-SSE-NEXT: retl $4
780 ; X64-LABEL: test_unsigned_i100_f32:
782 ; X64-NEXT: pushq %rax
783 ; X64-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
784 ; X64-NEXT: callq __fixunssfti@PLT
785 ; X64-NEXT: xorl %ecx, %ecx
786 ; X64-NEXT: xorps %xmm0, %xmm0
787 ; X64-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 4-byte Reload
788 ; X64-NEXT: # xmm1 = mem[0],zero,zero,zero
789 ; X64-NEXT: ucomiss %xmm0, %xmm1
790 ; X64-NEXT: cmovbq %rcx, %rdx
791 ; X64-NEXT: cmovbq %rcx, %rax
792 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
793 ; X64-NEXT: movq $-1, %rcx
794 ; X64-NEXT: cmovaq %rcx, %rax
795 ; X64-NEXT: movabsq $68719476735, %rcx # imm = 0xFFFFFFFFF
796 ; X64-NEXT: cmovaq %rcx, %rdx
797 ; X64-NEXT: popq %rcx
799 %x = call i100 @llvm.fptoui.sat.i100.f32(float %f)
803 define i128 @test_unsigned_i128_f32(float %f) nounwind {
804 ; X86-X87-LABEL: test_unsigned_i128_f32:
806 ; X86-X87-NEXT: pushl %ebp
807 ; X86-X87-NEXT: pushl %ebx
808 ; X86-X87-NEXT: pushl %edi
809 ; X86-X87-NEXT: pushl %esi
810 ; X86-X87-NEXT: subl $60, %esp
811 ; X86-X87-NEXT: flds {{[0-9]+}}(%esp)
812 ; X86-X87-NEXT: fsts {{[0-9]+}}(%esp)
813 ; X86-X87-NEXT: leal {{[0-9]+}}(%esp), %eax
814 ; X86-X87-NEXT: movl %eax, (%esp)
816 ; X86-X87-NEXT: fxch %st(1)
817 ; X86-X87-NEXT: fsts {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
818 ; X86-X87-NEXT: fucompp
819 ; X86-X87-NEXT: fnstsw %ax
820 ; X86-X87-NEXT: movl %eax, %ebx
821 ; X86-X87-NEXT: calll __fixunssfti
822 ; X86-X87-NEXT: subl $4, %esp
823 ; X86-X87-NEXT: xorl %edx, %edx
824 ; X86-X87-NEXT: movb %bh, %ah
826 ; X86-X87-NEXT: movl $0, %eax
827 ; X86-X87-NEXT: jb .LBB9_2
828 ; X86-X87-NEXT: # %bb.1:
829 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %eax
830 ; X86-X87-NEXT: .LBB9_2:
831 ; X86-X87-NEXT: movl $0, %ecx
832 ; X86-X87-NEXT: jb .LBB9_4
833 ; X86-X87-NEXT: # %bb.3:
834 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
835 ; X86-X87-NEXT: .LBB9_4:
836 ; X86-X87-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
837 ; X86-X87-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
838 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
839 ; X86-X87-NEXT: movl $0, %ebx
840 ; X86-X87-NEXT: jb .LBB9_6
841 ; X86-X87-NEXT: # %bb.5:
842 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ebx
843 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edx
844 ; X86-X87-NEXT: .LBB9_6:
845 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
846 ; X86-X87-NEXT: flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
847 ; X86-X87-NEXT: fucompp
848 ; X86-X87-NEXT: fnstsw %ax
849 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
851 ; X86-X87-NEXT: movl $-1, %eax
852 ; X86-X87-NEXT: movl $-1, %ebp
853 ; X86-X87-NEXT: movl $-1, %edi
854 ; X86-X87-NEXT: movl $-1, %esi
855 ; X86-X87-NEXT: ja .LBB9_8
856 ; X86-X87-NEXT: # %bb.7:
857 ; X86-X87-NEXT: movl %ebx, %eax
858 ; X86-X87-NEXT: movl %edx, %ebp
859 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
860 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
861 ; X86-X87-NEXT: .LBB9_8:
862 ; X86-X87-NEXT: movl %esi, 12(%ecx)
863 ; X86-X87-NEXT: movl %edi, 8(%ecx)
864 ; X86-X87-NEXT: movl %ebp, 4(%ecx)
865 ; X86-X87-NEXT: movl %eax, (%ecx)
866 ; X86-X87-NEXT: movl %ecx, %eax
867 ; X86-X87-NEXT: addl $60, %esp
868 ; X86-X87-NEXT: popl %esi
869 ; X86-X87-NEXT: popl %edi
870 ; X86-X87-NEXT: popl %ebx
871 ; X86-X87-NEXT: popl %ebp
872 ; X86-X87-NEXT: retl $4
874 ; X86-SSE-LABEL: test_unsigned_i128_f32:
876 ; X86-SSE-NEXT: pushl %ebx
877 ; X86-SSE-NEXT: pushl %edi
878 ; X86-SSE-NEXT: pushl %esi
879 ; X86-SSE-NEXT: subl $32, %esp
880 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
881 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
882 ; X86-SSE-NEXT: movss %xmm0, {{[0-9]+}}(%esp)
883 ; X86-SSE-NEXT: leal {{[0-9]+}}(%esp), %eax
884 ; X86-SSE-NEXT: movl %eax, (%esp)
885 ; X86-SSE-NEXT: calll __fixunssfti
886 ; X86-SSE-NEXT: subl $4, %esp
887 ; X86-SSE-NEXT: xorl %eax, %eax
888 ; X86-SSE-NEXT: xorps %xmm0, %xmm0
889 ; X86-SSE-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
890 ; X86-SSE-NEXT: ucomiss %xmm0, %xmm1
891 ; X86-SSE-NEXT: movaps %xmm1, %xmm0
892 ; X86-SSE-NEXT: movl $0, %ecx
893 ; X86-SSE-NEXT: movl $0, %edx
894 ; X86-SSE-NEXT: movl $0, %edi
895 ; X86-SSE-NEXT: jb .LBB9_2
896 ; X86-SSE-NEXT: # %bb.1:
897 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
898 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
899 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edx
900 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edi
901 ; X86-SSE-NEXT: .LBB9_2:
902 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
903 ; X86-SSE-NEXT: movl $-1, %ebx
904 ; X86-SSE-NEXT: cmoval %ebx, %edi
905 ; X86-SSE-NEXT: cmoval %ebx, %edx
906 ; X86-SSE-NEXT: cmoval %ebx, %ecx
907 ; X86-SSE-NEXT: cmoval %ebx, %eax
908 ; X86-SSE-NEXT: movl %eax, 12(%esi)
909 ; X86-SSE-NEXT: movl %ecx, 8(%esi)
910 ; X86-SSE-NEXT: movl %edx, 4(%esi)
911 ; X86-SSE-NEXT: movl %edi, (%esi)
912 ; X86-SSE-NEXT: movl %esi, %eax
913 ; X86-SSE-NEXT: addl $32, %esp
914 ; X86-SSE-NEXT: popl %esi
915 ; X86-SSE-NEXT: popl %edi
916 ; X86-SSE-NEXT: popl %ebx
917 ; X86-SSE-NEXT: retl $4
919 ; X64-LABEL: test_unsigned_i128_f32:
921 ; X64-NEXT: pushq %rax
922 ; X64-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
923 ; X64-NEXT: callq __fixunssfti@PLT
924 ; X64-NEXT: xorl %ecx, %ecx
925 ; X64-NEXT: xorps %xmm0, %xmm0
926 ; X64-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 4-byte Reload
927 ; X64-NEXT: # xmm1 = mem[0],zero,zero,zero
928 ; X64-NEXT: ucomiss %xmm0, %xmm1
929 ; X64-NEXT: cmovbq %rcx, %rdx
930 ; X64-NEXT: cmovbq %rcx, %rax
931 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
932 ; X64-NEXT: movq $-1, %rcx
933 ; X64-NEXT: cmovaq %rcx, %rax
934 ; X64-NEXT: cmovaq %rcx, %rdx
935 ; X64-NEXT: popq %rcx
937 %x = call i128 @llvm.fptoui.sat.i128.f32(float %f)
942 ; 64-bit float to unsigned integer
945 declare i1 @llvm.fptoui.sat.i1.f64 (double)
946 declare i8 @llvm.fptoui.sat.i8.f64 (double)
947 declare i13 @llvm.fptoui.sat.i13.f64 (double)
948 declare i16 @llvm.fptoui.sat.i16.f64 (double)
949 declare i19 @llvm.fptoui.sat.i19.f64 (double)
950 declare i32 @llvm.fptoui.sat.i32.f64 (double)
951 declare i50 @llvm.fptoui.sat.i50.f64 (double)
952 declare i64 @llvm.fptoui.sat.i64.f64 (double)
953 declare i100 @llvm.fptoui.sat.i100.f64(double)
954 declare i128 @llvm.fptoui.sat.i128.f64(double)
956 define i1 @test_unsigned_i1_f64(double %f) nounwind {
957 ; X86-X87-LABEL: test_unsigned_i1_f64:
959 ; X86-X87-NEXT: subl $8, %esp
960 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
961 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
962 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
963 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
964 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
965 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
966 ; X86-X87-NEXT: fists {{[0-9]+}}(%esp)
967 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
969 ; X86-X87-NEXT: fxch %st(1)
970 ; X86-X87-NEXT: fucom %st(1)
971 ; X86-X87-NEXT: fstp %st(1)
972 ; X86-X87-NEXT: fnstsw %ax
973 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
975 ; X86-X87-NEXT: jb .LBB10_1
976 ; X86-X87-NEXT: # %bb.2:
977 ; X86-X87-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
978 ; X86-X87-NEXT: jmp .LBB10_3
979 ; X86-X87-NEXT: .LBB10_1:
980 ; X86-X87-NEXT: xorl %ecx, %ecx
981 ; X86-X87-NEXT: .LBB10_3:
983 ; X86-X87-NEXT: fxch %st(1)
984 ; X86-X87-NEXT: fucompp
985 ; X86-X87-NEXT: fnstsw %ax
986 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
988 ; X86-X87-NEXT: movb $1, %al
989 ; X86-X87-NEXT: ja .LBB10_5
990 ; X86-X87-NEXT: # %bb.4:
991 ; X86-X87-NEXT: movl %ecx, %eax
992 ; X86-X87-NEXT: .LBB10_5:
993 ; X86-X87-NEXT: addl $8, %esp
996 ; X86-SSE-LABEL: test_unsigned_i1_f64:
998 ; X86-SSE-NEXT: xorpd %xmm0, %xmm0
999 ; X86-SSE-NEXT: maxsd {{[0-9]+}}(%esp), %xmm0
1000 ; X86-SSE-NEXT: movsd {{.*#+}} xmm1 = [1.0E+0,0.0E+0]
1001 ; X86-SSE-NEXT: minsd %xmm0, %xmm1
1002 ; X86-SSE-NEXT: cvttsd2si %xmm1, %eax
1003 ; X86-SSE-NEXT: # kill: def $al killed $al killed $eax
1004 ; X86-SSE-NEXT: retl
1006 ; X64-LABEL: test_unsigned_i1_f64:
1008 ; X64-NEXT: xorpd %xmm1, %xmm1
1009 ; X64-NEXT: maxsd %xmm0, %xmm1
1010 ; X64-NEXT: movsd {{.*#+}} xmm0 = [1.0E+0,0.0E+0]
1011 ; X64-NEXT: minsd %xmm1, %xmm0
1012 ; X64-NEXT: cvttsd2si %xmm0, %eax
1013 ; X64-NEXT: # kill: def $al killed $al killed $eax
1015 %x = call i1 @llvm.fptoui.sat.i1.f64(double %f)
1019 define i8 @test_unsigned_i8_f64(double %f) nounwind {
1020 ; X86-X87-LABEL: test_unsigned_i8_f64:
1022 ; X86-X87-NEXT: subl $8, %esp
1023 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
1024 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
1025 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1026 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
1027 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
1028 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1029 ; X86-X87-NEXT: fists {{[0-9]+}}(%esp)
1030 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1031 ; X86-X87-NEXT: fldz
1032 ; X86-X87-NEXT: fxch %st(1)
1033 ; X86-X87-NEXT: fucom %st(1)
1034 ; X86-X87-NEXT: fstp %st(1)
1035 ; X86-X87-NEXT: fnstsw %ax
1036 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1037 ; X86-X87-NEXT: sahf
1038 ; X86-X87-NEXT: jb .LBB11_1
1039 ; X86-X87-NEXT: # %bb.2:
1040 ; X86-X87-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
1041 ; X86-X87-NEXT: jmp .LBB11_3
1042 ; X86-X87-NEXT: .LBB11_1:
1043 ; X86-X87-NEXT: xorl %ecx, %ecx
1044 ; X86-X87-NEXT: .LBB11_3:
1045 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
1046 ; X86-X87-NEXT: fxch %st(1)
1047 ; X86-X87-NEXT: fucompp
1048 ; X86-X87-NEXT: fnstsw %ax
1049 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1050 ; X86-X87-NEXT: sahf
1051 ; X86-X87-NEXT: movb $-1, %al
1052 ; X86-X87-NEXT: ja .LBB11_5
1053 ; X86-X87-NEXT: # %bb.4:
1054 ; X86-X87-NEXT: movl %ecx, %eax
1055 ; X86-X87-NEXT: .LBB11_5:
1056 ; X86-X87-NEXT: addl $8, %esp
1057 ; X86-X87-NEXT: retl
1059 ; X86-SSE-LABEL: test_unsigned_i8_f64:
1061 ; X86-SSE-NEXT: xorpd %xmm0, %xmm0
1062 ; X86-SSE-NEXT: maxsd {{[0-9]+}}(%esp), %xmm0
1063 ; X86-SSE-NEXT: movsd {{.*#+}} xmm1 = [2.55E+2,0.0E+0]
1064 ; X86-SSE-NEXT: minsd %xmm0, %xmm1
1065 ; X86-SSE-NEXT: cvttsd2si %xmm1, %eax
1066 ; X86-SSE-NEXT: # kill: def $al killed $al killed $eax
1067 ; X86-SSE-NEXT: retl
1069 ; X64-LABEL: test_unsigned_i8_f64:
1071 ; X64-NEXT: xorpd %xmm1, %xmm1
1072 ; X64-NEXT: maxsd %xmm0, %xmm1
1073 ; X64-NEXT: movsd {{.*#+}} xmm0 = [2.55E+2,0.0E+0]
1074 ; X64-NEXT: minsd %xmm1, %xmm0
1075 ; X64-NEXT: cvttsd2si %xmm0, %eax
1076 ; X64-NEXT: # kill: def $al killed $al killed $eax
1078 %x = call i8 @llvm.fptoui.sat.i8.f64(double %f)
1082 define i13 @test_unsigned_i13_f64(double %f) nounwind {
1083 ; X86-X87-LABEL: test_unsigned_i13_f64:
1085 ; X86-X87-NEXT: subl $8, %esp
1086 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
1087 ; X86-X87-NEXT: fnstcw (%esp)
1088 ; X86-X87-NEXT: movzwl (%esp), %eax
1089 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
1090 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
1091 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1092 ; X86-X87-NEXT: fistl {{[0-9]+}}(%esp)
1093 ; X86-X87-NEXT: fldcw (%esp)
1094 ; X86-X87-NEXT: fldz
1095 ; X86-X87-NEXT: fxch %st(1)
1096 ; X86-X87-NEXT: fucom %st(1)
1097 ; X86-X87-NEXT: fstp %st(1)
1098 ; X86-X87-NEXT: fnstsw %ax
1099 ; X86-X87-NEXT: xorl %ecx, %ecx
1100 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1101 ; X86-X87-NEXT: sahf
1102 ; X86-X87-NEXT: jb .LBB12_2
1103 ; X86-X87-NEXT: # %bb.1:
1104 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
1105 ; X86-X87-NEXT: .LBB12_2:
1106 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
1107 ; X86-X87-NEXT: fxch %st(1)
1108 ; X86-X87-NEXT: fucompp
1109 ; X86-X87-NEXT: fnstsw %ax
1110 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1111 ; X86-X87-NEXT: sahf
1112 ; X86-X87-NEXT: movl $8191, %eax # imm = 0x1FFF
1113 ; X86-X87-NEXT: ja .LBB12_4
1114 ; X86-X87-NEXT: # %bb.3:
1115 ; X86-X87-NEXT: movl %ecx, %eax
1116 ; X86-X87-NEXT: .LBB12_4:
1117 ; X86-X87-NEXT: # kill: def $ax killed $ax killed $eax
1118 ; X86-X87-NEXT: addl $8, %esp
1119 ; X86-X87-NEXT: retl
1121 ; X86-SSE-LABEL: test_unsigned_i13_f64:
1123 ; X86-SSE-NEXT: xorpd %xmm0, %xmm0
1124 ; X86-SSE-NEXT: maxsd {{[0-9]+}}(%esp), %xmm0
1125 ; X86-SSE-NEXT: movsd {{.*#+}} xmm1 = [8.191E+3,0.0E+0]
1126 ; X86-SSE-NEXT: minsd %xmm0, %xmm1
1127 ; X86-SSE-NEXT: cvttsd2si %xmm1, %eax
1128 ; X86-SSE-NEXT: # kill: def $ax killed $ax killed $eax
1129 ; X86-SSE-NEXT: retl
1131 ; X64-LABEL: test_unsigned_i13_f64:
1133 ; X64-NEXT: xorpd %xmm1, %xmm1
1134 ; X64-NEXT: maxsd %xmm0, %xmm1
1135 ; X64-NEXT: movsd {{.*#+}} xmm0 = [8.191E+3,0.0E+0]
1136 ; X64-NEXT: minsd %xmm1, %xmm0
1137 ; X64-NEXT: cvttsd2si %xmm0, %eax
1138 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
1140 %x = call i13 @llvm.fptoui.sat.i13.f64(double %f)
1144 define i16 @test_unsigned_i16_f64(double %f) nounwind {
1145 ; X86-X87-LABEL: test_unsigned_i16_f64:
1147 ; X86-X87-NEXT: subl $8, %esp
1148 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
1149 ; X86-X87-NEXT: fnstcw (%esp)
1150 ; X86-X87-NEXT: movzwl (%esp), %eax
1151 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
1152 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
1153 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1154 ; X86-X87-NEXT: fistl {{[0-9]+}}(%esp)
1155 ; X86-X87-NEXT: fldcw (%esp)
1156 ; X86-X87-NEXT: fldz
1157 ; X86-X87-NEXT: fxch %st(1)
1158 ; X86-X87-NEXT: fucom %st(1)
1159 ; X86-X87-NEXT: fstp %st(1)
1160 ; X86-X87-NEXT: fnstsw %ax
1161 ; X86-X87-NEXT: xorl %ecx, %ecx
1162 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1163 ; X86-X87-NEXT: sahf
1164 ; X86-X87-NEXT: jb .LBB13_2
1165 ; X86-X87-NEXT: # %bb.1:
1166 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
1167 ; X86-X87-NEXT: .LBB13_2:
1168 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
1169 ; X86-X87-NEXT: fxch %st(1)
1170 ; X86-X87-NEXT: fucompp
1171 ; X86-X87-NEXT: fnstsw %ax
1172 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1173 ; X86-X87-NEXT: sahf
1174 ; X86-X87-NEXT: movl $65535, %eax # imm = 0xFFFF
1175 ; X86-X87-NEXT: ja .LBB13_4
1176 ; X86-X87-NEXT: # %bb.3:
1177 ; X86-X87-NEXT: movl %ecx, %eax
1178 ; X86-X87-NEXT: .LBB13_4:
1179 ; X86-X87-NEXT: # kill: def $ax killed $ax killed $eax
1180 ; X86-X87-NEXT: addl $8, %esp
1181 ; X86-X87-NEXT: retl
1183 ; X86-SSE-LABEL: test_unsigned_i16_f64:
1185 ; X86-SSE-NEXT: xorpd %xmm0, %xmm0
1186 ; X86-SSE-NEXT: maxsd {{[0-9]+}}(%esp), %xmm0
1187 ; X86-SSE-NEXT: movsd {{.*#+}} xmm1 = [6.5535E+4,0.0E+0]
1188 ; X86-SSE-NEXT: minsd %xmm0, %xmm1
1189 ; X86-SSE-NEXT: cvttsd2si %xmm1, %eax
1190 ; X86-SSE-NEXT: # kill: def $ax killed $ax killed $eax
1191 ; X86-SSE-NEXT: retl
1193 ; X64-LABEL: test_unsigned_i16_f64:
1195 ; X64-NEXT: xorpd %xmm1, %xmm1
1196 ; X64-NEXT: maxsd %xmm0, %xmm1
1197 ; X64-NEXT: movsd {{.*#+}} xmm0 = [6.5535E+4,0.0E+0]
1198 ; X64-NEXT: minsd %xmm1, %xmm0
1199 ; X64-NEXT: cvttsd2si %xmm0, %eax
1200 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
1202 %x = call i16 @llvm.fptoui.sat.i16.f64(double %f)
1206 define i19 @test_unsigned_i19_f64(double %f) nounwind {
1207 ; X86-X87-LABEL: test_unsigned_i19_f64:
1209 ; X86-X87-NEXT: subl $20, %esp
1210 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
1211 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
1212 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1213 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
1214 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
1215 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1216 ; X86-X87-NEXT: fld %st(0)
1217 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
1218 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1219 ; X86-X87-NEXT: fldz
1220 ; X86-X87-NEXT: fxch %st(1)
1221 ; X86-X87-NEXT: fucom %st(1)
1222 ; X86-X87-NEXT: fstp %st(1)
1223 ; X86-X87-NEXT: fnstsw %ax
1224 ; X86-X87-NEXT: xorl %ecx, %ecx
1225 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1226 ; X86-X87-NEXT: sahf
1227 ; X86-X87-NEXT: jb .LBB14_2
1228 ; X86-X87-NEXT: # %bb.1:
1229 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
1230 ; X86-X87-NEXT: .LBB14_2:
1231 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
1232 ; X86-X87-NEXT: fxch %st(1)
1233 ; X86-X87-NEXT: fucompp
1234 ; X86-X87-NEXT: fnstsw %ax
1235 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1236 ; X86-X87-NEXT: sahf
1237 ; X86-X87-NEXT: movl $524287, %eax # imm = 0x7FFFF
1238 ; X86-X87-NEXT: ja .LBB14_4
1239 ; X86-X87-NEXT: # %bb.3:
1240 ; X86-X87-NEXT: movl %ecx, %eax
1241 ; X86-X87-NEXT: .LBB14_4:
1242 ; X86-X87-NEXT: addl $20, %esp
1243 ; X86-X87-NEXT: retl
1245 ; X86-SSE-LABEL: test_unsigned_i19_f64:
1247 ; X86-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
1248 ; X86-SSE-NEXT: xorpd %xmm1, %xmm1
1249 ; X86-SSE-NEXT: maxsd %xmm1, %xmm0
1250 ; X86-SSE-NEXT: minsd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1251 ; X86-SSE-NEXT: cvttsd2si %xmm0, %eax
1252 ; X86-SSE-NEXT: retl
1254 ; X64-LABEL: test_unsigned_i19_f64:
1256 ; X64-NEXT: xorpd %xmm1, %xmm1
1257 ; X64-NEXT: maxsd %xmm1, %xmm0
1258 ; X64-NEXT: minsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1259 ; X64-NEXT: cvttsd2si %xmm0, %eax
1261 %x = call i19 @llvm.fptoui.sat.i19.f64(double %f)
1265 define i32 @test_unsigned_i32_f64(double %f) nounwind {
1266 ; X86-X87-LABEL: test_unsigned_i32_f64:
1268 ; X86-X87-NEXT: subl $20, %esp
1269 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
1270 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
1271 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1272 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
1273 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
1274 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1275 ; X86-X87-NEXT: fld %st(0)
1276 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
1277 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1278 ; X86-X87-NEXT: fldz
1279 ; X86-X87-NEXT: fxch %st(1)
1280 ; X86-X87-NEXT: fucom %st(1)
1281 ; X86-X87-NEXT: fstp %st(1)
1282 ; X86-X87-NEXT: fnstsw %ax
1283 ; X86-X87-NEXT: xorl %ecx, %ecx
1284 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1285 ; X86-X87-NEXT: sahf
1286 ; X86-X87-NEXT: jb .LBB15_2
1287 ; X86-X87-NEXT: # %bb.1:
1288 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
1289 ; X86-X87-NEXT: .LBB15_2:
1290 ; X86-X87-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}
1291 ; X86-X87-NEXT: fxch %st(1)
1292 ; X86-X87-NEXT: fucompp
1293 ; X86-X87-NEXT: fnstsw %ax
1294 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1295 ; X86-X87-NEXT: sahf
1296 ; X86-X87-NEXT: movl $-1, %eax
1297 ; X86-X87-NEXT: ja .LBB15_4
1298 ; X86-X87-NEXT: # %bb.3:
1299 ; X86-X87-NEXT: movl %ecx, %eax
1300 ; X86-X87-NEXT: .LBB15_4:
1301 ; X86-X87-NEXT: addl $20, %esp
1302 ; X86-X87-NEXT: retl
1304 ; X86-SSE-LABEL: test_unsigned_i32_f64:
1306 ; X86-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
1307 ; X86-SSE-NEXT: xorpd %xmm1, %xmm1
1308 ; X86-SSE-NEXT: maxsd %xmm1, %xmm0
1309 ; X86-SSE-NEXT: minsd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1310 ; X86-SSE-NEXT: cvttsd2si %xmm0, %ecx
1311 ; X86-SSE-NEXT: movl %ecx, %edx
1312 ; X86-SSE-NEXT: sarl $31, %edx
1313 ; X86-SSE-NEXT: subsd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1314 ; X86-SSE-NEXT: cvttsd2si %xmm0, %eax
1315 ; X86-SSE-NEXT: andl %edx, %eax
1316 ; X86-SSE-NEXT: orl %ecx, %eax
1317 ; X86-SSE-NEXT: retl
1319 ; X64-LABEL: test_unsigned_i32_f64:
1321 ; X64-NEXT: xorpd %xmm1, %xmm1
1322 ; X64-NEXT: maxsd %xmm0, %xmm1
1323 ; X64-NEXT: movsd {{.*#+}} xmm0 = [4.294967295E+9,0.0E+0]
1324 ; X64-NEXT: minsd %xmm1, %xmm0
1325 ; X64-NEXT: cvttsd2si %xmm0, %rax
1326 ; X64-NEXT: # kill: def $eax killed $eax killed $rax
1328 %x = call i32 @llvm.fptoui.sat.i32.f64(double %f)
1332 define i50 @test_unsigned_i50_f64(double %f) nounwind {
1333 ; X86-X87-LABEL: test_unsigned_i50_f64:
1335 ; X86-X87-NEXT: pushl %esi
1336 ; X86-X87-NEXT: subl $16, %esp
1337 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
1338 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
1339 ; X86-X87-NEXT: fucom %st(1)
1340 ; X86-X87-NEXT: fnstsw %ax
1341 ; X86-X87-NEXT: xorl %ecx, %ecx
1342 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1343 ; X86-X87-NEXT: sahf
1344 ; X86-X87-NEXT: setbe %al
1345 ; X86-X87-NEXT: fldz
1346 ; X86-X87-NEXT: jbe .LBB16_2
1347 ; X86-X87-NEXT: # %bb.1:
1348 ; X86-X87-NEXT: fstp %st(1)
1349 ; X86-X87-NEXT: fld %st(0)
1350 ; X86-X87-NEXT: fxch %st(1)
1351 ; X86-X87-NEXT: .LBB16_2:
1352 ; X86-X87-NEXT: fxch %st(1)
1353 ; X86-X87-NEXT: fsubr %st(2), %st
1354 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
1355 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %edx
1356 ; X86-X87-NEXT: orl $3072, %edx # imm = 0xC00
1357 ; X86-X87-NEXT: movw %dx, {{[0-9]+}}(%esp)
1358 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1359 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
1360 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1361 ; X86-X87-NEXT: movb %al, %cl
1362 ; X86-X87-NEXT: shll $31, %ecx
1363 ; X86-X87-NEXT: xorl {{[0-9]+}}(%esp), %ecx
1364 ; X86-X87-NEXT: fxch %st(1)
1365 ; X86-X87-NEXT: fucom %st(1)
1366 ; X86-X87-NEXT: fstp %st(1)
1367 ; X86-X87-NEXT: fnstsw %ax
1368 ; X86-X87-NEXT: xorl %edx, %edx
1369 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1370 ; X86-X87-NEXT: sahf
1371 ; X86-X87-NEXT: movl $0, %esi
1372 ; X86-X87-NEXT: jb .LBB16_4
1373 ; X86-X87-NEXT: # %bb.3:
1374 ; X86-X87-NEXT: movl %ecx, %esi
1375 ; X86-X87-NEXT: .LBB16_4:
1376 ; X86-X87-NEXT: jb .LBB16_6
1377 ; X86-X87-NEXT: # %bb.5:
1378 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edx
1379 ; X86-X87-NEXT: .LBB16_6:
1380 ; X86-X87-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}
1381 ; X86-X87-NEXT: fxch %st(1)
1382 ; X86-X87-NEXT: fucompp
1383 ; X86-X87-NEXT: fnstsw %ax
1384 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1385 ; X86-X87-NEXT: sahf
1386 ; X86-X87-NEXT: movl $-1, %eax
1387 ; X86-X87-NEXT: ja .LBB16_8
1388 ; X86-X87-NEXT: # %bb.7:
1389 ; X86-X87-NEXT: movl %edx, %eax
1390 ; X86-X87-NEXT: .LBB16_8:
1391 ; X86-X87-NEXT: movl $262143, %edx # imm = 0x3FFFF
1392 ; X86-X87-NEXT: ja .LBB16_10
1393 ; X86-X87-NEXT: # %bb.9:
1394 ; X86-X87-NEXT: movl %esi, %edx
1395 ; X86-X87-NEXT: .LBB16_10:
1396 ; X86-X87-NEXT: addl $16, %esp
1397 ; X86-X87-NEXT: popl %esi
1398 ; X86-X87-NEXT: retl
1400 ; X86-SSE-LABEL: test_unsigned_i50_f64:
1402 ; X86-SSE-NEXT: pushl %esi
1403 ; X86-SSE-NEXT: subl $16, %esp
1404 ; X86-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
1405 ; X86-SSE-NEXT: movsd {{.*#+}} xmm2 = [9.2233720368547758E+18,0.0E+0]
1406 ; X86-SSE-NEXT: ucomisd %xmm0, %xmm2
1407 ; X86-SSE-NEXT: xorpd %xmm1, %xmm1
1408 ; X86-SSE-NEXT: jbe .LBB16_2
1409 ; X86-SSE-NEXT: # %bb.1:
1410 ; X86-SSE-NEXT: xorpd %xmm2, %xmm2
1411 ; X86-SSE-NEXT: .LBB16_2:
1412 ; X86-SSE-NEXT: movapd %xmm0, %xmm3
1413 ; X86-SSE-NEXT: subsd %xmm2, %xmm3
1414 ; X86-SSE-NEXT: movsd %xmm3, {{[0-9]+}}(%esp)
1415 ; X86-SSE-NEXT: setbe %cl
1416 ; X86-SSE-NEXT: fldl {{[0-9]+}}(%esp)
1417 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
1418 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1419 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
1420 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
1421 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
1422 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
1423 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
1424 ; X86-SSE-NEXT: xorl %eax, %eax
1425 ; X86-SSE-NEXT: ucomisd %xmm1, %xmm0
1426 ; X86-SSE-NEXT: movl $0, %esi
1427 ; X86-SSE-NEXT: jb .LBB16_4
1428 ; X86-SSE-NEXT: # %bb.3:
1429 ; X86-SSE-NEXT: movzbl %cl, %eax
1430 ; X86-SSE-NEXT: shll $31, %eax
1431 ; X86-SSE-NEXT: xorl {{[0-9]+}}(%esp), %eax
1432 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
1433 ; X86-SSE-NEXT: .LBB16_4:
1434 ; X86-SSE-NEXT: ucomisd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1435 ; X86-SSE-NEXT: movl $262143, %edx # imm = 0x3FFFF
1436 ; X86-SSE-NEXT: cmovbel %eax, %edx
1437 ; X86-SSE-NEXT: movl $-1, %eax
1438 ; X86-SSE-NEXT: cmovbel %esi, %eax
1439 ; X86-SSE-NEXT: addl $16, %esp
1440 ; X86-SSE-NEXT: popl %esi
1441 ; X86-SSE-NEXT: retl
1443 ; X64-LABEL: test_unsigned_i50_f64:
1445 ; X64-NEXT: xorpd %xmm1, %xmm1
1446 ; X64-NEXT: maxsd %xmm1, %xmm0
1447 ; X64-NEXT: minsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1448 ; X64-NEXT: cvttsd2si %xmm0, %rax
1450 %x = call i50 @llvm.fptoui.sat.i50.f64(double %f)
1454 define i64 @test_unsigned_i64_f64(double %f) nounwind {
1455 ; X86-X87-LABEL: test_unsigned_i64_f64:
1457 ; X86-X87-NEXT: pushl %edi
1458 ; X86-X87-NEXT: pushl %esi
1459 ; X86-X87-NEXT: subl $20, %esp
1460 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
1461 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
1462 ; X86-X87-NEXT: fucom %st(1)
1463 ; X86-X87-NEXT: fnstsw %ax
1464 ; X86-X87-NEXT: xorl %ecx, %ecx
1465 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1466 ; X86-X87-NEXT: sahf
1467 ; X86-X87-NEXT: setbe %al
1468 ; X86-X87-NEXT: fldz
1469 ; X86-X87-NEXT: jbe .LBB17_2
1470 ; X86-X87-NEXT: # %bb.1:
1471 ; X86-X87-NEXT: fstp %st(1)
1472 ; X86-X87-NEXT: fld %st(0)
1473 ; X86-X87-NEXT: fxch %st(1)
1474 ; X86-X87-NEXT: .LBB17_2:
1475 ; X86-X87-NEXT: fxch %st(1)
1476 ; X86-X87-NEXT: fsubr %st(2), %st
1477 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
1478 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %edx
1479 ; X86-X87-NEXT: orl $3072, %edx # imm = 0xC00
1480 ; X86-X87-NEXT: movw %dx, {{[0-9]+}}(%esp)
1481 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1482 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
1483 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1484 ; X86-X87-NEXT: movb %al, %cl
1485 ; X86-X87-NEXT: shll $31, %ecx
1486 ; X86-X87-NEXT: xorl {{[0-9]+}}(%esp), %ecx
1487 ; X86-X87-NEXT: fxch %st(1)
1488 ; X86-X87-NEXT: fucom %st(1)
1489 ; X86-X87-NEXT: fstp %st(1)
1490 ; X86-X87-NEXT: fnstsw %ax
1491 ; X86-X87-NEXT: xorl %esi, %esi
1492 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1493 ; X86-X87-NEXT: sahf
1494 ; X86-X87-NEXT: movl $0, %edi
1495 ; X86-X87-NEXT: jb .LBB17_4
1496 ; X86-X87-NEXT: # %bb.3:
1497 ; X86-X87-NEXT: movl %ecx, %edi
1498 ; X86-X87-NEXT: .LBB17_4:
1499 ; X86-X87-NEXT: jb .LBB17_6
1500 ; X86-X87-NEXT: # %bb.5:
1501 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %esi
1502 ; X86-X87-NEXT: .LBB17_6:
1503 ; X86-X87-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}
1504 ; X86-X87-NEXT: fxch %st(1)
1505 ; X86-X87-NEXT: fucompp
1506 ; X86-X87-NEXT: fnstsw %ax
1507 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1508 ; X86-X87-NEXT: sahf
1509 ; X86-X87-NEXT: movl $-1, %eax
1510 ; X86-X87-NEXT: movl $-1, %edx
1511 ; X86-X87-NEXT: ja .LBB17_8
1512 ; X86-X87-NEXT: # %bb.7:
1513 ; X86-X87-NEXT: movl %esi, %eax
1514 ; X86-X87-NEXT: movl %edi, %edx
1515 ; X86-X87-NEXT: .LBB17_8:
1516 ; X86-X87-NEXT: addl $20, %esp
1517 ; X86-X87-NEXT: popl %esi
1518 ; X86-X87-NEXT: popl %edi
1519 ; X86-X87-NEXT: retl
1521 ; X86-SSE-LABEL: test_unsigned_i64_f64:
1523 ; X86-SSE-NEXT: subl $20, %esp
1524 ; X86-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
1525 ; X86-SSE-NEXT: movsd {{.*#+}} xmm2 = [9.2233720368547758E+18,0.0E+0]
1526 ; X86-SSE-NEXT: ucomisd %xmm0, %xmm2
1527 ; X86-SSE-NEXT: xorpd %xmm1, %xmm1
1528 ; X86-SSE-NEXT: jbe .LBB17_2
1529 ; X86-SSE-NEXT: # %bb.1:
1530 ; X86-SSE-NEXT: xorpd %xmm2, %xmm2
1531 ; X86-SSE-NEXT: .LBB17_2:
1532 ; X86-SSE-NEXT: movapd %xmm0, %xmm3
1533 ; X86-SSE-NEXT: subsd %xmm2, %xmm3
1534 ; X86-SSE-NEXT: movsd %xmm3, {{[0-9]+}}(%esp)
1535 ; X86-SSE-NEXT: setbe %cl
1536 ; X86-SSE-NEXT: fldl {{[0-9]+}}(%esp)
1537 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
1538 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1539 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
1540 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
1541 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
1542 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
1543 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
1544 ; X86-SSE-NEXT: xorl %edx, %edx
1545 ; X86-SSE-NEXT: ucomisd %xmm1, %xmm0
1546 ; X86-SSE-NEXT: movl $0, %eax
1547 ; X86-SSE-NEXT: jb .LBB17_4
1548 ; X86-SSE-NEXT: # %bb.3:
1549 ; X86-SSE-NEXT: movzbl %cl, %edx
1550 ; X86-SSE-NEXT: shll $31, %edx
1551 ; X86-SSE-NEXT: xorl {{[0-9]+}}(%esp), %edx
1552 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
1553 ; X86-SSE-NEXT: .LBB17_4:
1554 ; X86-SSE-NEXT: ucomisd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1555 ; X86-SSE-NEXT: movl $-1, %ecx
1556 ; X86-SSE-NEXT: cmoval %ecx, %edx
1557 ; X86-SSE-NEXT: cmoval %ecx, %eax
1558 ; X86-SSE-NEXT: addl $20, %esp
1559 ; X86-SSE-NEXT: retl
1561 ; X64-LABEL: test_unsigned_i64_f64:
1563 ; X64-NEXT: cvttsd2si %xmm0, %rax
1564 ; X64-NEXT: movq %rax, %rcx
1565 ; X64-NEXT: sarq $63, %rcx
1566 ; X64-NEXT: movapd %xmm0, %xmm1
1567 ; X64-NEXT: subsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1568 ; X64-NEXT: cvttsd2si %xmm1, %rdx
1569 ; X64-NEXT: andq %rcx, %rdx
1570 ; X64-NEXT: orq %rax, %rdx
1571 ; X64-NEXT: xorl %ecx, %ecx
1572 ; X64-NEXT: xorpd %xmm1, %xmm1
1573 ; X64-NEXT: ucomisd %xmm1, %xmm0
1574 ; X64-NEXT: cmovaeq %rdx, %rcx
1575 ; X64-NEXT: ucomisd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1576 ; X64-NEXT: movq $-1, %rax
1577 ; X64-NEXT: cmovbeq %rcx, %rax
1579 %x = call i64 @llvm.fptoui.sat.i64.f64(double %f)
1583 define i100 @test_unsigned_i100_f64(double %f) nounwind {
1584 ; X86-X87-LABEL: test_unsigned_i100_f64:
1586 ; X86-X87-NEXT: pushl %ebp
1587 ; X86-X87-NEXT: pushl %ebx
1588 ; X86-X87-NEXT: pushl %edi
1589 ; X86-X87-NEXT: pushl %esi
1590 ; X86-X87-NEXT: subl $44, %esp
1591 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
1592 ; X86-X87-NEXT: fstl {{[0-9]+}}(%esp)
1593 ; X86-X87-NEXT: leal {{[0-9]+}}(%esp), %eax
1594 ; X86-X87-NEXT: movl %eax, (%esp)
1595 ; X86-X87-NEXT: fldz
1596 ; X86-X87-NEXT: fxch %st(1)
1597 ; X86-X87-NEXT: fstl {{[-0-9]+}}(%e{{[sb]}}p) # 8-byte Folded Spill
1598 ; X86-X87-NEXT: fucompp
1599 ; X86-X87-NEXT: fnstsw %ax
1600 ; X86-X87-NEXT: movl %eax, %ebx
1601 ; X86-X87-NEXT: calll __fixunsdfti
1602 ; X86-X87-NEXT: subl $4, %esp
1603 ; X86-X87-NEXT: xorl %edi, %edi
1604 ; X86-X87-NEXT: movb %bh, %ah
1605 ; X86-X87-NEXT: sahf
1606 ; X86-X87-NEXT: movl $0, %eax
1607 ; X86-X87-NEXT: jb .LBB18_2
1608 ; X86-X87-NEXT: # %bb.1:
1609 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %eax
1610 ; X86-X87-NEXT: .LBB18_2:
1611 ; X86-X87-NEXT: movl $0, %esi
1612 ; X86-X87-NEXT: movl $0, %ebx
1613 ; X86-X87-NEXT: jb .LBB18_4
1614 ; X86-X87-NEXT: # %bb.3:
1615 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ebx
1616 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %esi
1617 ; X86-X87-NEXT: .LBB18_4:
1618 ; X86-X87-NEXT: jb .LBB18_6
1619 ; X86-X87-NEXT: # %bb.5:
1620 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edi
1621 ; X86-X87-NEXT: .LBB18_6:
1622 ; X86-X87-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1623 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
1624 ; X86-X87-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}
1625 ; X86-X87-NEXT: fldl {{[-0-9]+}}(%e{{[sb]}}p) # 8-byte Folded Reload
1626 ; X86-X87-NEXT: fucompp
1627 ; X86-X87-NEXT: fnstsw %ax
1628 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1629 ; X86-X87-NEXT: sahf
1630 ; X86-X87-NEXT: movl $15, %eax
1631 ; X86-X87-NEXT: ja .LBB18_8
1632 ; X86-X87-NEXT: # %bb.7:
1633 ; X86-X87-NEXT: movl %edi, %eax
1634 ; X86-X87-NEXT: .LBB18_8:
1635 ; X86-X87-NEXT: movl $-1, %edi
1636 ; X86-X87-NEXT: movl $-1, %ebp
1637 ; X86-X87-NEXT: movl $-1, %edx
1638 ; X86-X87-NEXT: ja .LBB18_10
1639 ; X86-X87-NEXT: # %bb.9:
1640 ; X86-X87-NEXT: movl %ebx, %edi
1641 ; X86-X87-NEXT: movl %esi, %ebp
1642 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
1643 ; X86-X87-NEXT: .LBB18_10:
1644 ; X86-X87-NEXT: movl %edx, 8(%ecx)
1645 ; X86-X87-NEXT: movl %ebp, 4(%ecx)
1646 ; X86-X87-NEXT: movl %edi, (%ecx)
1647 ; X86-X87-NEXT: andl $15, %eax
1648 ; X86-X87-NEXT: movb %al, 12(%ecx)
1649 ; X86-X87-NEXT: movl %ecx, %eax
1650 ; X86-X87-NEXT: addl $44, %esp
1651 ; X86-X87-NEXT: popl %esi
1652 ; X86-X87-NEXT: popl %edi
1653 ; X86-X87-NEXT: popl %ebx
1654 ; X86-X87-NEXT: popl %ebp
1655 ; X86-X87-NEXT: retl $4
1657 ; X86-SSE-LABEL: test_unsigned_i100_f64:
1659 ; X86-SSE-NEXT: pushl %ebx
1660 ; X86-SSE-NEXT: pushl %edi
1661 ; X86-SSE-NEXT: pushl %esi
1662 ; X86-SSE-NEXT: subl $32, %esp
1663 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
1664 ; X86-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
1665 ; X86-SSE-NEXT: movsd %xmm0, {{[0-9]+}}(%esp)
1666 ; X86-SSE-NEXT: leal {{[0-9]+}}(%esp), %eax
1667 ; X86-SSE-NEXT: movl %eax, (%esp)
1668 ; X86-SSE-NEXT: calll __fixunsdfti
1669 ; X86-SSE-NEXT: subl $4, %esp
1670 ; X86-SSE-NEXT: xorl %eax, %eax
1671 ; X86-SSE-NEXT: xorpd %xmm0, %xmm0
1672 ; X86-SSE-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
1673 ; X86-SSE-NEXT: ucomisd %xmm0, %xmm1
1674 ; X86-SSE-NEXT: movapd %xmm1, %xmm0
1675 ; X86-SSE-NEXT: movl $0, %ecx
1676 ; X86-SSE-NEXT: movl $0, %edx
1677 ; X86-SSE-NEXT: movl $0, %edi
1678 ; X86-SSE-NEXT: jb .LBB18_2
1679 ; X86-SSE-NEXT: # %bb.1:
1680 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
1681 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
1682 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edx
1683 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edi
1684 ; X86-SSE-NEXT: .LBB18_2:
1685 ; X86-SSE-NEXT: ucomisd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1686 ; X86-SSE-NEXT: movl $15, %ebx
1687 ; X86-SSE-NEXT: cmovbel %edi, %ebx
1688 ; X86-SSE-NEXT: movl $-1, %edi
1689 ; X86-SSE-NEXT: cmoval %edi, %edx
1690 ; X86-SSE-NEXT: cmoval %edi, %ecx
1691 ; X86-SSE-NEXT: cmoval %edi, %eax
1692 ; X86-SSE-NEXT: movl %eax, 8(%esi)
1693 ; X86-SSE-NEXT: movl %ecx, 4(%esi)
1694 ; X86-SSE-NEXT: movl %edx, (%esi)
1695 ; X86-SSE-NEXT: andl $15, %ebx
1696 ; X86-SSE-NEXT: movb %bl, 12(%esi)
1697 ; X86-SSE-NEXT: movl %esi, %eax
1698 ; X86-SSE-NEXT: addl $32, %esp
1699 ; X86-SSE-NEXT: popl %esi
1700 ; X86-SSE-NEXT: popl %edi
1701 ; X86-SSE-NEXT: popl %ebx
1702 ; X86-SSE-NEXT: retl $4
1704 ; X64-LABEL: test_unsigned_i100_f64:
1706 ; X64-NEXT: pushq %rax
1707 ; X64-NEXT: movsd %xmm0, (%rsp) # 8-byte Spill
1708 ; X64-NEXT: callq __fixunsdfti@PLT
1709 ; X64-NEXT: xorl %ecx, %ecx
1710 ; X64-NEXT: xorpd %xmm0, %xmm0
1711 ; X64-NEXT: movsd (%rsp), %xmm1 # 8-byte Reload
1712 ; X64-NEXT: # xmm1 = mem[0],zero
1713 ; X64-NEXT: ucomisd %xmm0, %xmm1
1714 ; X64-NEXT: cmovbq %rcx, %rdx
1715 ; X64-NEXT: cmovbq %rcx, %rax
1716 ; X64-NEXT: ucomisd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1717 ; X64-NEXT: movq $-1, %rcx
1718 ; X64-NEXT: cmovaq %rcx, %rax
1719 ; X64-NEXT: movabsq $68719476735, %rcx # imm = 0xFFFFFFFFF
1720 ; X64-NEXT: cmovaq %rcx, %rdx
1721 ; X64-NEXT: popq %rcx
1723 %x = call i100 @llvm.fptoui.sat.i100.f64(double %f)
1727 define i128 @test_unsigned_i128_f64(double %f) nounwind {
1728 ; X86-X87-LABEL: test_unsigned_i128_f64:
1730 ; X86-X87-NEXT: pushl %ebp
1731 ; X86-X87-NEXT: pushl %ebx
1732 ; X86-X87-NEXT: pushl %edi
1733 ; X86-X87-NEXT: pushl %esi
1734 ; X86-X87-NEXT: subl $60, %esp
1735 ; X86-X87-NEXT: fldl {{[0-9]+}}(%esp)
1736 ; X86-X87-NEXT: fstl {{[0-9]+}}(%esp)
1737 ; X86-X87-NEXT: leal {{[0-9]+}}(%esp), %eax
1738 ; X86-X87-NEXT: movl %eax, (%esp)
1739 ; X86-X87-NEXT: fldz
1740 ; X86-X87-NEXT: fxch %st(1)
1741 ; X86-X87-NEXT: fstl {{[-0-9]+}}(%e{{[sb]}}p) # 8-byte Folded Spill
1742 ; X86-X87-NEXT: fucompp
1743 ; X86-X87-NEXT: fnstsw %ax
1744 ; X86-X87-NEXT: movl %eax, %ebx
1745 ; X86-X87-NEXT: calll __fixunsdfti
1746 ; X86-X87-NEXT: subl $4, %esp
1747 ; X86-X87-NEXT: xorl %edx, %edx
1748 ; X86-X87-NEXT: movb %bh, %ah
1749 ; X86-X87-NEXT: sahf
1750 ; X86-X87-NEXT: movl $0, %eax
1751 ; X86-X87-NEXT: jb .LBB19_2
1752 ; X86-X87-NEXT: # %bb.1:
1753 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %eax
1754 ; X86-X87-NEXT: .LBB19_2:
1755 ; X86-X87-NEXT: movl $0, %ecx
1756 ; X86-X87-NEXT: jb .LBB19_4
1757 ; X86-X87-NEXT: # %bb.3:
1758 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
1759 ; X86-X87-NEXT: .LBB19_4:
1760 ; X86-X87-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1761 ; X86-X87-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
1762 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
1763 ; X86-X87-NEXT: movl $0, %ebx
1764 ; X86-X87-NEXT: jb .LBB19_6
1765 ; X86-X87-NEXT: # %bb.5:
1766 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ebx
1767 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edx
1768 ; X86-X87-NEXT: .LBB19_6:
1769 ; X86-X87-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}
1770 ; X86-X87-NEXT: fldl {{[-0-9]+}}(%e{{[sb]}}p) # 8-byte Folded Reload
1771 ; X86-X87-NEXT: fucompp
1772 ; X86-X87-NEXT: fnstsw %ax
1773 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1774 ; X86-X87-NEXT: sahf
1775 ; X86-X87-NEXT: movl $-1, %eax
1776 ; X86-X87-NEXT: movl $-1, %ebp
1777 ; X86-X87-NEXT: movl $-1, %edi
1778 ; X86-X87-NEXT: movl $-1, %esi
1779 ; X86-X87-NEXT: ja .LBB19_8
1780 ; X86-X87-NEXT: # %bb.7:
1781 ; X86-X87-NEXT: movl %ebx, %eax
1782 ; X86-X87-NEXT: movl %edx, %ebp
1783 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
1784 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
1785 ; X86-X87-NEXT: .LBB19_8:
1786 ; X86-X87-NEXT: movl %esi, 12(%ecx)
1787 ; X86-X87-NEXT: movl %edi, 8(%ecx)
1788 ; X86-X87-NEXT: movl %ebp, 4(%ecx)
1789 ; X86-X87-NEXT: movl %eax, (%ecx)
1790 ; X86-X87-NEXT: movl %ecx, %eax
1791 ; X86-X87-NEXT: addl $60, %esp
1792 ; X86-X87-NEXT: popl %esi
1793 ; X86-X87-NEXT: popl %edi
1794 ; X86-X87-NEXT: popl %ebx
1795 ; X86-X87-NEXT: popl %ebp
1796 ; X86-X87-NEXT: retl $4
1798 ; X86-SSE-LABEL: test_unsigned_i128_f64:
1800 ; X86-SSE-NEXT: pushl %ebx
1801 ; X86-SSE-NEXT: pushl %edi
1802 ; X86-SSE-NEXT: pushl %esi
1803 ; X86-SSE-NEXT: subl $32, %esp
1804 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
1805 ; X86-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
1806 ; X86-SSE-NEXT: movsd %xmm0, {{[0-9]+}}(%esp)
1807 ; X86-SSE-NEXT: leal {{[0-9]+}}(%esp), %eax
1808 ; X86-SSE-NEXT: movl %eax, (%esp)
1809 ; X86-SSE-NEXT: calll __fixunsdfti
1810 ; X86-SSE-NEXT: subl $4, %esp
1811 ; X86-SSE-NEXT: xorl %eax, %eax
1812 ; X86-SSE-NEXT: xorpd %xmm0, %xmm0
1813 ; X86-SSE-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
1814 ; X86-SSE-NEXT: ucomisd %xmm0, %xmm1
1815 ; X86-SSE-NEXT: movapd %xmm1, %xmm0
1816 ; X86-SSE-NEXT: movl $0, %ecx
1817 ; X86-SSE-NEXT: movl $0, %edx
1818 ; X86-SSE-NEXT: movl $0, %edi
1819 ; X86-SSE-NEXT: jb .LBB19_2
1820 ; X86-SSE-NEXT: # %bb.1:
1821 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
1822 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
1823 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edx
1824 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edi
1825 ; X86-SSE-NEXT: .LBB19_2:
1826 ; X86-SSE-NEXT: ucomisd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1827 ; X86-SSE-NEXT: movl $-1, %ebx
1828 ; X86-SSE-NEXT: cmoval %ebx, %edi
1829 ; X86-SSE-NEXT: cmoval %ebx, %edx
1830 ; X86-SSE-NEXT: cmoval %ebx, %ecx
1831 ; X86-SSE-NEXT: cmoval %ebx, %eax
1832 ; X86-SSE-NEXT: movl %eax, 12(%esi)
1833 ; X86-SSE-NEXT: movl %ecx, 8(%esi)
1834 ; X86-SSE-NEXT: movl %edx, 4(%esi)
1835 ; X86-SSE-NEXT: movl %edi, (%esi)
1836 ; X86-SSE-NEXT: movl %esi, %eax
1837 ; X86-SSE-NEXT: addl $32, %esp
1838 ; X86-SSE-NEXT: popl %esi
1839 ; X86-SSE-NEXT: popl %edi
1840 ; X86-SSE-NEXT: popl %ebx
1841 ; X86-SSE-NEXT: retl $4
1843 ; X64-LABEL: test_unsigned_i128_f64:
1845 ; X64-NEXT: pushq %rax
1846 ; X64-NEXT: movsd %xmm0, (%rsp) # 8-byte Spill
1847 ; X64-NEXT: callq __fixunsdfti@PLT
1848 ; X64-NEXT: xorl %ecx, %ecx
1849 ; X64-NEXT: xorpd %xmm0, %xmm0
1850 ; X64-NEXT: movsd (%rsp), %xmm1 # 8-byte Reload
1851 ; X64-NEXT: # xmm1 = mem[0],zero
1852 ; X64-NEXT: ucomisd %xmm0, %xmm1
1853 ; X64-NEXT: cmovbq %rcx, %rdx
1854 ; X64-NEXT: cmovbq %rcx, %rax
1855 ; X64-NEXT: ucomisd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1856 ; X64-NEXT: movq $-1, %rcx
1857 ; X64-NEXT: cmovaq %rcx, %rax
1858 ; X64-NEXT: cmovaq %rcx, %rdx
1859 ; X64-NEXT: popq %rcx
1861 %x = call i128 @llvm.fptoui.sat.i128.f64(double %f)
1866 ; 16-bit float to unsigned integer
1869 declare i1 @llvm.fptoui.sat.i1.f16 (half)
1870 declare i8 @llvm.fptoui.sat.i8.f16 (half)
1871 declare i13 @llvm.fptoui.sat.i13.f16 (half)
1872 declare i16 @llvm.fptoui.sat.i16.f16 (half)
1873 declare i19 @llvm.fptoui.sat.i19.f16 (half)
1874 declare i32 @llvm.fptoui.sat.i32.f16 (half)
1875 declare i50 @llvm.fptoui.sat.i50.f16 (half)
1876 declare i64 @llvm.fptoui.sat.i64.f16 (half)
1877 declare i100 @llvm.fptoui.sat.i100.f16(half)
1878 declare i128 @llvm.fptoui.sat.i128.f16(half)
1880 define i1 @test_unsigned_i1_f16(half %f) nounwind {
1881 ; X86-X87-LABEL: test_unsigned_i1_f16:
1883 ; X86-X87-NEXT: subl $12, %esp
1884 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1885 ; X86-X87-NEXT: movl %eax, (%esp)
1886 ; X86-X87-NEXT: calll __gnu_h2f_ieee
1887 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
1888 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1889 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
1890 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
1891 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1892 ; X86-X87-NEXT: fists {{[0-9]+}}(%esp)
1893 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1894 ; X86-X87-NEXT: fldz
1895 ; X86-X87-NEXT: fxch %st(1)
1896 ; X86-X87-NEXT: fucom %st(1)
1897 ; X86-X87-NEXT: fstp %st(1)
1898 ; X86-X87-NEXT: fnstsw %ax
1899 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1900 ; X86-X87-NEXT: sahf
1901 ; X86-X87-NEXT: jb .LBB20_1
1902 ; X86-X87-NEXT: # %bb.2:
1903 ; X86-X87-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
1904 ; X86-X87-NEXT: jmp .LBB20_3
1905 ; X86-X87-NEXT: .LBB20_1:
1906 ; X86-X87-NEXT: xorl %ecx, %ecx
1907 ; X86-X87-NEXT: .LBB20_3:
1908 ; X86-X87-NEXT: fld1
1909 ; X86-X87-NEXT: fxch %st(1)
1910 ; X86-X87-NEXT: fucompp
1911 ; X86-X87-NEXT: fnstsw %ax
1912 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1913 ; X86-X87-NEXT: sahf
1914 ; X86-X87-NEXT: movb $1, %al
1915 ; X86-X87-NEXT: ja .LBB20_5
1916 ; X86-X87-NEXT: # %bb.4:
1917 ; X86-X87-NEXT: movl %ecx, %eax
1918 ; X86-X87-NEXT: .LBB20_5:
1919 ; X86-X87-NEXT: addl $12, %esp
1920 ; X86-X87-NEXT: retl
1922 ; X86-SSE-LABEL: test_unsigned_i1_f16:
1924 ; X86-SSE-NEXT: subl $12, %esp
1925 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
1926 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
1927 ; X86-SSE-NEXT: movw %ax, (%esp)
1928 ; X86-SSE-NEXT: calll __extendhfsf2
1929 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
1930 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1931 ; X86-SSE-NEXT: cvttss2si %xmm0, %eax
1932 ; X86-SSE-NEXT: xorl %ecx, %ecx
1933 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
1934 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
1935 ; X86-SSE-NEXT: cmovael %eax, %ecx
1936 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1937 ; X86-SSE-NEXT: movl $1, %eax
1938 ; X86-SSE-NEXT: cmovbel %ecx, %eax
1939 ; X86-SSE-NEXT: # kill: def $al killed $al killed $eax
1940 ; X86-SSE-NEXT: addl $12, %esp
1941 ; X86-SSE-NEXT: retl
1943 ; X64-LABEL: test_unsigned_i1_f16:
1945 ; X64-NEXT: pushq %rax
1946 ; X64-NEXT: callq __extendhfsf2@PLT
1947 ; X64-NEXT: cvttss2si %xmm0, %eax
1948 ; X64-NEXT: xorl %ecx, %ecx
1949 ; X64-NEXT: xorps %xmm1, %xmm1
1950 ; X64-NEXT: ucomiss %xmm1, %xmm0
1951 ; X64-NEXT: cmovael %eax, %ecx
1952 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1953 ; X64-NEXT: movl $1, %eax
1954 ; X64-NEXT: cmovbel %ecx, %eax
1955 ; X64-NEXT: # kill: def $al killed $al killed $eax
1956 ; X64-NEXT: popq %rcx
1958 %x = call i1 @llvm.fptoui.sat.i1.f16(half %f)
1962 define i8 @test_unsigned_i8_f16(half %f) nounwind {
1963 ; X86-X87-LABEL: test_unsigned_i8_f16:
1965 ; X86-X87-NEXT: subl $12, %esp
1966 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1967 ; X86-X87-NEXT: movl %eax, (%esp)
1968 ; X86-X87-NEXT: calll __gnu_h2f_ieee
1969 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
1970 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1971 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
1972 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
1973 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1974 ; X86-X87-NEXT: fists {{[0-9]+}}(%esp)
1975 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
1976 ; X86-X87-NEXT: fldz
1977 ; X86-X87-NEXT: fxch %st(1)
1978 ; X86-X87-NEXT: fucom %st(1)
1979 ; X86-X87-NEXT: fstp %st(1)
1980 ; X86-X87-NEXT: fnstsw %ax
1981 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1982 ; X86-X87-NEXT: sahf
1983 ; X86-X87-NEXT: jb .LBB21_1
1984 ; X86-X87-NEXT: # %bb.2:
1985 ; X86-X87-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
1986 ; X86-X87-NEXT: jmp .LBB21_3
1987 ; X86-X87-NEXT: .LBB21_1:
1988 ; X86-X87-NEXT: xorl %ecx, %ecx
1989 ; X86-X87-NEXT: .LBB21_3:
1990 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
1991 ; X86-X87-NEXT: fxch %st(1)
1992 ; X86-X87-NEXT: fucompp
1993 ; X86-X87-NEXT: fnstsw %ax
1994 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
1995 ; X86-X87-NEXT: sahf
1996 ; X86-X87-NEXT: movb $-1, %al
1997 ; X86-X87-NEXT: ja .LBB21_5
1998 ; X86-X87-NEXT: # %bb.4:
1999 ; X86-X87-NEXT: movl %ecx, %eax
2000 ; X86-X87-NEXT: .LBB21_5:
2001 ; X86-X87-NEXT: addl $12, %esp
2002 ; X86-X87-NEXT: retl
2004 ; X86-SSE-LABEL: test_unsigned_i8_f16:
2006 ; X86-SSE-NEXT: subl $12, %esp
2007 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
2008 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
2009 ; X86-SSE-NEXT: movw %ax, (%esp)
2010 ; X86-SSE-NEXT: calll __extendhfsf2
2011 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
2012 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2013 ; X86-SSE-NEXT: cvttss2si %xmm0, %eax
2014 ; X86-SSE-NEXT: xorl %ecx, %ecx
2015 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
2016 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
2017 ; X86-SSE-NEXT: cmovael %eax, %ecx
2018 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2019 ; X86-SSE-NEXT: movl $255, %eax
2020 ; X86-SSE-NEXT: cmovbel %ecx, %eax
2021 ; X86-SSE-NEXT: # kill: def $al killed $al killed $eax
2022 ; X86-SSE-NEXT: addl $12, %esp
2023 ; X86-SSE-NEXT: retl
2025 ; X64-LABEL: test_unsigned_i8_f16:
2027 ; X64-NEXT: pushq %rax
2028 ; X64-NEXT: callq __extendhfsf2@PLT
2029 ; X64-NEXT: cvttss2si %xmm0, %eax
2030 ; X64-NEXT: xorl %ecx, %ecx
2031 ; X64-NEXT: xorps %xmm1, %xmm1
2032 ; X64-NEXT: ucomiss %xmm1, %xmm0
2033 ; X64-NEXT: cmovael %eax, %ecx
2034 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
2035 ; X64-NEXT: movl $255, %eax
2036 ; X64-NEXT: cmovbel %ecx, %eax
2037 ; X64-NEXT: # kill: def $al killed $al killed $eax
2038 ; X64-NEXT: popq %rcx
2040 %x = call i8 @llvm.fptoui.sat.i8.f16(half %f)
2044 define i13 @test_unsigned_i13_f16(half %f) nounwind {
2045 ; X86-X87-LABEL: test_unsigned_i13_f16:
2047 ; X86-X87-NEXT: subl $12, %esp
2048 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2049 ; X86-X87-NEXT: movl %eax, (%esp)
2050 ; X86-X87-NEXT: calll __gnu_h2f_ieee
2051 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
2052 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2053 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
2054 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
2055 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2056 ; X86-X87-NEXT: fistl {{[0-9]+}}(%esp)
2057 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2058 ; X86-X87-NEXT: fldz
2059 ; X86-X87-NEXT: fxch %st(1)
2060 ; X86-X87-NEXT: fucom %st(1)
2061 ; X86-X87-NEXT: fstp %st(1)
2062 ; X86-X87-NEXT: fnstsw %ax
2063 ; X86-X87-NEXT: xorl %ecx, %ecx
2064 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2065 ; X86-X87-NEXT: sahf
2066 ; X86-X87-NEXT: jb .LBB22_2
2067 ; X86-X87-NEXT: # %bb.1:
2068 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
2069 ; X86-X87-NEXT: .LBB22_2:
2070 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2071 ; X86-X87-NEXT: fxch %st(1)
2072 ; X86-X87-NEXT: fucompp
2073 ; X86-X87-NEXT: fnstsw %ax
2074 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2075 ; X86-X87-NEXT: sahf
2076 ; X86-X87-NEXT: movl $8191, %eax # imm = 0x1FFF
2077 ; X86-X87-NEXT: ja .LBB22_4
2078 ; X86-X87-NEXT: # %bb.3:
2079 ; X86-X87-NEXT: movl %ecx, %eax
2080 ; X86-X87-NEXT: .LBB22_4:
2081 ; X86-X87-NEXT: # kill: def $ax killed $ax killed $eax
2082 ; X86-X87-NEXT: addl $12, %esp
2083 ; X86-X87-NEXT: retl
2085 ; X86-SSE-LABEL: test_unsigned_i13_f16:
2087 ; X86-SSE-NEXT: subl $12, %esp
2088 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
2089 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
2090 ; X86-SSE-NEXT: movw %ax, (%esp)
2091 ; X86-SSE-NEXT: calll __extendhfsf2
2092 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
2093 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2094 ; X86-SSE-NEXT: cvttss2si %xmm0, %eax
2095 ; X86-SSE-NEXT: xorl %ecx, %ecx
2096 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
2097 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
2098 ; X86-SSE-NEXT: cmovael %eax, %ecx
2099 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2100 ; X86-SSE-NEXT: movl $8191, %eax # imm = 0x1FFF
2101 ; X86-SSE-NEXT: cmovbel %ecx, %eax
2102 ; X86-SSE-NEXT: # kill: def $ax killed $ax killed $eax
2103 ; X86-SSE-NEXT: addl $12, %esp
2104 ; X86-SSE-NEXT: retl
2106 ; X64-LABEL: test_unsigned_i13_f16:
2108 ; X64-NEXT: pushq %rax
2109 ; X64-NEXT: callq __extendhfsf2@PLT
2110 ; X64-NEXT: cvttss2si %xmm0, %eax
2111 ; X64-NEXT: xorl %ecx, %ecx
2112 ; X64-NEXT: xorps %xmm1, %xmm1
2113 ; X64-NEXT: ucomiss %xmm1, %xmm0
2114 ; X64-NEXT: cmovael %eax, %ecx
2115 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
2116 ; X64-NEXT: movl $8191, %eax # imm = 0x1FFF
2117 ; X64-NEXT: cmovbel %ecx, %eax
2118 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
2119 ; X64-NEXT: popq %rcx
2121 %x = call i13 @llvm.fptoui.sat.i13.f16(half %f)
2125 define i16 @test_unsigned_i16_f16(half %f) nounwind {
2126 ; X86-X87-LABEL: test_unsigned_i16_f16:
2128 ; X86-X87-NEXT: subl $12, %esp
2129 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2130 ; X86-X87-NEXT: movl %eax, (%esp)
2131 ; X86-X87-NEXT: calll __gnu_h2f_ieee
2132 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
2133 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2134 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
2135 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
2136 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2137 ; X86-X87-NEXT: fistl {{[0-9]+}}(%esp)
2138 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2139 ; X86-X87-NEXT: fldz
2140 ; X86-X87-NEXT: fxch %st(1)
2141 ; X86-X87-NEXT: fucom %st(1)
2142 ; X86-X87-NEXT: fstp %st(1)
2143 ; X86-X87-NEXT: fnstsw %ax
2144 ; X86-X87-NEXT: xorl %ecx, %ecx
2145 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2146 ; X86-X87-NEXT: sahf
2147 ; X86-X87-NEXT: jb .LBB23_2
2148 ; X86-X87-NEXT: # %bb.1:
2149 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
2150 ; X86-X87-NEXT: .LBB23_2:
2151 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2152 ; X86-X87-NEXT: fxch %st(1)
2153 ; X86-X87-NEXT: fucompp
2154 ; X86-X87-NEXT: fnstsw %ax
2155 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2156 ; X86-X87-NEXT: sahf
2157 ; X86-X87-NEXT: movl $65535, %eax # imm = 0xFFFF
2158 ; X86-X87-NEXT: ja .LBB23_4
2159 ; X86-X87-NEXT: # %bb.3:
2160 ; X86-X87-NEXT: movl %ecx, %eax
2161 ; X86-X87-NEXT: .LBB23_4:
2162 ; X86-X87-NEXT: # kill: def $ax killed $ax killed $eax
2163 ; X86-X87-NEXT: addl $12, %esp
2164 ; X86-X87-NEXT: retl
2166 ; X86-SSE-LABEL: test_unsigned_i16_f16:
2168 ; X86-SSE-NEXT: subl $12, %esp
2169 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
2170 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
2171 ; X86-SSE-NEXT: movw %ax, (%esp)
2172 ; X86-SSE-NEXT: calll __extendhfsf2
2173 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
2174 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2175 ; X86-SSE-NEXT: cvttss2si %xmm0, %eax
2176 ; X86-SSE-NEXT: xorl %ecx, %ecx
2177 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
2178 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
2179 ; X86-SSE-NEXT: cmovael %eax, %ecx
2180 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2181 ; X86-SSE-NEXT: movl $65535, %eax # imm = 0xFFFF
2182 ; X86-SSE-NEXT: cmovbel %ecx, %eax
2183 ; X86-SSE-NEXT: # kill: def $ax killed $ax killed $eax
2184 ; X86-SSE-NEXT: addl $12, %esp
2185 ; X86-SSE-NEXT: retl
2187 ; X64-LABEL: test_unsigned_i16_f16:
2189 ; X64-NEXT: pushq %rax
2190 ; X64-NEXT: callq __extendhfsf2@PLT
2191 ; X64-NEXT: cvttss2si %xmm0, %eax
2192 ; X64-NEXT: xorl %ecx, %ecx
2193 ; X64-NEXT: xorps %xmm1, %xmm1
2194 ; X64-NEXT: ucomiss %xmm1, %xmm0
2195 ; X64-NEXT: cmovael %eax, %ecx
2196 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
2197 ; X64-NEXT: movl $65535, %eax # imm = 0xFFFF
2198 ; X64-NEXT: cmovbel %ecx, %eax
2199 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
2200 ; X64-NEXT: popq %rcx
2202 %x = call i16 @llvm.fptoui.sat.i16.f16(half %f)
2206 define i19 @test_unsigned_i19_f16(half %f) nounwind {
2207 ; X86-X87-LABEL: test_unsigned_i19_f16:
2209 ; X86-X87-NEXT: subl $28, %esp
2210 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2211 ; X86-X87-NEXT: movl %eax, (%esp)
2212 ; X86-X87-NEXT: calll __gnu_h2f_ieee
2213 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
2214 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2215 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
2216 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
2217 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2218 ; X86-X87-NEXT: fld %st(0)
2219 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
2220 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2221 ; X86-X87-NEXT: fldz
2222 ; X86-X87-NEXT: fxch %st(1)
2223 ; X86-X87-NEXT: fucom %st(1)
2224 ; X86-X87-NEXT: fstp %st(1)
2225 ; X86-X87-NEXT: fnstsw %ax
2226 ; X86-X87-NEXT: xorl %ecx, %ecx
2227 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2228 ; X86-X87-NEXT: sahf
2229 ; X86-X87-NEXT: jb .LBB24_2
2230 ; X86-X87-NEXT: # %bb.1:
2231 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
2232 ; X86-X87-NEXT: .LBB24_2:
2233 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2234 ; X86-X87-NEXT: fxch %st(1)
2235 ; X86-X87-NEXT: fucompp
2236 ; X86-X87-NEXT: fnstsw %ax
2237 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2238 ; X86-X87-NEXT: sahf
2239 ; X86-X87-NEXT: movl $524287, %eax # imm = 0x7FFFF
2240 ; X86-X87-NEXT: ja .LBB24_4
2241 ; X86-X87-NEXT: # %bb.3:
2242 ; X86-X87-NEXT: movl %ecx, %eax
2243 ; X86-X87-NEXT: .LBB24_4:
2244 ; X86-X87-NEXT: addl $28, %esp
2245 ; X86-X87-NEXT: retl
2247 ; X86-SSE-LABEL: test_unsigned_i19_f16:
2249 ; X86-SSE-NEXT: subl $12, %esp
2250 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
2251 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
2252 ; X86-SSE-NEXT: movw %ax, (%esp)
2253 ; X86-SSE-NEXT: calll __extendhfsf2
2254 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
2255 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2256 ; X86-SSE-NEXT: cvttss2si %xmm0, %eax
2257 ; X86-SSE-NEXT: movl %eax, %ecx
2258 ; X86-SSE-NEXT: sarl $31, %ecx
2259 ; X86-SSE-NEXT: movaps %xmm0, %xmm1
2260 ; X86-SSE-NEXT: subss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
2261 ; X86-SSE-NEXT: cvttss2si %xmm1, %edx
2262 ; X86-SSE-NEXT: andl %ecx, %edx
2263 ; X86-SSE-NEXT: orl %eax, %edx
2264 ; X86-SSE-NEXT: xorl %ecx, %ecx
2265 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
2266 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
2267 ; X86-SSE-NEXT: cmovael %edx, %ecx
2268 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2269 ; X86-SSE-NEXT: movl $524287, %eax # imm = 0x7FFFF
2270 ; X86-SSE-NEXT: cmovbel %ecx, %eax
2271 ; X86-SSE-NEXT: addl $12, %esp
2272 ; X86-SSE-NEXT: retl
2274 ; X64-LABEL: test_unsigned_i19_f16:
2276 ; X64-NEXT: pushq %rax
2277 ; X64-NEXT: callq __extendhfsf2@PLT
2278 ; X64-NEXT: cvttss2si %xmm0, %rax
2279 ; X64-NEXT: xorl %ecx, %ecx
2280 ; X64-NEXT: xorps %xmm1, %xmm1
2281 ; X64-NEXT: ucomiss %xmm1, %xmm0
2282 ; X64-NEXT: cmovael %eax, %ecx
2283 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
2284 ; X64-NEXT: movl $524287, %eax # imm = 0x7FFFF
2285 ; X64-NEXT: cmovbel %ecx, %eax
2286 ; X64-NEXT: popq %rcx
2288 %x = call i19 @llvm.fptoui.sat.i19.f16(half %f)
2292 define i32 @test_unsigned_i32_f16(half %f) nounwind {
2293 ; X86-X87-LABEL: test_unsigned_i32_f16:
2295 ; X86-X87-NEXT: subl $28, %esp
2296 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2297 ; X86-X87-NEXT: movl %eax, (%esp)
2298 ; X86-X87-NEXT: calll __gnu_h2f_ieee
2299 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
2300 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2301 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
2302 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
2303 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2304 ; X86-X87-NEXT: fld %st(0)
2305 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
2306 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2307 ; X86-X87-NEXT: fldz
2308 ; X86-X87-NEXT: fxch %st(1)
2309 ; X86-X87-NEXT: fucom %st(1)
2310 ; X86-X87-NEXT: fstp %st(1)
2311 ; X86-X87-NEXT: fnstsw %ax
2312 ; X86-X87-NEXT: xorl %ecx, %ecx
2313 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2314 ; X86-X87-NEXT: sahf
2315 ; X86-X87-NEXT: jb .LBB25_2
2316 ; X86-X87-NEXT: # %bb.1:
2317 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
2318 ; X86-X87-NEXT: .LBB25_2:
2319 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2320 ; X86-X87-NEXT: fxch %st(1)
2321 ; X86-X87-NEXT: fucompp
2322 ; X86-X87-NEXT: fnstsw %ax
2323 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2324 ; X86-X87-NEXT: sahf
2325 ; X86-X87-NEXT: movl $-1, %eax
2326 ; X86-X87-NEXT: ja .LBB25_4
2327 ; X86-X87-NEXT: # %bb.3:
2328 ; X86-X87-NEXT: movl %ecx, %eax
2329 ; X86-X87-NEXT: .LBB25_4:
2330 ; X86-X87-NEXT: addl $28, %esp
2331 ; X86-X87-NEXT: retl
2333 ; X86-SSE-LABEL: test_unsigned_i32_f16:
2335 ; X86-SSE-NEXT: subl $12, %esp
2336 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
2337 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
2338 ; X86-SSE-NEXT: movw %ax, (%esp)
2339 ; X86-SSE-NEXT: calll __extendhfsf2
2340 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
2341 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2342 ; X86-SSE-NEXT: cvttss2si %xmm0, %eax
2343 ; X86-SSE-NEXT: movl %eax, %ecx
2344 ; X86-SSE-NEXT: sarl $31, %ecx
2345 ; X86-SSE-NEXT: movaps %xmm0, %xmm1
2346 ; X86-SSE-NEXT: subss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
2347 ; X86-SSE-NEXT: cvttss2si %xmm1, %edx
2348 ; X86-SSE-NEXT: andl %ecx, %edx
2349 ; X86-SSE-NEXT: orl %eax, %edx
2350 ; X86-SSE-NEXT: xorl %ecx, %ecx
2351 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
2352 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
2353 ; X86-SSE-NEXT: cmovael %edx, %ecx
2354 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2355 ; X86-SSE-NEXT: movl $-1, %eax
2356 ; X86-SSE-NEXT: cmovbel %ecx, %eax
2357 ; X86-SSE-NEXT: addl $12, %esp
2358 ; X86-SSE-NEXT: retl
2360 ; X64-LABEL: test_unsigned_i32_f16:
2362 ; X64-NEXT: pushq %rax
2363 ; X64-NEXT: callq __extendhfsf2@PLT
2364 ; X64-NEXT: cvttss2si %xmm0, %rax
2365 ; X64-NEXT: xorl %ecx, %ecx
2366 ; X64-NEXT: xorps %xmm1, %xmm1
2367 ; X64-NEXT: ucomiss %xmm1, %xmm0
2368 ; X64-NEXT: cmovael %eax, %ecx
2369 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
2370 ; X64-NEXT: movl $-1, %eax
2371 ; X64-NEXT: cmovbel %ecx, %eax
2372 ; X64-NEXT: popq %rcx
2374 %x = call i32 @llvm.fptoui.sat.i32.f16(half %f)
2378 define i50 @test_unsigned_i50_f16(half %f) nounwind {
2379 ; X86-X87-LABEL: test_unsigned_i50_f16:
2381 ; X86-X87-NEXT: pushl %esi
2382 ; X86-X87-NEXT: subl $24, %esp
2383 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2384 ; X86-X87-NEXT: movl %eax, (%esp)
2385 ; X86-X87-NEXT: calll __gnu_h2f_ieee
2386 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2387 ; X86-X87-NEXT: fxch %st(1)
2388 ; X86-X87-NEXT: fucom %st(1)
2389 ; X86-X87-NEXT: fnstsw %ax
2390 ; X86-X87-NEXT: xorl %ecx, %ecx
2391 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2392 ; X86-X87-NEXT: sahf
2393 ; X86-X87-NEXT: setae %al
2394 ; X86-X87-NEXT: fldz
2395 ; X86-X87-NEXT: jae .LBB26_2
2396 ; X86-X87-NEXT: # %bb.1:
2397 ; X86-X87-NEXT: fstp %st(2)
2398 ; X86-X87-NEXT: fld %st(1)
2399 ; X86-X87-NEXT: fxch %st(2)
2400 ; X86-X87-NEXT: .LBB26_2:
2401 ; X86-X87-NEXT: fxch %st(2)
2402 ; X86-X87-NEXT: fsubr %st(1), %st
2403 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
2404 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %edx
2405 ; X86-X87-NEXT: orl $3072, %edx # imm = 0xC00
2406 ; X86-X87-NEXT: movw %dx, {{[0-9]+}}(%esp)
2407 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2408 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
2409 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2410 ; X86-X87-NEXT: movb %al, %cl
2411 ; X86-X87-NEXT: shll $31, %ecx
2412 ; X86-X87-NEXT: xorl {{[0-9]+}}(%esp), %ecx
2413 ; X86-X87-NEXT: fucom %st(1)
2414 ; X86-X87-NEXT: fstp %st(1)
2415 ; X86-X87-NEXT: fnstsw %ax
2416 ; X86-X87-NEXT: xorl %edx, %edx
2417 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2418 ; X86-X87-NEXT: sahf
2419 ; X86-X87-NEXT: movl $0, %esi
2420 ; X86-X87-NEXT: jb .LBB26_4
2421 ; X86-X87-NEXT: # %bb.3:
2422 ; X86-X87-NEXT: movl %ecx, %esi
2423 ; X86-X87-NEXT: .LBB26_4:
2424 ; X86-X87-NEXT: jb .LBB26_6
2425 ; X86-X87-NEXT: # %bb.5:
2426 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edx
2427 ; X86-X87-NEXT: .LBB26_6:
2428 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2429 ; X86-X87-NEXT: fxch %st(1)
2430 ; X86-X87-NEXT: fucompp
2431 ; X86-X87-NEXT: fnstsw %ax
2432 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2433 ; X86-X87-NEXT: sahf
2434 ; X86-X87-NEXT: movl $-1, %eax
2435 ; X86-X87-NEXT: ja .LBB26_8
2436 ; X86-X87-NEXT: # %bb.7:
2437 ; X86-X87-NEXT: movl %edx, %eax
2438 ; X86-X87-NEXT: .LBB26_8:
2439 ; X86-X87-NEXT: movl $262143, %edx # imm = 0x3FFFF
2440 ; X86-X87-NEXT: ja .LBB26_10
2441 ; X86-X87-NEXT: # %bb.9:
2442 ; X86-X87-NEXT: movl %esi, %edx
2443 ; X86-X87-NEXT: .LBB26_10:
2444 ; X86-X87-NEXT: addl $24, %esp
2445 ; X86-X87-NEXT: popl %esi
2446 ; X86-X87-NEXT: retl
2448 ; X86-SSE-LABEL: test_unsigned_i50_f16:
2450 ; X86-SSE-NEXT: pushl %esi
2451 ; X86-SSE-NEXT: subl $24, %esp
2452 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
2453 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
2454 ; X86-SSE-NEXT: movw %ax, (%esp)
2455 ; X86-SSE-NEXT: calll __extendhfsf2
2456 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
2457 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2458 ; X86-SSE-NEXT: movss {{.*#+}} xmm2 = [9.22337203E+18,0.0E+0,0.0E+0,0.0E+0]
2459 ; X86-SSE-NEXT: ucomiss %xmm2, %xmm0
2460 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
2461 ; X86-SSE-NEXT: jae .LBB26_2
2462 ; X86-SSE-NEXT: # %bb.1:
2463 ; X86-SSE-NEXT: xorps %xmm2, %xmm2
2464 ; X86-SSE-NEXT: .LBB26_2:
2465 ; X86-SSE-NEXT: movaps %xmm0, %xmm3
2466 ; X86-SSE-NEXT: subss %xmm2, %xmm3
2467 ; X86-SSE-NEXT: movss %xmm3, {{[0-9]+}}(%esp)
2468 ; X86-SSE-NEXT: setae %cl
2469 ; X86-SSE-NEXT: flds {{[0-9]+}}(%esp)
2470 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
2471 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2472 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
2473 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
2474 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
2475 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
2476 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
2477 ; X86-SSE-NEXT: xorl %eax, %eax
2478 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
2479 ; X86-SSE-NEXT: movl $0, %esi
2480 ; X86-SSE-NEXT: jb .LBB26_4
2481 ; X86-SSE-NEXT: # %bb.3:
2482 ; X86-SSE-NEXT: movzbl %cl, %eax
2483 ; X86-SSE-NEXT: shll $31, %eax
2484 ; X86-SSE-NEXT: xorl {{[0-9]+}}(%esp), %eax
2485 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
2486 ; X86-SSE-NEXT: .LBB26_4:
2487 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2488 ; X86-SSE-NEXT: movl $262143, %edx # imm = 0x3FFFF
2489 ; X86-SSE-NEXT: cmovbel %eax, %edx
2490 ; X86-SSE-NEXT: movl $-1, %eax
2491 ; X86-SSE-NEXT: cmovbel %esi, %eax
2492 ; X86-SSE-NEXT: addl $24, %esp
2493 ; X86-SSE-NEXT: popl %esi
2494 ; X86-SSE-NEXT: retl
2496 ; X64-LABEL: test_unsigned_i50_f16:
2498 ; X64-NEXT: pushq %rax
2499 ; X64-NEXT: callq __extendhfsf2@PLT
2500 ; X64-NEXT: cvttss2si %xmm0, %rax
2501 ; X64-NEXT: movq %rax, %rcx
2502 ; X64-NEXT: sarq $63, %rcx
2503 ; X64-NEXT: movaps %xmm0, %xmm1
2504 ; X64-NEXT: subss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
2505 ; X64-NEXT: cvttss2si %xmm1, %rdx
2506 ; X64-NEXT: andq %rcx, %rdx
2507 ; X64-NEXT: orq %rax, %rdx
2508 ; X64-NEXT: xorl %ecx, %ecx
2509 ; X64-NEXT: xorps %xmm1, %xmm1
2510 ; X64-NEXT: ucomiss %xmm1, %xmm0
2511 ; X64-NEXT: cmovaeq %rdx, %rcx
2512 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
2513 ; X64-NEXT: movabsq $1125899906842623, %rax # imm = 0x3FFFFFFFFFFFF
2514 ; X64-NEXT: cmovbeq %rcx, %rax
2515 ; X64-NEXT: popq %rcx
2517 %x = call i50 @llvm.fptoui.sat.i50.f16(half %f)
2521 define i64 @test_unsigned_i64_f16(half %f) nounwind {
2522 ; X86-X87-LABEL: test_unsigned_i64_f16:
2524 ; X86-X87-NEXT: pushl %edi
2525 ; X86-X87-NEXT: pushl %esi
2526 ; X86-X87-NEXT: subl $20, %esp
2527 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2528 ; X86-X87-NEXT: movl %eax, (%esp)
2529 ; X86-X87-NEXT: calll __gnu_h2f_ieee
2530 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2531 ; X86-X87-NEXT: fxch %st(1)
2532 ; X86-X87-NEXT: fucom %st(1)
2533 ; X86-X87-NEXT: fnstsw %ax
2534 ; X86-X87-NEXT: xorl %ecx, %ecx
2535 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2536 ; X86-X87-NEXT: sahf
2537 ; X86-X87-NEXT: setae %al
2538 ; X86-X87-NEXT: fldz
2539 ; X86-X87-NEXT: jae .LBB27_2
2540 ; X86-X87-NEXT: # %bb.1:
2541 ; X86-X87-NEXT: fstp %st(2)
2542 ; X86-X87-NEXT: fld %st(1)
2543 ; X86-X87-NEXT: fxch %st(2)
2544 ; X86-X87-NEXT: .LBB27_2:
2545 ; X86-X87-NEXT: fxch %st(2)
2546 ; X86-X87-NEXT: fsubr %st(1), %st
2547 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
2548 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %edx
2549 ; X86-X87-NEXT: orl $3072, %edx # imm = 0xC00
2550 ; X86-X87-NEXT: movw %dx, {{[0-9]+}}(%esp)
2551 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2552 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
2553 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2554 ; X86-X87-NEXT: movb %al, %cl
2555 ; X86-X87-NEXT: shll $31, %ecx
2556 ; X86-X87-NEXT: xorl {{[0-9]+}}(%esp), %ecx
2557 ; X86-X87-NEXT: fucom %st(1)
2558 ; X86-X87-NEXT: fstp %st(1)
2559 ; X86-X87-NEXT: fnstsw %ax
2560 ; X86-X87-NEXT: xorl %esi, %esi
2561 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2562 ; X86-X87-NEXT: sahf
2563 ; X86-X87-NEXT: movl $0, %edi
2564 ; X86-X87-NEXT: jb .LBB27_4
2565 ; X86-X87-NEXT: # %bb.3:
2566 ; X86-X87-NEXT: movl %ecx, %edi
2567 ; X86-X87-NEXT: .LBB27_4:
2568 ; X86-X87-NEXT: jb .LBB27_6
2569 ; X86-X87-NEXT: # %bb.5:
2570 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %esi
2571 ; X86-X87-NEXT: .LBB27_6:
2572 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2573 ; X86-X87-NEXT: fxch %st(1)
2574 ; X86-X87-NEXT: fucompp
2575 ; X86-X87-NEXT: fnstsw %ax
2576 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2577 ; X86-X87-NEXT: sahf
2578 ; X86-X87-NEXT: movl $-1, %eax
2579 ; X86-X87-NEXT: movl $-1, %edx
2580 ; X86-X87-NEXT: ja .LBB27_8
2581 ; X86-X87-NEXT: # %bb.7:
2582 ; X86-X87-NEXT: movl %esi, %eax
2583 ; X86-X87-NEXT: movl %edi, %edx
2584 ; X86-X87-NEXT: .LBB27_8:
2585 ; X86-X87-NEXT: addl $20, %esp
2586 ; X86-X87-NEXT: popl %esi
2587 ; X86-X87-NEXT: popl %edi
2588 ; X86-X87-NEXT: retl
2590 ; X86-SSE-LABEL: test_unsigned_i64_f16:
2592 ; X86-SSE-NEXT: subl $28, %esp
2593 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
2594 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
2595 ; X86-SSE-NEXT: movw %ax, (%esp)
2596 ; X86-SSE-NEXT: calll __extendhfsf2
2597 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
2598 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2599 ; X86-SSE-NEXT: movss {{.*#+}} xmm2 = [9.22337203E+18,0.0E+0,0.0E+0,0.0E+0]
2600 ; X86-SSE-NEXT: ucomiss %xmm2, %xmm0
2601 ; X86-SSE-NEXT: xorps %xmm1, %xmm1
2602 ; X86-SSE-NEXT: jae .LBB27_2
2603 ; X86-SSE-NEXT: # %bb.1:
2604 ; X86-SSE-NEXT: xorps %xmm2, %xmm2
2605 ; X86-SSE-NEXT: .LBB27_2:
2606 ; X86-SSE-NEXT: movaps %xmm0, %xmm3
2607 ; X86-SSE-NEXT: subss %xmm2, %xmm3
2608 ; X86-SSE-NEXT: movss %xmm3, {{[0-9]+}}(%esp)
2609 ; X86-SSE-NEXT: setae %cl
2610 ; X86-SSE-NEXT: flds {{[0-9]+}}(%esp)
2611 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
2612 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2613 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
2614 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
2615 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
2616 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
2617 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
2618 ; X86-SSE-NEXT: xorl %edx, %edx
2619 ; X86-SSE-NEXT: ucomiss %xmm1, %xmm0
2620 ; X86-SSE-NEXT: movl $0, %eax
2621 ; X86-SSE-NEXT: jb .LBB27_4
2622 ; X86-SSE-NEXT: # %bb.3:
2623 ; X86-SSE-NEXT: movzbl %cl, %edx
2624 ; X86-SSE-NEXT: shll $31, %edx
2625 ; X86-SSE-NEXT: xorl {{[0-9]+}}(%esp), %edx
2626 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
2627 ; X86-SSE-NEXT: .LBB27_4:
2628 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2629 ; X86-SSE-NEXT: movl $-1, %ecx
2630 ; X86-SSE-NEXT: cmoval %ecx, %edx
2631 ; X86-SSE-NEXT: cmoval %ecx, %eax
2632 ; X86-SSE-NEXT: addl $28, %esp
2633 ; X86-SSE-NEXT: retl
2635 ; X64-LABEL: test_unsigned_i64_f16:
2637 ; X64-NEXT: pushq %rax
2638 ; X64-NEXT: callq __extendhfsf2@PLT
2639 ; X64-NEXT: cvttss2si %xmm0, %rax
2640 ; X64-NEXT: movq %rax, %rcx
2641 ; X64-NEXT: sarq $63, %rcx
2642 ; X64-NEXT: movaps %xmm0, %xmm1
2643 ; X64-NEXT: subss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
2644 ; X64-NEXT: cvttss2si %xmm1, %rdx
2645 ; X64-NEXT: andq %rcx, %rdx
2646 ; X64-NEXT: orq %rax, %rdx
2647 ; X64-NEXT: xorl %ecx, %ecx
2648 ; X64-NEXT: xorps %xmm1, %xmm1
2649 ; X64-NEXT: ucomiss %xmm1, %xmm0
2650 ; X64-NEXT: cmovaeq %rdx, %rcx
2651 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
2652 ; X64-NEXT: movq $-1, %rax
2653 ; X64-NEXT: cmovbeq %rcx, %rax
2654 ; X64-NEXT: popq %rcx
2656 %x = call i64 @llvm.fptoui.sat.i64.f16(half %f)
2660 define i100 @test_unsigned_i100_f16(half %f) nounwind {
2661 ; X86-X87-LABEL: test_unsigned_i100_f16:
2663 ; X86-X87-NEXT: pushl %ebp
2664 ; X86-X87-NEXT: pushl %ebx
2665 ; X86-X87-NEXT: pushl %edi
2666 ; X86-X87-NEXT: pushl %esi
2667 ; X86-X87-NEXT: subl $44, %esp
2668 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2669 ; X86-X87-NEXT: movl %eax, (%esp)
2670 ; X86-X87-NEXT: calll __gnu_h2f_ieee
2671 ; X86-X87-NEXT: leal {{[0-9]+}}(%esp), %eax
2672 ; X86-X87-NEXT: movl %eax, (%esp)
2673 ; X86-X87-NEXT: fsts {{[0-9]+}}(%esp)
2674 ; X86-X87-NEXT: fldz
2675 ; X86-X87-NEXT: fxch %st(1)
2676 ; X86-X87-NEXT: fsts {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
2677 ; X86-X87-NEXT: fucompp
2678 ; X86-X87-NEXT: fnstsw %ax
2679 ; X86-X87-NEXT: movl %eax, %ebx
2680 ; X86-X87-NEXT: calll __fixunssfti
2681 ; X86-X87-NEXT: subl $4, %esp
2682 ; X86-X87-NEXT: xorl %edi, %edi
2683 ; X86-X87-NEXT: movb %bh, %ah
2684 ; X86-X87-NEXT: sahf
2685 ; X86-X87-NEXT: movl $0, %eax
2686 ; X86-X87-NEXT: jb .LBB28_2
2687 ; X86-X87-NEXT: # %bb.1:
2688 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %eax
2689 ; X86-X87-NEXT: .LBB28_2:
2690 ; X86-X87-NEXT: movl $0, %esi
2691 ; X86-X87-NEXT: movl $0, %ebx
2692 ; X86-X87-NEXT: jb .LBB28_4
2693 ; X86-X87-NEXT: # %bb.3:
2694 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ebx
2695 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %esi
2696 ; X86-X87-NEXT: .LBB28_4:
2697 ; X86-X87-NEXT: jb .LBB28_6
2698 ; X86-X87-NEXT: # %bb.5:
2699 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edi
2700 ; X86-X87-NEXT: .LBB28_6:
2701 ; X86-X87-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
2702 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
2703 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2704 ; X86-X87-NEXT: flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
2705 ; X86-X87-NEXT: fucompp
2706 ; X86-X87-NEXT: fnstsw %ax
2707 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2708 ; X86-X87-NEXT: sahf
2709 ; X86-X87-NEXT: movl $15, %eax
2710 ; X86-X87-NEXT: ja .LBB28_8
2711 ; X86-X87-NEXT: # %bb.7:
2712 ; X86-X87-NEXT: movl %edi, %eax
2713 ; X86-X87-NEXT: .LBB28_8:
2714 ; X86-X87-NEXT: movl $-1, %edi
2715 ; X86-X87-NEXT: movl $-1, %ebp
2716 ; X86-X87-NEXT: movl $-1, %edx
2717 ; X86-X87-NEXT: ja .LBB28_10
2718 ; X86-X87-NEXT: # %bb.9:
2719 ; X86-X87-NEXT: movl %ebx, %edi
2720 ; X86-X87-NEXT: movl %esi, %ebp
2721 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
2722 ; X86-X87-NEXT: .LBB28_10:
2723 ; X86-X87-NEXT: movl %edx, 8(%ecx)
2724 ; X86-X87-NEXT: movl %ebp, 4(%ecx)
2725 ; X86-X87-NEXT: movl %edi, (%ecx)
2726 ; X86-X87-NEXT: andl $15, %eax
2727 ; X86-X87-NEXT: movb %al, 12(%ecx)
2728 ; X86-X87-NEXT: movl %ecx, %eax
2729 ; X86-X87-NEXT: addl $44, %esp
2730 ; X86-X87-NEXT: popl %esi
2731 ; X86-X87-NEXT: popl %edi
2732 ; X86-X87-NEXT: popl %ebx
2733 ; X86-X87-NEXT: popl %ebp
2734 ; X86-X87-NEXT: retl $4
2736 ; X86-SSE-LABEL: test_unsigned_i100_f16:
2738 ; X86-SSE-NEXT: pushl %ebx
2739 ; X86-SSE-NEXT: pushl %edi
2740 ; X86-SSE-NEXT: pushl %esi
2741 ; X86-SSE-NEXT: subl $32, %esp
2742 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
2743 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
2744 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
2745 ; X86-SSE-NEXT: movw %ax, (%esp)
2746 ; X86-SSE-NEXT: calll __extendhfsf2
2747 ; X86-SSE-NEXT: leal {{[0-9]+}}(%esp), %eax
2748 ; X86-SSE-NEXT: movl %eax, (%esp)
2749 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
2750 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2751 ; X86-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
2752 ; X86-SSE-NEXT: movss %xmm0, {{[0-9]+}}(%esp)
2753 ; X86-SSE-NEXT: calll __fixunssfti
2754 ; X86-SSE-NEXT: subl $4, %esp
2755 ; X86-SSE-NEXT: xorl %eax, %eax
2756 ; X86-SSE-NEXT: xorps %xmm0, %xmm0
2757 ; X86-SSE-NEXT: movss {{[-0-9]+}}(%e{{[sb]}}p), %xmm1 # 4-byte Reload
2758 ; X86-SSE-NEXT: # xmm1 = mem[0],zero,zero,zero
2759 ; X86-SSE-NEXT: ucomiss %xmm0, %xmm1
2760 ; X86-SSE-NEXT: movaps %xmm1, %xmm0
2761 ; X86-SSE-NEXT: movl $0, %ecx
2762 ; X86-SSE-NEXT: movl $0, %edx
2763 ; X86-SSE-NEXT: movl $0, %edi
2764 ; X86-SSE-NEXT: jb .LBB28_2
2765 ; X86-SSE-NEXT: # %bb.1:
2766 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
2767 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
2768 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edx
2769 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edi
2770 ; X86-SSE-NEXT: .LBB28_2:
2771 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2772 ; X86-SSE-NEXT: movl $15, %ebx
2773 ; X86-SSE-NEXT: cmovbel %edi, %ebx
2774 ; X86-SSE-NEXT: movl $-1, %edi
2775 ; X86-SSE-NEXT: cmoval %edi, %edx
2776 ; X86-SSE-NEXT: cmoval %edi, %ecx
2777 ; X86-SSE-NEXT: cmoval %edi, %eax
2778 ; X86-SSE-NEXT: movl %eax, 8(%esi)
2779 ; X86-SSE-NEXT: movl %ecx, 4(%esi)
2780 ; X86-SSE-NEXT: movl %edx, (%esi)
2781 ; X86-SSE-NEXT: andl $15, %ebx
2782 ; X86-SSE-NEXT: movb %bl, 12(%esi)
2783 ; X86-SSE-NEXT: movl %esi, %eax
2784 ; X86-SSE-NEXT: addl $32, %esp
2785 ; X86-SSE-NEXT: popl %esi
2786 ; X86-SSE-NEXT: popl %edi
2787 ; X86-SSE-NEXT: popl %ebx
2788 ; X86-SSE-NEXT: retl $4
2790 ; X64-LABEL: test_unsigned_i100_f16:
2792 ; X64-NEXT: pushq %rax
2793 ; X64-NEXT: callq __extendhfsf2@PLT
2794 ; X64-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
2795 ; X64-NEXT: callq __fixunssfti@PLT
2796 ; X64-NEXT: xorl %ecx, %ecx
2797 ; X64-NEXT: xorps %xmm0, %xmm0
2798 ; X64-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 4-byte Reload
2799 ; X64-NEXT: # xmm1 = mem[0],zero,zero,zero
2800 ; X64-NEXT: ucomiss %xmm0, %xmm1
2801 ; X64-NEXT: cmovbq %rcx, %rdx
2802 ; X64-NEXT: cmovbq %rcx, %rax
2803 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
2804 ; X64-NEXT: movq $-1, %rcx
2805 ; X64-NEXT: cmovaq %rcx, %rax
2806 ; X64-NEXT: movabsq $68719476735, %rcx # imm = 0xFFFFFFFFF
2807 ; X64-NEXT: cmovaq %rcx, %rdx
2808 ; X64-NEXT: popq %rcx
2810 %x = call i100 @llvm.fptoui.sat.i100.f16(half %f)
2814 define i128 @test_unsigned_i128_f16(half %f) nounwind {
2815 ; X86-X87-LABEL: test_unsigned_i128_f16:
2817 ; X86-X87-NEXT: pushl %ebp
2818 ; X86-X87-NEXT: pushl %ebx
2819 ; X86-X87-NEXT: pushl %edi
2820 ; X86-X87-NEXT: pushl %esi
2821 ; X86-X87-NEXT: subl $60, %esp
2822 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2823 ; X86-X87-NEXT: movl %eax, (%esp)
2824 ; X86-X87-NEXT: calll __gnu_h2f_ieee
2825 ; X86-X87-NEXT: leal {{[0-9]+}}(%esp), %eax
2826 ; X86-X87-NEXT: movl %eax, (%esp)
2827 ; X86-X87-NEXT: fsts {{[0-9]+}}(%esp)
2828 ; X86-X87-NEXT: fldz
2829 ; X86-X87-NEXT: fxch %st(1)
2830 ; X86-X87-NEXT: fsts {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
2831 ; X86-X87-NEXT: fucompp
2832 ; X86-X87-NEXT: fnstsw %ax
2833 ; X86-X87-NEXT: movl %eax, %ebx
2834 ; X86-X87-NEXT: calll __fixunssfti
2835 ; X86-X87-NEXT: subl $4, %esp
2836 ; X86-X87-NEXT: xorl %edx, %edx
2837 ; X86-X87-NEXT: movb %bh, %ah
2838 ; X86-X87-NEXT: sahf
2839 ; X86-X87-NEXT: movl $0, %eax
2840 ; X86-X87-NEXT: jb .LBB29_2
2841 ; X86-X87-NEXT: # %bb.1:
2842 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %eax
2843 ; X86-X87-NEXT: .LBB29_2:
2844 ; X86-X87-NEXT: movl $0, %ecx
2845 ; X86-X87-NEXT: jb .LBB29_4
2846 ; X86-X87-NEXT: # %bb.3:
2847 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
2848 ; X86-X87-NEXT: .LBB29_4:
2849 ; X86-X87-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
2850 ; X86-X87-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
2851 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
2852 ; X86-X87-NEXT: movl $0, %ebx
2853 ; X86-X87-NEXT: jb .LBB29_6
2854 ; X86-X87-NEXT: # %bb.5:
2855 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ebx
2856 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edx
2857 ; X86-X87-NEXT: .LBB29_6:
2858 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
2859 ; X86-X87-NEXT: flds {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Reload
2860 ; X86-X87-NEXT: fucompp
2861 ; X86-X87-NEXT: fnstsw %ax
2862 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2863 ; X86-X87-NEXT: sahf
2864 ; X86-X87-NEXT: movl $-1, %eax
2865 ; X86-X87-NEXT: movl $-1, %ebp
2866 ; X86-X87-NEXT: movl $-1, %edi
2867 ; X86-X87-NEXT: movl $-1, %esi
2868 ; X86-X87-NEXT: ja .LBB29_8
2869 ; X86-X87-NEXT: # %bb.7:
2870 ; X86-X87-NEXT: movl %ebx, %eax
2871 ; X86-X87-NEXT: movl %edx, %ebp
2872 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
2873 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
2874 ; X86-X87-NEXT: .LBB29_8:
2875 ; X86-X87-NEXT: movl %esi, 12(%ecx)
2876 ; X86-X87-NEXT: movl %edi, 8(%ecx)
2877 ; X86-X87-NEXT: movl %ebp, 4(%ecx)
2878 ; X86-X87-NEXT: movl %eax, (%ecx)
2879 ; X86-X87-NEXT: movl %ecx, %eax
2880 ; X86-X87-NEXT: addl $60, %esp
2881 ; X86-X87-NEXT: popl %esi
2882 ; X86-X87-NEXT: popl %edi
2883 ; X86-X87-NEXT: popl %ebx
2884 ; X86-X87-NEXT: popl %ebp
2885 ; X86-X87-NEXT: retl $4
2887 ; X86-SSE-LABEL: test_unsigned_i128_f16:
2889 ; X86-SSE-NEXT: pushl %ebx
2890 ; X86-SSE-NEXT: pushl %edi
2891 ; X86-SSE-NEXT: pushl %esi
2892 ; X86-SSE-NEXT: subl $32, %esp
2893 ; X86-SSE-NEXT: pinsrw $0, {{[0-9]+}}(%esp), %xmm0
2894 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
2895 ; X86-SSE-NEXT: pextrw $0, %xmm0, %eax
2896 ; X86-SSE-NEXT: movw %ax, (%esp)
2897 ; X86-SSE-NEXT: calll __extendhfsf2
2898 ; X86-SSE-NEXT: leal {{[0-9]+}}(%esp), %eax
2899 ; X86-SSE-NEXT: movl %eax, (%esp)
2900 ; X86-SSE-NEXT: fstps {{[0-9]+}}(%esp)
2901 ; X86-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2902 ; X86-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
2903 ; X86-SSE-NEXT: movss %xmm0, {{[0-9]+}}(%esp)
2904 ; X86-SSE-NEXT: calll __fixunssfti
2905 ; X86-SSE-NEXT: subl $4, %esp
2906 ; X86-SSE-NEXT: xorl %eax, %eax
2907 ; X86-SSE-NEXT: xorps %xmm0, %xmm0
2908 ; X86-SSE-NEXT: movss {{[-0-9]+}}(%e{{[sb]}}p), %xmm1 # 4-byte Reload
2909 ; X86-SSE-NEXT: # xmm1 = mem[0],zero,zero,zero
2910 ; X86-SSE-NEXT: ucomiss %xmm0, %xmm1
2911 ; X86-SSE-NEXT: movaps %xmm1, %xmm0
2912 ; X86-SSE-NEXT: movl $0, %ecx
2913 ; X86-SSE-NEXT: movl $0, %edx
2914 ; X86-SSE-NEXT: movl $0, %edi
2915 ; X86-SSE-NEXT: jb .LBB29_2
2916 ; X86-SSE-NEXT: # %bb.1:
2917 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
2918 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
2919 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edx
2920 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edi
2921 ; X86-SSE-NEXT: .LBB29_2:
2922 ; X86-SSE-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2923 ; X86-SSE-NEXT: movl $-1, %ebx
2924 ; X86-SSE-NEXT: cmoval %ebx, %edi
2925 ; X86-SSE-NEXT: cmoval %ebx, %edx
2926 ; X86-SSE-NEXT: cmoval %ebx, %ecx
2927 ; X86-SSE-NEXT: cmoval %ebx, %eax
2928 ; X86-SSE-NEXT: movl %eax, 12(%esi)
2929 ; X86-SSE-NEXT: movl %ecx, 8(%esi)
2930 ; X86-SSE-NEXT: movl %edx, 4(%esi)
2931 ; X86-SSE-NEXT: movl %edi, (%esi)
2932 ; X86-SSE-NEXT: movl %esi, %eax
2933 ; X86-SSE-NEXT: addl $32, %esp
2934 ; X86-SSE-NEXT: popl %esi
2935 ; X86-SSE-NEXT: popl %edi
2936 ; X86-SSE-NEXT: popl %ebx
2937 ; X86-SSE-NEXT: retl $4
2939 ; X64-LABEL: test_unsigned_i128_f16:
2941 ; X64-NEXT: pushq %rax
2942 ; X64-NEXT: callq __extendhfsf2@PLT
2943 ; X64-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
2944 ; X64-NEXT: callq __fixunssfti@PLT
2945 ; X64-NEXT: xorl %ecx, %ecx
2946 ; X64-NEXT: xorps %xmm0, %xmm0
2947 ; X64-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 4-byte Reload
2948 ; X64-NEXT: # xmm1 = mem[0],zero,zero,zero
2949 ; X64-NEXT: ucomiss %xmm0, %xmm1
2950 ; X64-NEXT: cmovbq %rcx, %rdx
2951 ; X64-NEXT: cmovbq %rcx, %rax
2952 ; X64-NEXT: ucomiss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
2953 ; X64-NEXT: movq $-1, %rcx
2954 ; X64-NEXT: cmovaq %rcx, %rax
2955 ; X64-NEXT: cmovaq %rcx, %rdx
2956 ; X64-NEXT: popq %rcx
2958 %x = call i128 @llvm.fptoui.sat.i128.f16(half %f)
2963 ; 80-bit float to unsigned integer
2966 declare i1 @llvm.fptoui.sat.i1.f80 (x86_fp80)
2967 declare i8 @llvm.fptoui.sat.i8.f80 (x86_fp80)
2968 declare i13 @llvm.fptoui.sat.i13.f80 (x86_fp80)
2969 declare i16 @llvm.fptoui.sat.i16.f80 (x86_fp80)
2970 declare i19 @llvm.fptoui.sat.i19.f80 (x86_fp80)
2971 declare i32 @llvm.fptoui.sat.i32.f80 (x86_fp80)
2972 declare i50 @llvm.fptoui.sat.i50.f80 (x86_fp80)
2973 declare i64 @llvm.fptoui.sat.i64.f80 (x86_fp80)
2974 declare i100 @llvm.fptoui.sat.i100.f80(x86_fp80)
2975 declare i128 @llvm.fptoui.sat.i128.f80(x86_fp80)
2977 define i1 @test_unsigned_i1_f80(x86_fp80 %f) nounwind {
2978 ; X86-X87-LABEL: test_unsigned_i1_f80:
2980 ; X86-X87-NEXT: subl $8, %esp
2981 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
2982 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
2983 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2984 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
2985 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
2986 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2987 ; X86-X87-NEXT: fists {{[0-9]+}}(%esp)
2988 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
2989 ; X86-X87-NEXT: fldz
2990 ; X86-X87-NEXT: fxch %st(1)
2991 ; X86-X87-NEXT: fucom %st(1)
2992 ; X86-X87-NEXT: fstp %st(1)
2993 ; X86-X87-NEXT: fnstsw %ax
2994 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
2995 ; X86-X87-NEXT: sahf
2996 ; X86-X87-NEXT: jb .LBB30_1
2997 ; X86-X87-NEXT: # %bb.2:
2998 ; X86-X87-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
2999 ; X86-X87-NEXT: jmp .LBB30_3
3000 ; X86-X87-NEXT: .LBB30_1:
3001 ; X86-X87-NEXT: xorl %ecx, %ecx
3002 ; X86-X87-NEXT: .LBB30_3:
3003 ; X86-X87-NEXT: fld1
3004 ; X86-X87-NEXT: fxch %st(1)
3005 ; X86-X87-NEXT: fucompp
3006 ; X86-X87-NEXT: fnstsw %ax
3007 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3008 ; X86-X87-NEXT: sahf
3009 ; X86-X87-NEXT: movb $1, %al
3010 ; X86-X87-NEXT: ja .LBB30_5
3011 ; X86-X87-NEXT: # %bb.4:
3012 ; X86-X87-NEXT: movl %ecx, %eax
3013 ; X86-X87-NEXT: .LBB30_5:
3014 ; X86-X87-NEXT: addl $8, %esp
3015 ; X86-X87-NEXT: retl
3017 ; X86-SSE-LABEL: test_unsigned_i1_f80:
3019 ; X86-SSE-NEXT: subl $8, %esp
3020 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
3021 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
3022 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
3023 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
3024 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
3025 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3026 ; X86-SSE-NEXT: fists {{[0-9]+}}(%esp)
3027 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3028 ; X86-SSE-NEXT: movzbl {{[0-9]+}}(%esp), %eax
3029 ; X86-SSE-NEXT: xorl %ecx, %ecx
3030 ; X86-SSE-NEXT: fldz
3031 ; X86-SSE-NEXT: fxch %st(1)
3032 ; X86-SSE-NEXT: fucomi %st(1), %st
3033 ; X86-SSE-NEXT: fstp %st(1)
3034 ; X86-SSE-NEXT: cmovael %eax, %ecx
3035 ; X86-SSE-NEXT: fld1
3036 ; X86-SSE-NEXT: fxch %st(1)
3037 ; X86-SSE-NEXT: fucompi %st(1), %st
3038 ; X86-SSE-NEXT: fstp %st(0)
3039 ; X86-SSE-NEXT: movl $1, %eax
3040 ; X86-SSE-NEXT: cmovbel %ecx, %eax
3041 ; X86-SSE-NEXT: # kill: def $al killed $al killed $eax
3042 ; X86-SSE-NEXT: addl $8, %esp
3043 ; X86-SSE-NEXT: retl
3045 ; X64-LABEL: test_unsigned_i1_f80:
3047 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
3048 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
3049 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
3050 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
3051 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
3052 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3053 ; X64-NEXT: fists -{{[0-9]+}}(%rsp)
3054 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3055 ; X64-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
3056 ; X64-NEXT: xorl %ecx, %ecx
3058 ; X64-NEXT: fxch %st(1)
3059 ; X64-NEXT: fucomi %st(1), %st
3060 ; X64-NEXT: fstp %st(1)
3061 ; X64-NEXT: cmovael %eax, %ecx
3063 ; X64-NEXT: fxch %st(1)
3064 ; X64-NEXT: fucompi %st(1), %st
3065 ; X64-NEXT: fstp %st(0)
3066 ; X64-NEXT: movl $1, %eax
3067 ; X64-NEXT: cmovbel %ecx, %eax
3068 ; X64-NEXT: # kill: def $al killed $al killed $eax
3070 %x = call i1 @llvm.fptoui.sat.i1.f80(x86_fp80 %f)
3074 define i8 @test_unsigned_i8_f80(x86_fp80 %f) nounwind {
3075 ; X86-X87-LABEL: test_unsigned_i8_f80:
3077 ; X86-X87-NEXT: subl $8, %esp
3078 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
3079 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
3080 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
3081 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
3082 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
3083 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3084 ; X86-X87-NEXT: fists {{[0-9]+}}(%esp)
3085 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3086 ; X86-X87-NEXT: fldz
3087 ; X86-X87-NEXT: fxch %st(1)
3088 ; X86-X87-NEXT: fucom %st(1)
3089 ; X86-X87-NEXT: fstp %st(1)
3090 ; X86-X87-NEXT: fnstsw %ax
3091 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3092 ; X86-X87-NEXT: sahf
3093 ; X86-X87-NEXT: jb .LBB31_1
3094 ; X86-X87-NEXT: # %bb.2:
3095 ; X86-X87-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
3096 ; X86-X87-NEXT: jmp .LBB31_3
3097 ; X86-X87-NEXT: .LBB31_1:
3098 ; X86-X87-NEXT: xorl %ecx, %ecx
3099 ; X86-X87-NEXT: .LBB31_3:
3100 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3101 ; X86-X87-NEXT: fxch %st(1)
3102 ; X86-X87-NEXT: fucompp
3103 ; X86-X87-NEXT: fnstsw %ax
3104 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3105 ; X86-X87-NEXT: sahf
3106 ; X86-X87-NEXT: movb $-1, %al
3107 ; X86-X87-NEXT: ja .LBB31_5
3108 ; X86-X87-NEXT: # %bb.4:
3109 ; X86-X87-NEXT: movl %ecx, %eax
3110 ; X86-X87-NEXT: .LBB31_5:
3111 ; X86-X87-NEXT: addl $8, %esp
3112 ; X86-X87-NEXT: retl
3114 ; X86-SSE-LABEL: test_unsigned_i8_f80:
3116 ; X86-SSE-NEXT: subl $8, %esp
3117 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
3118 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
3119 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
3120 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
3121 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
3122 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3123 ; X86-SSE-NEXT: fists {{[0-9]+}}(%esp)
3124 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3125 ; X86-SSE-NEXT: movzbl {{[0-9]+}}(%esp), %eax
3126 ; X86-SSE-NEXT: xorl %ecx, %ecx
3127 ; X86-SSE-NEXT: fldz
3128 ; X86-SSE-NEXT: fxch %st(1)
3129 ; X86-SSE-NEXT: fucomi %st(1), %st
3130 ; X86-SSE-NEXT: fstp %st(1)
3131 ; X86-SSE-NEXT: cmovael %eax, %ecx
3132 ; X86-SSE-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3133 ; X86-SSE-NEXT: fxch %st(1)
3134 ; X86-SSE-NEXT: fucompi %st(1), %st
3135 ; X86-SSE-NEXT: fstp %st(0)
3136 ; X86-SSE-NEXT: movl $255, %eax
3137 ; X86-SSE-NEXT: cmovbel %ecx, %eax
3138 ; X86-SSE-NEXT: # kill: def $al killed $al killed $eax
3139 ; X86-SSE-NEXT: addl $8, %esp
3140 ; X86-SSE-NEXT: retl
3142 ; X64-LABEL: test_unsigned_i8_f80:
3144 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
3145 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
3146 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
3147 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
3148 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
3149 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3150 ; X64-NEXT: fists -{{[0-9]+}}(%rsp)
3151 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3152 ; X64-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
3153 ; X64-NEXT: xorl %ecx, %ecx
3155 ; X64-NEXT: fxch %st(1)
3156 ; X64-NEXT: fucomi %st(1), %st
3157 ; X64-NEXT: fstp %st(1)
3158 ; X64-NEXT: cmovael %eax, %ecx
3159 ; X64-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
3160 ; X64-NEXT: fxch %st(1)
3161 ; X64-NEXT: fucompi %st(1), %st
3162 ; X64-NEXT: fstp %st(0)
3163 ; X64-NEXT: movl $255, %eax
3164 ; X64-NEXT: cmovbel %ecx, %eax
3165 ; X64-NEXT: # kill: def $al killed $al killed $eax
3167 %x = call i8 @llvm.fptoui.sat.i8.f80(x86_fp80 %f)
3171 define i13 @test_unsigned_i13_f80(x86_fp80 %f) nounwind {
3172 ; X86-X87-LABEL: test_unsigned_i13_f80:
3174 ; X86-X87-NEXT: subl $8, %esp
3175 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
3176 ; X86-X87-NEXT: fnstcw (%esp)
3177 ; X86-X87-NEXT: movzwl (%esp), %eax
3178 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
3179 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
3180 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3181 ; X86-X87-NEXT: fistl {{[0-9]+}}(%esp)
3182 ; X86-X87-NEXT: fldcw (%esp)
3183 ; X86-X87-NEXT: fldz
3184 ; X86-X87-NEXT: fxch %st(1)
3185 ; X86-X87-NEXT: fucom %st(1)
3186 ; X86-X87-NEXT: fstp %st(1)
3187 ; X86-X87-NEXT: fnstsw %ax
3188 ; X86-X87-NEXT: xorl %ecx, %ecx
3189 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3190 ; X86-X87-NEXT: sahf
3191 ; X86-X87-NEXT: jb .LBB32_2
3192 ; X86-X87-NEXT: # %bb.1:
3193 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
3194 ; X86-X87-NEXT: .LBB32_2:
3195 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3196 ; X86-X87-NEXT: fxch %st(1)
3197 ; X86-X87-NEXT: fucompp
3198 ; X86-X87-NEXT: fnstsw %ax
3199 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3200 ; X86-X87-NEXT: sahf
3201 ; X86-X87-NEXT: movl $8191, %eax # imm = 0x1FFF
3202 ; X86-X87-NEXT: ja .LBB32_4
3203 ; X86-X87-NEXT: # %bb.3:
3204 ; X86-X87-NEXT: movl %ecx, %eax
3205 ; X86-X87-NEXT: .LBB32_4:
3206 ; X86-X87-NEXT: # kill: def $ax killed $ax killed $eax
3207 ; X86-X87-NEXT: addl $8, %esp
3208 ; X86-X87-NEXT: retl
3210 ; X86-SSE-LABEL: test_unsigned_i13_f80:
3212 ; X86-SSE-NEXT: subl $8, %esp
3213 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
3214 ; X86-SSE-NEXT: fnstcw (%esp)
3215 ; X86-SSE-NEXT: movzwl (%esp), %eax
3216 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
3217 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
3218 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3219 ; X86-SSE-NEXT: fistl {{[0-9]+}}(%esp)
3220 ; X86-SSE-NEXT: fldcw (%esp)
3221 ; X86-SSE-NEXT: xorl %ecx, %ecx
3222 ; X86-SSE-NEXT: fldz
3223 ; X86-SSE-NEXT: fxch %st(1)
3224 ; X86-SSE-NEXT: fucomi %st(1), %st
3225 ; X86-SSE-NEXT: fstp %st(1)
3226 ; X86-SSE-NEXT: jb .LBB32_2
3227 ; X86-SSE-NEXT: # %bb.1:
3228 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
3229 ; X86-SSE-NEXT: .LBB32_2:
3230 ; X86-SSE-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3231 ; X86-SSE-NEXT: fxch %st(1)
3232 ; X86-SSE-NEXT: fucompi %st(1), %st
3233 ; X86-SSE-NEXT: fstp %st(0)
3234 ; X86-SSE-NEXT: movl $8191, %eax # imm = 0x1FFF
3235 ; X86-SSE-NEXT: cmovbel %ecx, %eax
3236 ; X86-SSE-NEXT: # kill: def $ax killed $ax killed $eax
3237 ; X86-SSE-NEXT: addl $8, %esp
3238 ; X86-SSE-NEXT: retl
3240 ; X64-LABEL: test_unsigned_i13_f80:
3242 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
3243 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
3244 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
3245 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
3246 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
3247 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3248 ; X64-NEXT: fistl -{{[0-9]+}}(%rsp)
3249 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3250 ; X64-NEXT: xorl %ecx, %ecx
3252 ; X64-NEXT: fxch %st(1)
3253 ; X64-NEXT: fucomi %st(1), %st
3254 ; X64-NEXT: fstp %st(1)
3255 ; X64-NEXT: jb .LBB32_2
3256 ; X64-NEXT: # %bb.1:
3257 ; X64-NEXT: movl -{{[0-9]+}}(%rsp), %ecx
3258 ; X64-NEXT: .LBB32_2:
3259 ; X64-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
3260 ; X64-NEXT: fxch %st(1)
3261 ; X64-NEXT: fucompi %st(1), %st
3262 ; X64-NEXT: fstp %st(0)
3263 ; X64-NEXT: movl $8191, %eax # imm = 0x1FFF
3264 ; X64-NEXT: cmovbel %ecx, %eax
3265 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
3267 %x = call i13 @llvm.fptoui.sat.i13.f80(x86_fp80 %f)
3271 define i16 @test_unsigned_i16_f80(x86_fp80 %f) nounwind {
3272 ; X86-X87-LABEL: test_unsigned_i16_f80:
3274 ; X86-X87-NEXT: subl $8, %esp
3275 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
3276 ; X86-X87-NEXT: fnstcw (%esp)
3277 ; X86-X87-NEXT: movzwl (%esp), %eax
3278 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
3279 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
3280 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3281 ; X86-X87-NEXT: fistl {{[0-9]+}}(%esp)
3282 ; X86-X87-NEXT: fldcw (%esp)
3283 ; X86-X87-NEXT: fldz
3284 ; X86-X87-NEXT: fxch %st(1)
3285 ; X86-X87-NEXT: fucom %st(1)
3286 ; X86-X87-NEXT: fstp %st(1)
3287 ; X86-X87-NEXT: fnstsw %ax
3288 ; X86-X87-NEXT: xorl %ecx, %ecx
3289 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3290 ; X86-X87-NEXT: sahf
3291 ; X86-X87-NEXT: jb .LBB33_2
3292 ; X86-X87-NEXT: # %bb.1:
3293 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
3294 ; X86-X87-NEXT: .LBB33_2:
3295 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3296 ; X86-X87-NEXT: fxch %st(1)
3297 ; X86-X87-NEXT: fucompp
3298 ; X86-X87-NEXT: fnstsw %ax
3299 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3300 ; X86-X87-NEXT: sahf
3301 ; X86-X87-NEXT: movl $65535, %eax # imm = 0xFFFF
3302 ; X86-X87-NEXT: ja .LBB33_4
3303 ; X86-X87-NEXT: # %bb.3:
3304 ; X86-X87-NEXT: movl %ecx, %eax
3305 ; X86-X87-NEXT: .LBB33_4:
3306 ; X86-X87-NEXT: # kill: def $ax killed $ax killed $eax
3307 ; X86-X87-NEXT: addl $8, %esp
3308 ; X86-X87-NEXT: retl
3310 ; X86-SSE-LABEL: test_unsigned_i16_f80:
3312 ; X86-SSE-NEXT: subl $8, %esp
3313 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
3314 ; X86-SSE-NEXT: fnstcw (%esp)
3315 ; X86-SSE-NEXT: movzwl (%esp), %eax
3316 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
3317 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
3318 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3319 ; X86-SSE-NEXT: fistl {{[0-9]+}}(%esp)
3320 ; X86-SSE-NEXT: fldcw (%esp)
3321 ; X86-SSE-NEXT: xorl %ecx, %ecx
3322 ; X86-SSE-NEXT: fldz
3323 ; X86-SSE-NEXT: fxch %st(1)
3324 ; X86-SSE-NEXT: fucomi %st(1), %st
3325 ; X86-SSE-NEXT: fstp %st(1)
3326 ; X86-SSE-NEXT: jb .LBB33_2
3327 ; X86-SSE-NEXT: # %bb.1:
3328 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
3329 ; X86-SSE-NEXT: .LBB33_2:
3330 ; X86-SSE-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3331 ; X86-SSE-NEXT: fxch %st(1)
3332 ; X86-SSE-NEXT: fucompi %st(1), %st
3333 ; X86-SSE-NEXT: fstp %st(0)
3334 ; X86-SSE-NEXT: movl $65535, %eax # imm = 0xFFFF
3335 ; X86-SSE-NEXT: cmovbel %ecx, %eax
3336 ; X86-SSE-NEXT: # kill: def $ax killed $ax killed $eax
3337 ; X86-SSE-NEXT: addl $8, %esp
3338 ; X86-SSE-NEXT: retl
3340 ; X64-LABEL: test_unsigned_i16_f80:
3342 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
3343 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
3344 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
3345 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
3346 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
3347 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3348 ; X64-NEXT: fistl -{{[0-9]+}}(%rsp)
3349 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3350 ; X64-NEXT: xorl %ecx, %ecx
3352 ; X64-NEXT: fxch %st(1)
3353 ; X64-NEXT: fucomi %st(1), %st
3354 ; X64-NEXT: fstp %st(1)
3355 ; X64-NEXT: jb .LBB33_2
3356 ; X64-NEXT: # %bb.1:
3357 ; X64-NEXT: movl -{{[0-9]+}}(%rsp), %ecx
3358 ; X64-NEXT: .LBB33_2:
3359 ; X64-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
3360 ; X64-NEXT: fxch %st(1)
3361 ; X64-NEXT: fucompi %st(1), %st
3362 ; X64-NEXT: fstp %st(0)
3363 ; X64-NEXT: movl $65535, %eax # imm = 0xFFFF
3364 ; X64-NEXT: cmovbel %ecx, %eax
3365 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
3367 %x = call i16 @llvm.fptoui.sat.i16.f80(x86_fp80 %f)
3371 define i19 @test_unsigned_i19_f80(x86_fp80 %f) nounwind {
3372 ; X86-X87-LABEL: test_unsigned_i19_f80:
3374 ; X86-X87-NEXT: subl $20, %esp
3375 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
3376 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
3377 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
3378 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
3379 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
3380 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3381 ; X86-X87-NEXT: fld %st(0)
3382 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
3383 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3384 ; X86-X87-NEXT: fldz
3385 ; X86-X87-NEXT: fxch %st(1)
3386 ; X86-X87-NEXT: fucom %st(1)
3387 ; X86-X87-NEXT: fstp %st(1)
3388 ; X86-X87-NEXT: fnstsw %ax
3389 ; X86-X87-NEXT: xorl %ecx, %ecx
3390 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3391 ; X86-X87-NEXT: sahf
3392 ; X86-X87-NEXT: jb .LBB34_2
3393 ; X86-X87-NEXT: # %bb.1:
3394 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
3395 ; X86-X87-NEXT: .LBB34_2:
3396 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3397 ; X86-X87-NEXT: fxch %st(1)
3398 ; X86-X87-NEXT: fucompp
3399 ; X86-X87-NEXT: fnstsw %ax
3400 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3401 ; X86-X87-NEXT: sahf
3402 ; X86-X87-NEXT: movl $524287, %eax # imm = 0x7FFFF
3403 ; X86-X87-NEXT: ja .LBB34_4
3404 ; X86-X87-NEXT: # %bb.3:
3405 ; X86-X87-NEXT: movl %ecx, %eax
3406 ; X86-X87-NEXT: .LBB34_4:
3407 ; X86-X87-NEXT: addl $20, %esp
3408 ; X86-X87-NEXT: retl
3410 ; X86-SSE-LABEL: test_unsigned_i19_f80:
3412 ; X86-SSE-NEXT: subl $20, %esp
3413 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
3414 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
3415 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
3416 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
3417 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
3418 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3419 ; X86-SSE-NEXT: fld %st(0)
3420 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
3421 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3422 ; X86-SSE-NEXT: xorl %ecx, %ecx
3423 ; X86-SSE-NEXT: fldz
3424 ; X86-SSE-NEXT: fxch %st(1)
3425 ; X86-SSE-NEXT: fucomi %st(1), %st
3426 ; X86-SSE-NEXT: fstp %st(1)
3427 ; X86-SSE-NEXT: jb .LBB34_2
3428 ; X86-SSE-NEXT: # %bb.1:
3429 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
3430 ; X86-SSE-NEXT: .LBB34_2:
3431 ; X86-SSE-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3432 ; X86-SSE-NEXT: fxch %st(1)
3433 ; X86-SSE-NEXT: fucompi %st(1), %st
3434 ; X86-SSE-NEXT: fstp %st(0)
3435 ; X86-SSE-NEXT: movl $524287, %eax # imm = 0x7FFFF
3436 ; X86-SSE-NEXT: cmovbel %ecx, %eax
3437 ; X86-SSE-NEXT: addl $20, %esp
3438 ; X86-SSE-NEXT: retl
3440 ; X64-LABEL: test_unsigned_i19_f80:
3442 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
3443 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
3444 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
3445 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
3446 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
3447 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3448 ; X64-NEXT: fld %st(0)
3449 ; X64-NEXT: fistpll -{{[0-9]+}}(%rsp)
3450 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3451 ; X64-NEXT: xorl %ecx, %ecx
3453 ; X64-NEXT: fxch %st(1)
3454 ; X64-NEXT: fucomi %st(1), %st
3455 ; X64-NEXT: fstp %st(1)
3456 ; X64-NEXT: jb .LBB34_2
3457 ; X64-NEXT: # %bb.1:
3458 ; X64-NEXT: movl -{{[0-9]+}}(%rsp), %ecx
3459 ; X64-NEXT: .LBB34_2:
3460 ; X64-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
3461 ; X64-NEXT: fxch %st(1)
3462 ; X64-NEXT: fucompi %st(1), %st
3463 ; X64-NEXT: fstp %st(0)
3464 ; X64-NEXT: movl $524287, %eax # imm = 0x7FFFF
3465 ; X64-NEXT: cmovbel %ecx, %eax
3467 %x = call i19 @llvm.fptoui.sat.i19.f80(x86_fp80 %f)
3471 define i32 @test_unsigned_i32_f80(x86_fp80 %f) nounwind {
3472 ; X86-X87-LABEL: test_unsigned_i32_f80:
3474 ; X86-X87-NEXT: subl $20, %esp
3475 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
3476 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
3477 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %eax
3478 ; X86-X87-NEXT: orl $3072, %eax # imm = 0xC00
3479 ; X86-X87-NEXT: movw %ax, {{[0-9]+}}(%esp)
3480 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3481 ; X86-X87-NEXT: fld %st(0)
3482 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
3483 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3484 ; X86-X87-NEXT: fldz
3485 ; X86-X87-NEXT: fxch %st(1)
3486 ; X86-X87-NEXT: fucom %st(1)
3487 ; X86-X87-NEXT: fstp %st(1)
3488 ; X86-X87-NEXT: fnstsw %ax
3489 ; X86-X87-NEXT: xorl %ecx, %ecx
3490 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3491 ; X86-X87-NEXT: sahf
3492 ; X86-X87-NEXT: jb .LBB35_2
3493 ; X86-X87-NEXT: # %bb.1:
3494 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
3495 ; X86-X87-NEXT: .LBB35_2:
3496 ; X86-X87-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}
3497 ; X86-X87-NEXT: fxch %st(1)
3498 ; X86-X87-NEXT: fucompp
3499 ; X86-X87-NEXT: fnstsw %ax
3500 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3501 ; X86-X87-NEXT: sahf
3502 ; X86-X87-NEXT: movl $-1, %eax
3503 ; X86-X87-NEXT: ja .LBB35_4
3504 ; X86-X87-NEXT: # %bb.3:
3505 ; X86-X87-NEXT: movl %ecx, %eax
3506 ; X86-X87-NEXT: .LBB35_4:
3507 ; X86-X87-NEXT: addl $20, %esp
3508 ; X86-X87-NEXT: retl
3510 ; X86-SSE-LABEL: test_unsigned_i32_f80:
3512 ; X86-SSE-NEXT: subl $20, %esp
3513 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
3514 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
3515 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
3516 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
3517 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
3518 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3519 ; X86-SSE-NEXT: fld %st(0)
3520 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
3521 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3522 ; X86-SSE-NEXT: xorl %ecx, %ecx
3523 ; X86-SSE-NEXT: fldz
3524 ; X86-SSE-NEXT: fxch %st(1)
3525 ; X86-SSE-NEXT: fucomi %st(1), %st
3526 ; X86-SSE-NEXT: fstp %st(1)
3527 ; X86-SSE-NEXT: jb .LBB35_2
3528 ; X86-SSE-NEXT: # %bb.1:
3529 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
3530 ; X86-SSE-NEXT: .LBB35_2:
3531 ; X86-SSE-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}
3532 ; X86-SSE-NEXT: fxch %st(1)
3533 ; X86-SSE-NEXT: fucompi %st(1), %st
3534 ; X86-SSE-NEXT: fstp %st(0)
3535 ; X86-SSE-NEXT: movl $-1, %eax
3536 ; X86-SSE-NEXT: cmovbel %ecx, %eax
3537 ; X86-SSE-NEXT: addl $20, %esp
3538 ; X86-SSE-NEXT: retl
3540 ; X64-LABEL: test_unsigned_i32_f80:
3542 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
3543 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
3544 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
3545 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
3546 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
3547 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3548 ; X64-NEXT: fld %st(0)
3549 ; X64-NEXT: fistpll -{{[0-9]+}}(%rsp)
3550 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3551 ; X64-NEXT: xorl %ecx, %ecx
3553 ; X64-NEXT: fxch %st(1)
3554 ; X64-NEXT: fucomi %st(1), %st
3555 ; X64-NEXT: fstp %st(1)
3556 ; X64-NEXT: jb .LBB35_2
3557 ; X64-NEXT: # %bb.1:
3558 ; X64-NEXT: movl -{{[0-9]+}}(%rsp), %ecx
3559 ; X64-NEXT: .LBB35_2:
3560 ; X64-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
3561 ; X64-NEXT: fxch %st(1)
3562 ; X64-NEXT: fucompi %st(1), %st
3563 ; X64-NEXT: fstp %st(0)
3564 ; X64-NEXT: movl $-1, %eax
3565 ; X64-NEXT: cmovbel %ecx, %eax
3567 %x = call i32 @llvm.fptoui.sat.i32.f80(x86_fp80 %f)
3571 define i50 @test_unsigned_i50_f80(x86_fp80 %f) nounwind {
3572 ; X86-X87-LABEL: test_unsigned_i50_f80:
3574 ; X86-X87-NEXT: pushl %esi
3575 ; X86-X87-NEXT: subl $16, %esp
3576 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
3577 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3578 ; X86-X87-NEXT: fucom %st(1)
3579 ; X86-X87-NEXT: fnstsw %ax
3580 ; X86-X87-NEXT: xorl %ecx, %ecx
3581 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3582 ; X86-X87-NEXT: sahf
3583 ; X86-X87-NEXT: setbe %al
3584 ; X86-X87-NEXT: fldz
3585 ; X86-X87-NEXT: jbe .LBB36_2
3586 ; X86-X87-NEXT: # %bb.1:
3587 ; X86-X87-NEXT: fstp %st(1)
3588 ; X86-X87-NEXT: fld %st(0)
3589 ; X86-X87-NEXT: fxch %st(1)
3590 ; X86-X87-NEXT: .LBB36_2:
3591 ; X86-X87-NEXT: fxch %st(1)
3592 ; X86-X87-NEXT: fsubr %st(2), %st
3593 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
3594 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %edx
3595 ; X86-X87-NEXT: orl $3072, %edx # imm = 0xC00
3596 ; X86-X87-NEXT: movw %dx, {{[0-9]+}}(%esp)
3597 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3598 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
3599 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3600 ; X86-X87-NEXT: movb %al, %cl
3601 ; X86-X87-NEXT: shll $31, %ecx
3602 ; X86-X87-NEXT: xorl {{[0-9]+}}(%esp), %ecx
3603 ; X86-X87-NEXT: fxch %st(1)
3604 ; X86-X87-NEXT: fucom %st(1)
3605 ; X86-X87-NEXT: fstp %st(1)
3606 ; X86-X87-NEXT: fnstsw %ax
3607 ; X86-X87-NEXT: xorl %edx, %edx
3608 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3609 ; X86-X87-NEXT: sahf
3610 ; X86-X87-NEXT: movl $0, %esi
3611 ; X86-X87-NEXT: jb .LBB36_4
3612 ; X86-X87-NEXT: # %bb.3:
3613 ; X86-X87-NEXT: movl %ecx, %esi
3614 ; X86-X87-NEXT: .LBB36_4:
3615 ; X86-X87-NEXT: jb .LBB36_6
3616 ; X86-X87-NEXT: # %bb.5:
3617 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edx
3618 ; X86-X87-NEXT: .LBB36_6:
3619 ; X86-X87-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}
3620 ; X86-X87-NEXT: fxch %st(1)
3621 ; X86-X87-NEXT: fucompp
3622 ; X86-X87-NEXT: fnstsw %ax
3623 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3624 ; X86-X87-NEXT: sahf
3625 ; X86-X87-NEXT: movl $-1, %eax
3626 ; X86-X87-NEXT: ja .LBB36_8
3627 ; X86-X87-NEXT: # %bb.7:
3628 ; X86-X87-NEXT: movl %edx, %eax
3629 ; X86-X87-NEXT: .LBB36_8:
3630 ; X86-X87-NEXT: movl $262143, %edx # imm = 0x3FFFF
3631 ; X86-X87-NEXT: ja .LBB36_10
3632 ; X86-X87-NEXT: # %bb.9:
3633 ; X86-X87-NEXT: movl %esi, %edx
3634 ; X86-X87-NEXT: .LBB36_10:
3635 ; X86-X87-NEXT: addl $16, %esp
3636 ; X86-X87-NEXT: popl %esi
3637 ; X86-X87-NEXT: retl
3639 ; X86-SSE-LABEL: test_unsigned_i50_f80:
3641 ; X86-SSE-NEXT: pushl %esi
3642 ; X86-SSE-NEXT: subl $16, %esp
3643 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
3644 ; X86-SSE-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3645 ; X86-SSE-NEXT: xorl %eax, %eax
3646 ; X86-SSE-NEXT: fucomi %st(1), %st
3647 ; X86-SSE-NEXT: setbe %cl
3648 ; X86-SSE-NEXT: fldz
3649 ; X86-SSE-NEXT: fld %st(0)
3650 ; X86-SSE-NEXT: fcmovbe %st(2), %st
3651 ; X86-SSE-NEXT: fstp %st(2)
3652 ; X86-SSE-NEXT: fxch %st(1)
3653 ; X86-SSE-NEXT: fsubr %st(2), %st
3654 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
3655 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %edx
3656 ; X86-SSE-NEXT: orl $3072, %edx # imm = 0xC00
3657 ; X86-SSE-NEXT: movw %dx, {{[0-9]+}}(%esp)
3658 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3659 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
3660 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3661 ; X86-SSE-NEXT: xorl %esi, %esi
3662 ; X86-SSE-NEXT: fxch %st(1)
3663 ; X86-SSE-NEXT: fucomi %st(1), %st
3664 ; X86-SSE-NEXT: fstp %st(1)
3665 ; X86-SSE-NEXT: movl $0, %edx
3666 ; X86-SSE-NEXT: jb .LBB36_2
3667 ; X86-SSE-NEXT: # %bb.1:
3668 ; X86-SSE-NEXT: movb %cl, %al
3669 ; X86-SSE-NEXT: shll $31, %eax
3670 ; X86-SSE-NEXT: xorl {{[0-9]+}}(%esp), %eax
3671 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edx
3672 ; X86-SSE-NEXT: movl %eax, %esi
3673 ; X86-SSE-NEXT: .LBB36_2:
3674 ; X86-SSE-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}
3675 ; X86-SSE-NEXT: fxch %st(1)
3676 ; X86-SSE-NEXT: fucompi %st(1), %st
3677 ; X86-SSE-NEXT: fstp %st(0)
3678 ; X86-SSE-NEXT: movl $-1, %eax
3679 ; X86-SSE-NEXT: cmovbel %edx, %eax
3680 ; X86-SSE-NEXT: movl $262143, %edx # imm = 0x3FFFF
3681 ; X86-SSE-NEXT: cmovbel %esi, %edx
3682 ; X86-SSE-NEXT: addl $16, %esp
3683 ; X86-SSE-NEXT: popl %esi
3684 ; X86-SSE-NEXT: retl
3686 ; X64-LABEL: test_unsigned_i50_f80:
3688 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
3689 ; X64-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
3690 ; X64-NEXT: xorl %eax, %eax
3691 ; X64-NEXT: fucomi %st(1), %st
3692 ; X64-NEXT: setbe %al
3694 ; X64-NEXT: fld %st(0)
3695 ; X64-NEXT: fcmovbe %st(2), %st
3696 ; X64-NEXT: fstp %st(2)
3697 ; X64-NEXT: fxch %st(1)
3698 ; X64-NEXT: fsubr %st(2), %st
3699 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
3700 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %ecx
3701 ; X64-NEXT: orl $3072, %ecx # imm = 0xC00
3702 ; X64-NEXT: movw %cx, -{{[0-9]+}}(%rsp)
3703 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3704 ; X64-NEXT: fistpll -{{[0-9]+}}(%rsp)
3705 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3706 ; X64-NEXT: shlq $63, %rax
3707 ; X64-NEXT: xorq -{{[0-9]+}}(%rsp), %rax
3708 ; X64-NEXT: xorl %ecx, %ecx
3709 ; X64-NEXT: fxch %st(1)
3710 ; X64-NEXT: fucomi %st(1), %st
3711 ; X64-NEXT: fstp %st(1)
3712 ; X64-NEXT: cmovaeq %rax, %rcx
3713 ; X64-NEXT: fldl {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
3714 ; X64-NEXT: fxch %st(1)
3715 ; X64-NEXT: fucompi %st(1), %st
3716 ; X64-NEXT: fstp %st(0)
3717 ; X64-NEXT: movabsq $1125899906842623, %rax # imm = 0x3FFFFFFFFFFFF
3718 ; X64-NEXT: cmovbeq %rcx, %rax
3720 %x = call i50 @llvm.fptoui.sat.i50.f80(x86_fp80 %f)
3724 define i64 @test_unsigned_i64_f80(x86_fp80 %f) nounwind {
3725 ; X86-X87-LABEL: test_unsigned_i64_f80:
3727 ; X86-X87-NEXT: pushl %edi
3728 ; X86-X87-NEXT: pushl %esi
3729 ; X86-X87-NEXT: subl $20, %esp
3730 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
3731 ; X86-X87-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3732 ; X86-X87-NEXT: fucom %st(1)
3733 ; X86-X87-NEXT: fnstsw %ax
3734 ; X86-X87-NEXT: xorl %ecx, %ecx
3735 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3736 ; X86-X87-NEXT: sahf
3737 ; X86-X87-NEXT: setbe %al
3738 ; X86-X87-NEXT: fldz
3739 ; X86-X87-NEXT: jbe .LBB37_2
3740 ; X86-X87-NEXT: # %bb.1:
3741 ; X86-X87-NEXT: fstp %st(1)
3742 ; X86-X87-NEXT: fld %st(0)
3743 ; X86-X87-NEXT: fxch %st(1)
3744 ; X86-X87-NEXT: .LBB37_2:
3745 ; X86-X87-NEXT: fxch %st(1)
3746 ; X86-X87-NEXT: fsubr %st(2), %st
3747 ; X86-X87-NEXT: fnstcw {{[0-9]+}}(%esp)
3748 ; X86-X87-NEXT: movzwl {{[0-9]+}}(%esp), %edx
3749 ; X86-X87-NEXT: orl $3072, %edx # imm = 0xC00
3750 ; X86-X87-NEXT: movw %dx, {{[0-9]+}}(%esp)
3751 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3752 ; X86-X87-NEXT: fistpll {{[0-9]+}}(%esp)
3753 ; X86-X87-NEXT: fldcw {{[0-9]+}}(%esp)
3754 ; X86-X87-NEXT: movb %al, %cl
3755 ; X86-X87-NEXT: shll $31, %ecx
3756 ; X86-X87-NEXT: xorl {{[0-9]+}}(%esp), %ecx
3757 ; X86-X87-NEXT: fxch %st(1)
3758 ; X86-X87-NEXT: fucom %st(1)
3759 ; X86-X87-NEXT: fstp %st(1)
3760 ; X86-X87-NEXT: fnstsw %ax
3761 ; X86-X87-NEXT: xorl %esi, %esi
3762 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3763 ; X86-X87-NEXT: sahf
3764 ; X86-X87-NEXT: movl $0, %edi
3765 ; X86-X87-NEXT: jb .LBB37_4
3766 ; X86-X87-NEXT: # %bb.3:
3767 ; X86-X87-NEXT: movl %ecx, %edi
3768 ; X86-X87-NEXT: .LBB37_4:
3769 ; X86-X87-NEXT: jb .LBB37_6
3770 ; X86-X87-NEXT: # %bb.5:
3771 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %esi
3772 ; X86-X87-NEXT: .LBB37_6:
3773 ; X86-X87-NEXT: fldt {{\.?LCPI[0-9]+_[0-9]+}}
3774 ; X86-X87-NEXT: fxch %st(1)
3775 ; X86-X87-NEXT: fucompp
3776 ; X86-X87-NEXT: fnstsw %ax
3777 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3778 ; X86-X87-NEXT: sahf
3779 ; X86-X87-NEXT: movl $-1, %eax
3780 ; X86-X87-NEXT: movl $-1, %edx
3781 ; X86-X87-NEXT: ja .LBB37_8
3782 ; X86-X87-NEXT: # %bb.7:
3783 ; X86-X87-NEXT: movl %esi, %eax
3784 ; X86-X87-NEXT: movl %edi, %edx
3785 ; X86-X87-NEXT: .LBB37_8:
3786 ; X86-X87-NEXT: addl $20, %esp
3787 ; X86-X87-NEXT: popl %esi
3788 ; X86-X87-NEXT: popl %edi
3789 ; X86-X87-NEXT: retl
3791 ; X86-SSE-LABEL: test_unsigned_i64_f80:
3793 ; X86-SSE-NEXT: pushl %ebx
3794 ; X86-SSE-NEXT: subl $16, %esp
3795 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
3796 ; X86-SSE-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
3797 ; X86-SSE-NEXT: xorl %ecx, %ecx
3798 ; X86-SSE-NEXT: fucomi %st(1), %st
3799 ; X86-SSE-NEXT: setbe %bl
3800 ; X86-SSE-NEXT: fldz
3801 ; X86-SSE-NEXT: fld %st(0)
3802 ; X86-SSE-NEXT: fcmovbe %st(2), %st
3803 ; X86-SSE-NEXT: fstp %st(2)
3804 ; X86-SSE-NEXT: fxch %st(1)
3805 ; X86-SSE-NEXT: fsubr %st(2), %st
3806 ; X86-SSE-NEXT: fnstcw {{[0-9]+}}(%esp)
3807 ; X86-SSE-NEXT: movzwl {{[0-9]+}}(%esp), %eax
3808 ; X86-SSE-NEXT: orl $3072, %eax # imm = 0xC00
3809 ; X86-SSE-NEXT: movw %ax, {{[0-9]+}}(%esp)
3810 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3811 ; X86-SSE-NEXT: fistpll {{[0-9]+}}(%esp)
3812 ; X86-SSE-NEXT: fldcw {{[0-9]+}}(%esp)
3813 ; X86-SSE-NEXT: xorl %edx, %edx
3814 ; X86-SSE-NEXT: fxch %st(1)
3815 ; X86-SSE-NEXT: fucomi %st(1), %st
3816 ; X86-SSE-NEXT: fstp %st(1)
3817 ; X86-SSE-NEXT: movl $0, %eax
3818 ; X86-SSE-NEXT: jb .LBB37_2
3819 ; X86-SSE-NEXT: # %bb.1:
3820 ; X86-SSE-NEXT: movb %bl, %cl
3821 ; X86-SSE-NEXT: shll $31, %ecx
3822 ; X86-SSE-NEXT: xorl {{[0-9]+}}(%esp), %ecx
3823 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
3824 ; X86-SSE-NEXT: movl %ecx, %edx
3825 ; X86-SSE-NEXT: .LBB37_2:
3826 ; X86-SSE-NEXT: fldt {{\.?LCPI[0-9]+_[0-9]+}}
3827 ; X86-SSE-NEXT: fxch %st(1)
3828 ; X86-SSE-NEXT: fucompi %st(1), %st
3829 ; X86-SSE-NEXT: fstp %st(0)
3830 ; X86-SSE-NEXT: movl $-1, %ecx
3831 ; X86-SSE-NEXT: cmoval %ecx, %eax
3832 ; X86-SSE-NEXT: cmoval %ecx, %edx
3833 ; X86-SSE-NEXT: addl $16, %esp
3834 ; X86-SSE-NEXT: popl %ebx
3835 ; X86-SSE-NEXT: retl
3837 ; X64-LABEL: test_unsigned_i64_f80:
3839 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
3840 ; X64-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
3841 ; X64-NEXT: xorl %eax, %eax
3842 ; X64-NEXT: fucomi %st(1), %st
3843 ; X64-NEXT: setbe %al
3845 ; X64-NEXT: fld %st(0)
3846 ; X64-NEXT: fcmovbe %st(2), %st
3847 ; X64-NEXT: fstp %st(2)
3848 ; X64-NEXT: fxch %st(1)
3849 ; X64-NEXT: fsubr %st(2), %st
3850 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
3851 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %ecx
3852 ; X64-NEXT: orl $3072, %ecx # imm = 0xC00
3853 ; X64-NEXT: movw %cx, -{{[0-9]+}}(%rsp)
3854 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3855 ; X64-NEXT: fistpll -{{[0-9]+}}(%rsp)
3856 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
3857 ; X64-NEXT: shlq $63, %rax
3858 ; X64-NEXT: xorq -{{[0-9]+}}(%rsp), %rax
3859 ; X64-NEXT: xorl %ecx, %ecx
3860 ; X64-NEXT: fxch %st(1)
3861 ; X64-NEXT: fucomi %st(1), %st
3862 ; X64-NEXT: fstp %st(1)
3863 ; X64-NEXT: cmovaeq %rax, %rcx
3864 ; X64-NEXT: fldt {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
3865 ; X64-NEXT: fxch %st(1)
3866 ; X64-NEXT: fucompi %st(1), %st
3867 ; X64-NEXT: fstp %st(0)
3868 ; X64-NEXT: movq $-1, %rax
3869 ; X64-NEXT: cmovbeq %rcx, %rax
3871 %x = call i64 @llvm.fptoui.sat.i64.f80(x86_fp80 %f)
3875 define i100 @test_unsigned_i100_f80(x86_fp80 %f) nounwind {
3876 ; X86-X87-LABEL: test_unsigned_i100_f80:
3878 ; X86-X87-NEXT: pushl %ebp
3879 ; X86-X87-NEXT: pushl %ebx
3880 ; X86-X87-NEXT: pushl %edi
3881 ; X86-X87-NEXT: pushl %esi
3882 ; X86-X87-NEXT: subl $60, %esp
3883 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
3884 ; X86-X87-NEXT: fld %st(0)
3885 ; X86-X87-NEXT: fstpt {{[0-9]+}}(%esp)
3886 ; X86-X87-NEXT: leal {{[0-9]+}}(%esp), %eax
3887 ; X86-X87-NEXT: movl %eax, (%esp)
3888 ; X86-X87-NEXT: fldz
3889 ; X86-X87-NEXT: fld %st(1)
3890 ; X86-X87-NEXT: fstpt {{[-0-9]+}}(%e{{[sb]}}p) # 10-byte Folded Spill
3891 ; X86-X87-NEXT: fxch %st(1)
3892 ; X86-X87-NEXT: fucompp
3893 ; X86-X87-NEXT: fnstsw %ax
3894 ; X86-X87-NEXT: movl %eax, %ebx
3895 ; X86-X87-NEXT: calll __fixunsxfti
3896 ; X86-X87-NEXT: subl $4, %esp
3897 ; X86-X87-NEXT: xorl %edi, %edi
3898 ; X86-X87-NEXT: movb %bh, %ah
3899 ; X86-X87-NEXT: sahf
3900 ; X86-X87-NEXT: movl $0, %eax
3901 ; X86-X87-NEXT: jb .LBB38_2
3902 ; X86-X87-NEXT: # %bb.1:
3903 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %eax
3904 ; X86-X87-NEXT: .LBB38_2:
3905 ; X86-X87-NEXT: movl $0, %esi
3906 ; X86-X87-NEXT: movl $0, %ebx
3907 ; X86-X87-NEXT: jb .LBB38_4
3908 ; X86-X87-NEXT: # %bb.3:
3909 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ebx
3910 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %esi
3911 ; X86-X87-NEXT: .LBB38_4:
3912 ; X86-X87-NEXT: jb .LBB38_6
3913 ; X86-X87-NEXT: # %bb.5:
3914 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edi
3915 ; X86-X87-NEXT: .LBB38_6:
3916 ; X86-X87-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
3917 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
3918 ; X86-X87-NEXT: fldt {{\.?LCPI[0-9]+_[0-9]+}}
3919 ; X86-X87-NEXT: fldt {{[-0-9]+}}(%e{{[sb]}}p) # 10-byte Folded Reload
3920 ; X86-X87-NEXT: fucompp
3921 ; X86-X87-NEXT: fnstsw %ax
3922 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
3923 ; X86-X87-NEXT: sahf
3924 ; X86-X87-NEXT: movl $15, %eax
3925 ; X86-X87-NEXT: ja .LBB38_8
3926 ; X86-X87-NEXT: # %bb.7:
3927 ; X86-X87-NEXT: movl %edi, %eax
3928 ; X86-X87-NEXT: .LBB38_8:
3929 ; X86-X87-NEXT: movl $-1, %edi
3930 ; X86-X87-NEXT: movl $-1, %ebp
3931 ; X86-X87-NEXT: movl $-1, %edx
3932 ; X86-X87-NEXT: ja .LBB38_10
3933 ; X86-X87-NEXT: # %bb.9:
3934 ; X86-X87-NEXT: movl %ebx, %edi
3935 ; X86-X87-NEXT: movl %esi, %ebp
3936 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload
3937 ; X86-X87-NEXT: .LBB38_10:
3938 ; X86-X87-NEXT: movl %edx, 8(%ecx)
3939 ; X86-X87-NEXT: movl %ebp, 4(%ecx)
3940 ; X86-X87-NEXT: movl %edi, (%ecx)
3941 ; X86-X87-NEXT: andl $15, %eax
3942 ; X86-X87-NEXT: movb %al, 12(%ecx)
3943 ; X86-X87-NEXT: movl %ecx, %eax
3944 ; X86-X87-NEXT: addl $60, %esp
3945 ; X86-X87-NEXT: popl %esi
3946 ; X86-X87-NEXT: popl %edi
3947 ; X86-X87-NEXT: popl %ebx
3948 ; X86-X87-NEXT: popl %ebp
3949 ; X86-X87-NEXT: retl $4
3951 ; X86-SSE-LABEL: test_unsigned_i100_f80:
3953 ; X86-SSE-NEXT: pushl %ebx
3954 ; X86-SSE-NEXT: pushl %edi
3955 ; X86-SSE-NEXT: pushl %esi
3956 ; X86-SSE-NEXT: subl $48, %esp
3957 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
3958 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
3959 ; X86-SSE-NEXT: fld %st(0)
3960 ; X86-SSE-NEXT: fstpt {{[-0-9]+}}(%e{{[sb]}}p) # 10-byte Folded Spill
3961 ; X86-SSE-NEXT: fstpt {{[0-9]+}}(%esp)
3962 ; X86-SSE-NEXT: leal {{[0-9]+}}(%esp), %eax
3963 ; X86-SSE-NEXT: movl %eax, (%esp)
3964 ; X86-SSE-NEXT: calll __fixunsxfti
3965 ; X86-SSE-NEXT: subl $4, %esp
3966 ; X86-SSE-NEXT: fldt {{[-0-9]+}}(%e{{[sb]}}p) # 10-byte Folded Reload
3967 ; X86-SSE-NEXT: xorl %eax, %eax
3968 ; X86-SSE-NEXT: fldz
3969 ; X86-SSE-NEXT: fxch %st(1)
3970 ; X86-SSE-NEXT: fucomi %st(1), %st
3971 ; X86-SSE-NEXT: fstp %st(1)
3972 ; X86-SSE-NEXT: movl $0, %ecx
3973 ; X86-SSE-NEXT: movl $0, %edx
3974 ; X86-SSE-NEXT: movl $0, %edi
3975 ; X86-SSE-NEXT: jb .LBB38_2
3976 ; X86-SSE-NEXT: # %bb.1:
3977 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
3978 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
3979 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edx
3980 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edi
3981 ; X86-SSE-NEXT: .LBB38_2:
3982 ; X86-SSE-NEXT: fldt {{\.?LCPI[0-9]+_[0-9]+}}
3983 ; X86-SSE-NEXT: fxch %st(1)
3984 ; X86-SSE-NEXT: fucompi %st(1), %st
3985 ; X86-SSE-NEXT: fstp %st(0)
3986 ; X86-SSE-NEXT: movl $15, %ebx
3987 ; X86-SSE-NEXT: cmovbel %edi, %ebx
3988 ; X86-SSE-NEXT: movl $-1, %edi
3989 ; X86-SSE-NEXT: cmoval %edi, %edx
3990 ; X86-SSE-NEXT: cmoval %edi, %ecx
3991 ; X86-SSE-NEXT: cmoval %edi, %eax
3992 ; X86-SSE-NEXT: movl %eax, 8(%esi)
3993 ; X86-SSE-NEXT: movl %ecx, 4(%esi)
3994 ; X86-SSE-NEXT: movl %edx, (%esi)
3995 ; X86-SSE-NEXT: andl $15, %ebx
3996 ; X86-SSE-NEXT: movb %bl, 12(%esi)
3997 ; X86-SSE-NEXT: movl %esi, %eax
3998 ; X86-SSE-NEXT: addl $48, %esp
3999 ; X86-SSE-NEXT: popl %esi
4000 ; X86-SSE-NEXT: popl %edi
4001 ; X86-SSE-NEXT: popl %ebx
4002 ; X86-SSE-NEXT: retl $4
4004 ; X64-LABEL: test_unsigned_i100_f80:
4006 ; X64-NEXT: subq $40, %rsp
4007 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
4008 ; X64-NEXT: fld %st(0)
4009 ; X64-NEXT: fstpt {{[-0-9]+}}(%r{{[sb]}}p) # 10-byte Folded Spill
4010 ; X64-NEXT: fstpt (%rsp)
4011 ; X64-NEXT: callq __fixunsxfti@PLT
4012 ; X64-NEXT: xorl %ecx, %ecx
4014 ; X64-NEXT: fldt {{[-0-9]+}}(%r{{[sb]}}p) # 10-byte Folded Reload
4015 ; X64-NEXT: fucomi %st(1), %st
4016 ; X64-NEXT: fstp %st(1)
4017 ; X64-NEXT: cmovbq %rcx, %rdx
4018 ; X64-NEXT: cmovbq %rcx, %rax
4019 ; X64-NEXT: fldt {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
4020 ; X64-NEXT: fxch %st(1)
4021 ; X64-NEXT: fucompi %st(1), %st
4022 ; X64-NEXT: fstp %st(0)
4023 ; X64-NEXT: movq $-1, %rcx
4024 ; X64-NEXT: cmovaq %rcx, %rax
4025 ; X64-NEXT: movabsq $68719476735, %rcx # imm = 0xFFFFFFFFF
4026 ; X64-NEXT: cmovaq %rcx, %rdx
4027 ; X64-NEXT: addq $40, %rsp
4029 %x = call i100 @llvm.fptoui.sat.i100.f80(x86_fp80 %f)
4033 define i128 @test_unsigned_i128_f80(x86_fp80 %f) nounwind {
4034 ; X86-X87-LABEL: test_unsigned_i128_f80:
4036 ; X86-X87-NEXT: pushl %ebp
4037 ; X86-X87-NEXT: pushl %ebx
4038 ; X86-X87-NEXT: pushl %edi
4039 ; X86-X87-NEXT: pushl %esi
4040 ; X86-X87-NEXT: subl $60, %esp
4041 ; X86-X87-NEXT: fldt {{[0-9]+}}(%esp)
4042 ; X86-X87-NEXT: fld %st(0)
4043 ; X86-X87-NEXT: fstpt {{[0-9]+}}(%esp)
4044 ; X86-X87-NEXT: leal {{[0-9]+}}(%esp), %eax
4045 ; X86-X87-NEXT: movl %eax, (%esp)
4046 ; X86-X87-NEXT: fldz
4047 ; X86-X87-NEXT: fld %st(1)
4048 ; X86-X87-NEXT: fstpt {{[-0-9]+}}(%e{{[sb]}}p) # 10-byte Folded Spill
4049 ; X86-X87-NEXT: fxch %st(1)
4050 ; X86-X87-NEXT: fucompp
4051 ; X86-X87-NEXT: fnstsw %ax
4052 ; X86-X87-NEXT: movl %eax, %ebx
4053 ; X86-X87-NEXT: calll __fixunsxfti
4054 ; X86-X87-NEXT: subl $4, %esp
4055 ; X86-X87-NEXT: xorl %edx, %edx
4056 ; X86-X87-NEXT: movb %bh, %ah
4057 ; X86-X87-NEXT: sahf
4058 ; X86-X87-NEXT: movl $0, %eax
4059 ; X86-X87-NEXT: jb .LBB39_2
4060 ; X86-X87-NEXT: # %bb.1:
4061 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %eax
4062 ; X86-X87-NEXT: .LBB39_2:
4063 ; X86-X87-NEXT: movl $0, %ecx
4064 ; X86-X87-NEXT: jb .LBB39_4
4065 ; X86-X87-NEXT: # %bb.3:
4066 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
4067 ; X86-X87-NEXT: .LBB39_4:
4068 ; X86-X87-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
4069 ; X86-X87-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
4070 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ecx
4071 ; X86-X87-NEXT: movl $0, %ebx
4072 ; X86-X87-NEXT: jb .LBB39_6
4073 ; X86-X87-NEXT: # %bb.5:
4074 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %ebx
4075 ; X86-X87-NEXT: movl {{[0-9]+}}(%esp), %edx
4076 ; X86-X87-NEXT: .LBB39_6:
4077 ; X86-X87-NEXT: fldt {{\.?LCPI[0-9]+_[0-9]+}}
4078 ; X86-X87-NEXT: fldt {{[-0-9]+}}(%e{{[sb]}}p) # 10-byte Folded Reload
4079 ; X86-X87-NEXT: fucompp
4080 ; X86-X87-NEXT: fnstsw %ax
4081 ; X86-X87-NEXT: # kill: def $ah killed $ah killed $ax
4082 ; X86-X87-NEXT: sahf
4083 ; X86-X87-NEXT: movl $-1, %eax
4084 ; X86-X87-NEXT: movl $-1, %ebp
4085 ; X86-X87-NEXT: movl $-1, %edi
4086 ; X86-X87-NEXT: movl $-1, %esi
4087 ; X86-X87-NEXT: ja .LBB39_8
4088 ; X86-X87-NEXT: # %bb.7:
4089 ; X86-X87-NEXT: movl %ebx, %eax
4090 ; X86-X87-NEXT: movl %edx, %ebp
4091 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
4092 ; X86-X87-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
4093 ; X86-X87-NEXT: .LBB39_8:
4094 ; X86-X87-NEXT: movl %esi, 12(%ecx)
4095 ; X86-X87-NEXT: movl %edi, 8(%ecx)
4096 ; X86-X87-NEXT: movl %ebp, 4(%ecx)
4097 ; X86-X87-NEXT: movl %eax, (%ecx)
4098 ; X86-X87-NEXT: movl %ecx, %eax
4099 ; X86-X87-NEXT: addl $60, %esp
4100 ; X86-X87-NEXT: popl %esi
4101 ; X86-X87-NEXT: popl %edi
4102 ; X86-X87-NEXT: popl %ebx
4103 ; X86-X87-NEXT: popl %ebp
4104 ; X86-X87-NEXT: retl $4
4106 ; X86-SSE-LABEL: test_unsigned_i128_f80:
4108 ; X86-SSE-NEXT: pushl %ebx
4109 ; X86-SSE-NEXT: pushl %edi
4110 ; X86-SSE-NEXT: pushl %esi
4111 ; X86-SSE-NEXT: subl $48, %esp
4112 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %esi
4113 ; X86-SSE-NEXT: fldt {{[0-9]+}}(%esp)
4114 ; X86-SSE-NEXT: fld %st(0)
4115 ; X86-SSE-NEXT: fstpt {{[-0-9]+}}(%e{{[sb]}}p) # 10-byte Folded Spill
4116 ; X86-SSE-NEXT: fstpt {{[0-9]+}}(%esp)
4117 ; X86-SSE-NEXT: leal {{[0-9]+}}(%esp), %eax
4118 ; X86-SSE-NEXT: movl %eax, (%esp)
4119 ; X86-SSE-NEXT: calll __fixunsxfti
4120 ; X86-SSE-NEXT: subl $4, %esp
4121 ; X86-SSE-NEXT: fldt {{[-0-9]+}}(%e{{[sb]}}p) # 10-byte Folded Reload
4122 ; X86-SSE-NEXT: xorl %eax, %eax
4123 ; X86-SSE-NEXT: fldz
4124 ; X86-SSE-NEXT: fxch %st(1)
4125 ; X86-SSE-NEXT: fucomi %st(1), %st
4126 ; X86-SSE-NEXT: fstp %st(1)
4127 ; X86-SSE-NEXT: movl $0, %ecx
4128 ; X86-SSE-NEXT: movl $0, %edx
4129 ; X86-SSE-NEXT: movl $0, %edi
4130 ; X86-SSE-NEXT: jb .LBB39_2
4131 ; X86-SSE-NEXT: # %bb.1:
4132 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
4133 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
4134 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edx
4135 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %edi
4136 ; X86-SSE-NEXT: .LBB39_2:
4137 ; X86-SSE-NEXT: fldt {{\.?LCPI[0-9]+_[0-9]+}}
4138 ; X86-SSE-NEXT: fxch %st(1)
4139 ; X86-SSE-NEXT: fucompi %st(1), %st
4140 ; X86-SSE-NEXT: fstp %st(0)
4141 ; X86-SSE-NEXT: movl $-1, %ebx
4142 ; X86-SSE-NEXT: cmoval %ebx, %edi
4143 ; X86-SSE-NEXT: cmoval %ebx, %edx
4144 ; X86-SSE-NEXT: cmoval %ebx, %ecx
4145 ; X86-SSE-NEXT: cmoval %ebx, %eax
4146 ; X86-SSE-NEXT: movl %eax, 12(%esi)
4147 ; X86-SSE-NEXT: movl %ecx, 8(%esi)
4148 ; X86-SSE-NEXT: movl %edx, 4(%esi)
4149 ; X86-SSE-NEXT: movl %edi, (%esi)
4150 ; X86-SSE-NEXT: movl %esi, %eax
4151 ; X86-SSE-NEXT: addl $48, %esp
4152 ; X86-SSE-NEXT: popl %esi
4153 ; X86-SSE-NEXT: popl %edi
4154 ; X86-SSE-NEXT: popl %ebx
4155 ; X86-SSE-NEXT: retl $4
4157 ; X64-LABEL: test_unsigned_i128_f80:
4159 ; X64-NEXT: subq $40, %rsp
4160 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
4161 ; X64-NEXT: fld %st(0)
4162 ; X64-NEXT: fstpt {{[-0-9]+}}(%r{{[sb]}}p) # 10-byte Folded Spill
4163 ; X64-NEXT: fstpt (%rsp)
4164 ; X64-NEXT: callq __fixunsxfti@PLT
4165 ; X64-NEXT: xorl %ecx, %ecx
4167 ; X64-NEXT: fldt {{[-0-9]+}}(%r{{[sb]}}p) # 10-byte Folded Reload
4168 ; X64-NEXT: fucomi %st(1), %st
4169 ; X64-NEXT: fstp %st(1)
4170 ; X64-NEXT: cmovbq %rcx, %rdx
4171 ; X64-NEXT: cmovbq %rcx, %rax
4172 ; X64-NEXT: fldt {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
4173 ; X64-NEXT: fxch %st(1)
4174 ; X64-NEXT: fucompi %st(1), %st
4175 ; X64-NEXT: fstp %st(0)
4176 ; X64-NEXT: movq $-1, %rcx
4177 ; X64-NEXT: cmovaq %rcx, %rax
4178 ; X64-NEXT: cmovaq %rcx, %rdx
4179 ; X64-NEXT: addq $40, %rsp
4181 %x = call i128 @llvm.fptoui.sat.i128.f80(x86_fp80 %f)