1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -O3 | FileCheck %s --check-prefixes=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -O3 | FileCheck %s --check-prefixes=X64
5 declare x86_fp80 @llvm.experimental.constrained.fadd.f80(x86_fp80, x86_fp80, metadata, metadata)
6 declare x86_fp80 @llvm.experimental.constrained.fsub.f80(x86_fp80, x86_fp80, metadata, metadata)
7 declare x86_fp80 @llvm.experimental.constrained.fmul.f80(x86_fp80, x86_fp80, metadata, metadata)
8 declare x86_fp80 @llvm.experimental.constrained.fdiv.f80(x86_fp80, x86_fp80, metadata, metadata)
9 declare x86_fp80 @llvm.experimental.constrained.fpext.f80.f32(float, metadata)
10 declare x86_fp80 @llvm.experimental.constrained.fpext.f80.f64(double, metadata)
11 declare x86_fp80 @llvm.experimental.constrained.sqrt.f80(x86_fp80, metadata, metadata)
12 declare float @llvm.experimental.constrained.fptrunc.f32.f80(x86_fp80, metadata, metadata)
13 declare double @llvm.experimental.constrained.fptrunc.f64.f80(x86_fp80, metadata, metadata)
14 declare i1 @llvm.experimental.constrained.fptosi.i1.f80(x86_fp80, metadata)
15 declare i8 @llvm.experimental.constrained.fptosi.i8.f80(x86_fp80, metadata)
16 declare i16 @llvm.experimental.constrained.fptosi.i16.f80(x86_fp80, metadata)
17 declare i32 @llvm.experimental.constrained.fptosi.i32.f80(x86_fp80, metadata)
18 declare i64 @llvm.experimental.constrained.fptosi.i64.f80(x86_fp80, metadata)
19 declare i1 @llvm.experimental.constrained.fptoui.i1.f80(x86_fp80, metadata)
20 declare i8 @llvm.experimental.constrained.fptoui.i8.f80(x86_fp80, metadata)
21 declare i16 @llvm.experimental.constrained.fptoui.i16.f80(x86_fp80, metadata)
22 declare i32 @llvm.experimental.constrained.fptoui.i32.f80(x86_fp80, metadata)
23 declare i64 @llvm.experimental.constrained.fptoui.i64.f80(x86_fp80, metadata)
24 declare x86_fp80 @llvm.experimental.constrained.sitofp.f80.i1(i1, metadata, metadata)
25 declare x86_fp80 @llvm.experimental.constrained.sitofp.f80.i8(i8, metadata, metadata)
26 declare x86_fp80 @llvm.experimental.constrained.sitofp.f80.i16(i16, metadata, metadata)
27 declare x86_fp80 @llvm.experimental.constrained.sitofp.f80.i32(i32, metadata, metadata)
28 declare x86_fp80 @llvm.experimental.constrained.sitofp.f80.i64(i64, metadata, metadata)
29 declare x86_fp80 @llvm.experimental.constrained.uitofp.f80.i1(i1, metadata, metadata)
30 declare x86_fp80 @llvm.experimental.constrained.uitofp.f80.i8(i8, metadata, metadata)
31 declare x86_fp80 @llvm.experimental.constrained.uitofp.f80.i16(i16, metadata, metadata)
32 declare x86_fp80 @llvm.experimental.constrained.uitofp.f80.i32(i32, metadata, metadata)
33 declare x86_fp80 @llvm.experimental.constrained.uitofp.f80.i64(i64, metadata, metadata)
35 define x86_fp80 @fadd_fp80(x86_fp80 %a, x86_fp80 %b) nounwind strictfp {
36 ; X86-LABEL: fadd_fp80:
38 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
39 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
40 ; X86-NEXT: faddp %st, %st(1)
44 ; X64-LABEL: fadd_fp80:
46 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
47 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
48 ; X64-NEXT: faddp %st, %st(1)
51 %ret = call x86_fp80 @llvm.experimental.constrained.fadd.f80(x86_fp80 %a, x86_fp80 %b,
52 metadata !"round.dynamic",
53 metadata !"fpexcept.strict") #0
57 define x86_fp80 @fsub_fp80(x86_fp80 %a, x86_fp80 %b) nounwind strictfp {
58 ; X86-LABEL: fsub_fp80:
60 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
61 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
62 ; X86-NEXT: fsubp %st, %st(1)
66 ; X64-LABEL: fsub_fp80:
68 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
69 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
70 ; X64-NEXT: fsubp %st, %st(1)
73 %ret = call x86_fp80 @llvm.experimental.constrained.fsub.f80(x86_fp80 %a, x86_fp80 %b,
74 metadata !"round.dynamic",
75 metadata !"fpexcept.strict") #0
79 define x86_fp80 @fmul_fp80(x86_fp80 %a, x86_fp80 %b) nounwind strictfp {
80 ; X86-LABEL: fmul_fp80:
82 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
83 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
84 ; X86-NEXT: fmulp %st, %st(1)
88 ; X64-LABEL: fmul_fp80:
90 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
91 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
92 ; X64-NEXT: fmulp %st, %st(1)
95 %ret = call x86_fp80 @llvm.experimental.constrained.fmul.f80(x86_fp80 %a, x86_fp80 %b,
96 metadata !"round.dynamic",
97 metadata !"fpexcept.strict") #0
101 define x86_fp80 @fdiv_fp80(x86_fp80 %a, x86_fp80 %b) nounwind strictfp {
102 ; X86-LABEL: fdiv_fp80:
104 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
105 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
106 ; X86-NEXT: fdivp %st, %st(1)
110 ; X64-LABEL: fdiv_fp80:
112 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
113 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
114 ; X64-NEXT: fdivp %st, %st(1)
117 %ret = call x86_fp80 @llvm.experimental.constrained.fdiv.f80(x86_fp80 %a, x86_fp80 %b,
118 metadata !"round.dynamic",
119 metadata !"fpexcept.strict") #0
123 define x86_fp80 @fpext_f32_to_fp80(float %a) nounwind strictfp {
124 ; X86-LABEL: fpext_f32_to_fp80:
126 ; X86-NEXT: flds {{[0-9]+}}(%esp)
130 ; X64-LABEL: fpext_f32_to_fp80:
132 ; X64-NEXT: movss %xmm0, -{{[0-9]+}}(%rsp)
133 ; X64-NEXT: flds -{{[0-9]+}}(%rsp)
136 %ret = call x86_fp80 @llvm.experimental.constrained.fpext.f80.f32(float %a,
137 metadata !"fpexcept.strict") #0
141 define x86_fp80 @fpext_f64_to_fp80(double %a) nounwind strictfp {
142 ; X86-LABEL: fpext_f64_to_fp80:
144 ; X86-NEXT: fldl {{[0-9]+}}(%esp)
148 ; X64-LABEL: fpext_f64_to_fp80:
150 ; X64-NEXT: movsd %xmm0, -{{[0-9]+}}(%rsp)
151 ; X64-NEXT: fldl -{{[0-9]+}}(%rsp)
154 %ret = call x86_fp80 @llvm.experimental.constrained.fpext.f80.f64(double %a,
155 metadata !"fpexcept.strict") #0
159 define float @fptrunc_fp80_to_f32(x86_fp80 %a) nounwind strictfp {
160 ; X86-LABEL: fptrunc_fp80_to_f32:
162 ; X86-NEXT: pushl %eax
163 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
164 ; X86-NEXT: fstps (%esp)
165 ; X86-NEXT: flds (%esp)
167 ; X86-NEXT: popl %eax
170 ; X64-LABEL: fptrunc_fp80_to_f32:
172 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
173 ; X64-NEXT: fstps -{{[0-9]+}}(%rsp)
175 ; X64-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
177 %ret = call float @llvm.experimental.constrained.fptrunc.f32.f80(x86_fp80 %a,
178 metadata !"round.dynamic",
179 metadata !"fpexcept.strict") #0
183 define double @fptrunc_fp80_to_f64(x86_fp80 %a) nounwind strictfp {
184 ; X86-LABEL: fptrunc_fp80_to_f64:
186 ; X86-NEXT: pushl %ebp
187 ; X86-NEXT: movl %esp, %ebp
188 ; X86-NEXT: andl $-8, %esp
189 ; X86-NEXT: subl $8, %esp
190 ; X86-NEXT: fldt 8(%ebp)
191 ; X86-NEXT: fstpl (%esp)
192 ; X86-NEXT: fldl (%esp)
194 ; X86-NEXT: movl %ebp, %esp
195 ; X86-NEXT: popl %ebp
198 ; X64-LABEL: fptrunc_fp80_to_f64:
200 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
201 ; X64-NEXT: fstpl -{{[0-9]+}}(%rsp)
203 ; X64-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
205 %ret = call double @llvm.experimental.constrained.fptrunc.f64.f80(x86_fp80 %a,
206 metadata !"round.dynamic",
207 metadata !"fpexcept.strict") #0
211 define x86_fp80 @fsqrt_fp80(x86_fp80 %a) nounwind strictfp {
212 ; X86-LABEL: fsqrt_fp80:
214 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
219 ; X64-LABEL: fsqrt_fp80:
221 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
225 %ret = call x86_fp80 @llvm.experimental.constrained.sqrt.f80(x86_fp80 %a,
226 metadata !"round.dynamic",
227 metadata !"fpexcept.strict") #0
231 define i1 @fp80_to_sint1(x86_fp80 %x) #0 {
232 ; X86-LABEL: fp80_to_sint1:
234 ; X86-NEXT: subl $8, %esp
235 ; X86-NEXT: .cfi_def_cfa_offset 12
236 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
238 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp)
239 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
240 ; X86-NEXT: orl $3072, %eax # imm = 0xC00
241 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
242 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
243 ; X86-NEXT: fistps {{[0-9]+}}(%esp)
244 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
245 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
246 ; X86-NEXT: addl $8, %esp
247 ; X86-NEXT: .cfi_def_cfa_offset 4
250 ; X64-LABEL: fp80_to_sint1:
252 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
254 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
255 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
256 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
257 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
258 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
259 ; X64-NEXT: fistps -{{[0-9]+}}(%rsp)
260 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
261 ; X64-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
263 %result = call i1 @llvm.experimental.constrained.fptosi.i1.f80(x86_fp80 %x,
264 metadata !"fpexcept.strict") #0
268 define i8 @fp80_to_sint8(x86_fp80 %x) #0 {
269 ; X86-LABEL: fp80_to_sint8:
271 ; X86-NEXT: subl $8, %esp
272 ; X86-NEXT: .cfi_def_cfa_offset 12
273 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
275 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp)
276 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
277 ; X86-NEXT: orl $3072, %eax # imm = 0xC00
278 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
279 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
280 ; X86-NEXT: fistps {{[0-9]+}}(%esp)
281 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
282 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
283 ; X86-NEXT: addl $8, %esp
284 ; X86-NEXT: .cfi_def_cfa_offset 4
287 ; X64-LABEL: fp80_to_sint8:
289 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
291 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
292 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
293 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
294 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
295 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
296 ; X64-NEXT: fistps -{{[0-9]+}}(%rsp)
297 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
298 ; X64-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
300 %result = call i8 @llvm.experimental.constrained.fptosi.i8.f80(x86_fp80 %x,
301 metadata !"fpexcept.strict") #0
305 define i16 @fp80_to_sint16(x86_fp80 %x) #0 {
306 ; X86-LABEL: fp80_to_sint16:
308 ; X86-NEXT: subl $8, %esp
309 ; X86-NEXT: .cfi_def_cfa_offset 12
310 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
312 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp)
313 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
314 ; X86-NEXT: orl $3072, %eax # imm = 0xC00
315 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
316 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
317 ; X86-NEXT: fistps {{[0-9]+}}(%esp)
318 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
319 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
320 ; X86-NEXT: addl $8, %esp
321 ; X86-NEXT: .cfi_def_cfa_offset 4
324 ; X64-LABEL: fp80_to_sint16:
326 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
328 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
329 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
330 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
331 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
332 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
333 ; X64-NEXT: fistps -{{[0-9]+}}(%rsp)
334 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
335 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
337 %result = call i16 @llvm.experimental.constrained.fptosi.i16.f80(x86_fp80 %x,
338 metadata !"fpexcept.strict") #0
342 define i32 @fp80_to_sint32(x86_fp80 %x) #0 {
343 ; X86-LABEL: fp80_to_sint32:
344 ; X86: # %bb.0: # %entry
345 ; X86-NEXT: subl $8, %esp
346 ; X86-NEXT: .cfi_def_cfa_offset 12
347 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
349 ; X86-NEXT: fnstcw (%esp)
350 ; X86-NEXT: movzwl (%esp), %eax
351 ; X86-NEXT: orl $3072, %eax # imm = 0xC00
352 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
353 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
354 ; X86-NEXT: fistpl {{[0-9]+}}(%esp)
355 ; X86-NEXT: fldcw (%esp)
356 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
357 ; X86-NEXT: addl $8, %esp
358 ; X86-NEXT: .cfi_def_cfa_offset 4
361 ; X64-LABEL: fp80_to_sint32:
362 ; X64: # %bb.0: # %entry
363 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
365 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
366 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
367 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
368 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
369 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
370 ; X64-NEXT: fistpl -{{[0-9]+}}(%rsp)
371 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
372 ; X64-NEXT: movl -{{[0-9]+}}(%rsp), %eax
375 %result = call i32 @llvm.experimental.constrained.fptosi.i32.f80(x86_fp80 %x,
376 metadata !"fpexcept.strict") #0
380 define i64 @fp80_to_sint64(x86_fp80 %x) #0 {
381 ; X86-LABEL: fp80_to_sint64:
383 ; X86-NEXT: pushl %ebp
384 ; X86-NEXT: .cfi_def_cfa_offset 8
385 ; X86-NEXT: .cfi_offset %ebp, -8
386 ; X86-NEXT: movl %esp, %ebp
387 ; X86-NEXT: .cfi_def_cfa_register %ebp
388 ; X86-NEXT: andl $-8, %esp
389 ; X86-NEXT: subl $16, %esp
390 ; X86-NEXT: fldt 8(%ebp)
392 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp)
393 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
394 ; X86-NEXT: orl $3072, %eax # imm = 0xC00
395 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
396 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
397 ; X86-NEXT: fistpll {{[0-9]+}}(%esp)
398 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
399 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
400 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
401 ; X86-NEXT: movl %ebp, %esp
402 ; X86-NEXT: popl %ebp
403 ; X86-NEXT: .cfi_def_cfa %esp, 4
406 ; X64-LABEL: fp80_to_sint64:
408 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
410 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
411 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
412 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
413 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
414 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
415 ; X64-NEXT: fistpll -{{[0-9]+}}(%rsp)
416 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
417 ; X64-NEXT: movq -{{[0-9]+}}(%rsp), %rax
419 %result = call i64 @llvm.experimental.constrained.fptosi.i64.f80(x86_fp80 %x,
420 metadata !"fpexcept.strict") #0
424 define i1 @fp80_to_uint1(x86_fp80 %x) #0 {
425 ; X86-LABEL: fp80_to_uint1:
427 ; X86-NEXT: subl $8, %esp
428 ; X86-NEXT: .cfi_def_cfa_offset 12
429 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
431 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp)
432 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
433 ; X86-NEXT: orl $3072, %eax # imm = 0xC00
434 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
435 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
436 ; X86-NEXT: fistps {{[0-9]+}}(%esp)
437 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
438 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
439 ; X86-NEXT: addl $8, %esp
440 ; X86-NEXT: .cfi_def_cfa_offset 4
443 ; X64-LABEL: fp80_to_uint1:
445 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
447 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
448 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
449 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
450 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
451 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
452 ; X64-NEXT: fistps -{{[0-9]+}}(%rsp)
453 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
454 ; X64-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
456 %result = call i1 @llvm.experimental.constrained.fptoui.i1.f80(x86_fp80 %x,
457 metadata !"fpexcept.strict") #0
461 define i8 @fp80_to_uint8(x86_fp80 %x) #0 {
462 ; X86-LABEL: fp80_to_uint8:
464 ; X86-NEXT: subl $8, %esp
465 ; X86-NEXT: .cfi_def_cfa_offset 12
466 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
468 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp)
469 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
470 ; X86-NEXT: orl $3072, %eax # imm = 0xC00
471 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
472 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
473 ; X86-NEXT: fistps {{[0-9]+}}(%esp)
474 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
475 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
476 ; X86-NEXT: addl $8, %esp
477 ; X86-NEXT: .cfi_def_cfa_offset 4
480 ; X64-LABEL: fp80_to_uint8:
482 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
484 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
485 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
486 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
487 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
488 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
489 ; X64-NEXT: fistps -{{[0-9]+}}(%rsp)
490 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
491 ; X64-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
493 %result = call i8 @llvm.experimental.constrained.fptoui.i8.f80(x86_fp80 %x,
494 metadata !"fpexcept.strict") #0
498 define i16 @fp80_to_uint16(x86_fp80 %x) #0 {
499 ; X86-LABEL: fp80_to_uint16:
501 ; X86-NEXT: subl $8, %esp
502 ; X86-NEXT: .cfi_def_cfa_offset 12
503 ; X86-NEXT: fldt {{[0-9]+}}(%esp)
505 ; X86-NEXT: fnstcw (%esp)
506 ; X86-NEXT: movzwl (%esp), %eax
507 ; X86-NEXT: orl $3072, %eax # imm = 0xC00
508 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
509 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
510 ; X86-NEXT: fistpl {{[0-9]+}}(%esp)
511 ; X86-NEXT: fldcw (%esp)
512 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
513 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
514 ; X86-NEXT: addl $8, %esp
515 ; X86-NEXT: .cfi_def_cfa_offset 4
518 ; X64-LABEL: fp80_to_uint16:
520 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
522 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
523 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
524 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
525 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
526 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
527 ; X64-NEXT: fistpl -{{[0-9]+}}(%rsp)
528 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
529 ; X64-NEXT: movl -{{[0-9]+}}(%rsp), %eax
530 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
532 %result = call i16 @llvm.experimental.constrained.fptoui.i16.f80(x86_fp80 %x,
533 metadata !"fpexcept.strict") #0
537 define i32 @fp80_to_uint32(x86_fp80 %x) #0 {
538 ; X86-LABEL: fp80_to_uint32:
540 ; X86-NEXT: pushl %ebp
541 ; X86-NEXT: .cfi_def_cfa_offset 8
542 ; X86-NEXT: .cfi_offset %ebp, -8
543 ; X86-NEXT: movl %esp, %ebp
544 ; X86-NEXT: .cfi_def_cfa_register %ebp
545 ; X86-NEXT: andl $-8, %esp
546 ; X86-NEXT: subl $16, %esp
547 ; X86-NEXT: fldt 8(%ebp)
549 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp)
550 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
551 ; X86-NEXT: orl $3072, %eax # imm = 0xC00
552 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
553 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
554 ; X86-NEXT: fistpll {{[0-9]+}}(%esp)
555 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
556 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
557 ; X86-NEXT: movl %ebp, %esp
558 ; X86-NEXT: popl %ebp
559 ; X86-NEXT: .cfi_def_cfa %esp, 4
562 ; X64-LABEL: fp80_to_uint32:
564 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
566 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
567 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax
568 ; X64-NEXT: orl $3072, %eax # imm = 0xC00
569 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
570 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
571 ; X64-NEXT: fistpll -{{[0-9]+}}(%rsp)
572 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
573 ; X64-NEXT: movl -{{[0-9]+}}(%rsp), %eax
575 %result = call i32 @llvm.experimental.constrained.fptoui.i32.f80(x86_fp80 %x,
576 metadata !"fpexcept.strict") #0
580 define i64 @fp80_to_uint64(x86_fp80 %x) #0 {
581 ; X86-LABEL: fp80_to_uint64:
583 ; X86-NEXT: pushl %ebp
584 ; X86-NEXT: .cfi_def_cfa_offset 8
585 ; X86-NEXT: .cfi_offset %ebp, -8
586 ; X86-NEXT: movl %esp, %ebp
587 ; X86-NEXT: .cfi_def_cfa_register %ebp
588 ; X86-NEXT: andl $-8, %esp
589 ; X86-NEXT: subl $16, %esp
590 ; X86-NEXT: fldt 8(%ebp)
591 ; X86-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
592 ; X86-NEXT: fcom %st(1)
594 ; X86-NEXT: fnstsw %ax
595 ; X86-NEXT: xorl %edx, %edx
596 ; X86-NEXT: # kill: def $ah killed $ah killed $ax
598 ; X86-NEXT: setbe %al
600 ; X86-NEXT: jbe .LBB18_2
602 ; X86-NEXT: fstp %st(1)
604 ; X86-NEXT: .LBB18_2:
605 ; X86-NEXT: fstp %st(0)
606 ; X86-NEXT: fsubrp %st, %st(1)
608 ; X86-NEXT: fnstcw {{[0-9]+}}(%esp)
609 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
610 ; X86-NEXT: orl $3072, %ecx # imm = 0xC00
611 ; X86-NEXT: movw %cx, {{[0-9]+}}(%esp)
612 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
613 ; X86-NEXT: fistpll {{[0-9]+}}(%esp)
614 ; X86-NEXT: fldcw {{[0-9]+}}(%esp)
615 ; X86-NEXT: movb %al, %dl
616 ; X86-NEXT: shll $31, %edx
617 ; X86-NEXT: xorl {{[0-9]+}}(%esp), %edx
618 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
619 ; X86-NEXT: movl %ebp, %esp
620 ; X86-NEXT: popl %ebp
621 ; X86-NEXT: .cfi_def_cfa %esp, 4
624 ; X64-LABEL: fp80_to_uint64:
626 ; X64-NEXT: fldt {{[0-9]+}}(%rsp)
627 ; X64-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}(%rip)
629 ; X64-NEXT: xorl %eax, %eax
630 ; X64-NEXT: fcomi %st(1), %st
632 ; X64-NEXT: setbe %al
634 ; X64-NEXT: fcmovbe %st(1), %st
635 ; X64-NEXT: fstp %st(1)
636 ; X64-NEXT: fsubrp %st, %st(1)
638 ; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
639 ; X64-NEXT: movzwl -{{[0-9]+}}(%rsp), %ecx
640 ; X64-NEXT: orl $3072, %ecx # imm = 0xC00
641 ; X64-NEXT: movw %cx, -{{[0-9]+}}(%rsp)
642 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
643 ; X64-NEXT: fistpll -{{[0-9]+}}(%rsp)
644 ; X64-NEXT: fldcw -{{[0-9]+}}(%rsp)
645 ; X64-NEXT: shlq $63, %rax
646 ; X64-NEXT: xorq -{{[0-9]+}}(%rsp), %rax
648 %result = call i64 @llvm.experimental.constrained.fptoui.i64.f80(x86_fp80 %x,
649 metadata !"fpexcept.strict") #0
653 define x86_fp80 @sint1_to_fp80(i1 %x) #0 {
654 ; X86-LABEL: sint1_to_fp80:
656 ; X86-NEXT: pushl %eax
657 ; X86-NEXT: .cfi_def_cfa_offset 8
658 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
659 ; X86-NEXT: andb $1, %al
661 ; X86-NEXT: movsbl %al, %eax
662 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
663 ; X86-NEXT: filds {{[0-9]+}}(%esp)
665 ; X86-NEXT: popl %eax
666 ; X86-NEXT: .cfi_def_cfa_offset 4
669 ; X64-LABEL: sint1_to_fp80:
671 ; X64-NEXT: andb $1, %dil
672 ; X64-NEXT: negb %dil
673 ; X64-NEXT: movsbl %dil, %eax
674 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
675 ; X64-NEXT: filds -{{[0-9]+}}(%rsp)
678 %result = call x86_fp80 @llvm.experimental.constrained.sitofp.f80.i1(i1 %x,
679 metadata !"round.dynamic",
680 metadata !"fpexcept.strict") #0
684 define x86_fp80 @sint8_to_fp80(i8 %x) #0 {
685 ; X86-LABEL: sint8_to_fp80:
687 ; X86-NEXT: pushl %eax
688 ; X86-NEXT: .cfi_def_cfa_offset 8
689 ; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
690 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
691 ; X86-NEXT: filds {{[0-9]+}}(%esp)
693 ; X86-NEXT: popl %eax
694 ; X86-NEXT: .cfi_def_cfa_offset 4
697 ; X64-LABEL: sint8_to_fp80:
699 ; X64-NEXT: movsbl %dil, %eax
700 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
701 ; X64-NEXT: filds -{{[0-9]+}}(%rsp)
704 %result = call x86_fp80 @llvm.experimental.constrained.sitofp.f80.i8(i8 %x,
705 metadata !"round.dynamic",
706 metadata !"fpexcept.strict") #0
710 define x86_fp80 @sint16_to_fp80(i16 %x) #0 {
711 ; X86-LABEL: sint16_to_fp80:
713 ; X86-NEXT: pushl %eax
714 ; X86-NEXT: .cfi_def_cfa_offset 8
715 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
716 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
717 ; X86-NEXT: filds {{[0-9]+}}(%esp)
719 ; X86-NEXT: popl %eax
720 ; X86-NEXT: .cfi_def_cfa_offset 4
723 ; X64-LABEL: sint16_to_fp80:
725 ; X64-NEXT: movw %di, -{{[0-9]+}}(%rsp)
726 ; X64-NEXT: filds -{{[0-9]+}}(%rsp)
729 %result = call x86_fp80 @llvm.experimental.constrained.sitofp.f80.i16(i16 %x,
730 metadata !"round.dynamic",
731 metadata !"fpexcept.strict") #0
735 define x86_fp80 @sint32_to_fp80(i32 %x) #0 {
736 ; X86-LABEL: sint32_to_fp80:
738 ; X86-NEXT: pushl %eax
739 ; X86-NEXT: .cfi_def_cfa_offset 8
740 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
741 ; X86-NEXT: movl %eax, (%esp)
742 ; X86-NEXT: fildl (%esp)
744 ; X86-NEXT: popl %eax
745 ; X86-NEXT: .cfi_def_cfa_offset 4
748 ; X64-LABEL: sint32_to_fp80:
750 ; X64-NEXT: movl %edi, -{{[0-9]+}}(%rsp)
751 ; X64-NEXT: fildl -{{[0-9]+}}(%rsp)
754 %result = call x86_fp80 @llvm.experimental.constrained.sitofp.f80.i32(i32 %x,
755 metadata !"round.dynamic",
756 metadata !"fpexcept.strict") #0
760 define x86_fp80 @sint64_to_fp80(i64 %x) #0 {
761 ; X86-LABEL: sint64_to_fp80:
763 ; X86-NEXT: fildll {{[0-9]+}}(%esp)
767 ; X64-LABEL: sint64_to_fp80:
769 ; X64-NEXT: movq %rdi, -{{[0-9]+}}(%rsp)
770 ; X64-NEXT: fildll -{{[0-9]+}}(%rsp)
773 %result = call x86_fp80 @llvm.experimental.constrained.sitofp.f80.i64(i64 %x,
774 metadata !"round.dynamic",
775 metadata !"fpexcept.strict") #0
779 define x86_fp80 @uint1_to_fp80(i1 %x) #0 {
780 ; X86-LABEL: uint1_to_fp80:
782 ; X86-NEXT: pushl %eax
783 ; X86-NEXT: .cfi_def_cfa_offset 8
784 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
785 ; X86-NEXT: andb $1, %al
786 ; X86-NEXT: movzbl %al, %eax
787 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
788 ; X86-NEXT: filds {{[0-9]+}}(%esp)
790 ; X86-NEXT: popl %eax
791 ; X86-NEXT: .cfi_def_cfa_offset 4
794 ; X64-LABEL: uint1_to_fp80:
796 ; X64-NEXT: andl $1, %edi
797 ; X64-NEXT: movw %di, -{{[0-9]+}}(%rsp)
798 ; X64-NEXT: filds -{{[0-9]+}}(%rsp)
801 %result = call x86_fp80 @llvm.experimental.constrained.uitofp.f80.i1(i1 %x,
802 metadata !"round.dynamic",
803 metadata !"fpexcept.strict") #0
807 define x86_fp80 @uint8_to_fp80(i8 %x) #0 {
808 ; X86-LABEL: uint8_to_fp80:
810 ; X86-NEXT: pushl %eax
811 ; X86-NEXT: .cfi_def_cfa_offset 8
812 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
813 ; X86-NEXT: movw %ax, {{[0-9]+}}(%esp)
814 ; X86-NEXT: filds {{[0-9]+}}(%esp)
816 ; X86-NEXT: popl %eax
817 ; X86-NEXT: .cfi_def_cfa_offset 4
820 ; X64-LABEL: uint8_to_fp80:
822 ; X64-NEXT: movzbl %dil, %eax
823 ; X64-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
824 ; X64-NEXT: filds -{{[0-9]+}}(%rsp)
827 %result = call x86_fp80 @llvm.experimental.constrained.uitofp.f80.i8(i8 %x,
828 metadata !"round.dynamic",
829 metadata !"fpexcept.strict") #0
833 define x86_fp80 @uint16_to_fp80(i16 %x) #0 {
834 ; X86-LABEL: uint16_to_fp80:
836 ; X86-NEXT: pushl %eax
837 ; X86-NEXT: .cfi_def_cfa_offset 8
838 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
839 ; X86-NEXT: movl %eax, (%esp)
840 ; X86-NEXT: fildl (%esp)
842 ; X86-NEXT: popl %eax
843 ; X86-NEXT: .cfi_def_cfa_offset 4
846 ; X64-LABEL: uint16_to_fp80:
848 ; X64-NEXT: movzwl %di, %eax
849 ; X64-NEXT: movl %eax, -{{[0-9]+}}(%rsp)
850 ; X64-NEXT: fildl -{{[0-9]+}}(%rsp)
853 %result = call x86_fp80 @llvm.experimental.constrained.uitofp.f80.i16(i16 %x,
854 metadata !"round.dynamic",
855 metadata !"fpexcept.strict") #0
859 define x86_fp80 @uint32_to_fp80(i32 %x) #0 {
860 ; X86-LABEL: uint32_to_fp80:
862 ; X86-NEXT: pushl %ebp
863 ; X86-NEXT: .cfi_def_cfa_offset 8
864 ; X86-NEXT: .cfi_offset %ebp, -8
865 ; X86-NEXT: movl %esp, %ebp
866 ; X86-NEXT: .cfi_def_cfa_register %ebp
867 ; X86-NEXT: andl $-8, %esp
868 ; X86-NEXT: subl $8, %esp
869 ; X86-NEXT: movl 8(%ebp), %eax
870 ; X86-NEXT: movl %eax, (%esp)
871 ; X86-NEXT: movl $0, {{[0-9]+}}(%esp)
872 ; X86-NEXT: fildll (%esp)
874 ; X86-NEXT: movl %ebp, %esp
875 ; X86-NEXT: popl %ebp
876 ; X86-NEXT: .cfi_def_cfa %esp, 4
879 ; X64-LABEL: uint32_to_fp80:
881 ; X64-NEXT: movl %edi, %eax
882 ; X64-NEXT: movq %rax, -{{[0-9]+}}(%rsp)
883 ; X64-NEXT: fildll -{{[0-9]+}}(%rsp)
886 %result = call x86_fp80 @llvm.experimental.constrained.uitofp.f80.i32(i32 %x,
887 metadata !"round.dynamic",
888 metadata !"fpexcept.strict") #0
892 define x86_fp80 @uint64_to_fp80(i64 %x) #0 {
893 ; X86-LABEL: uint64_to_fp80:
895 ; X86-NEXT: pushl %ebp
896 ; X86-NEXT: .cfi_def_cfa_offset 8
897 ; X86-NEXT: .cfi_offset %ebp, -8
898 ; X86-NEXT: movl %esp, %ebp
899 ; X86-NEXT: .cfi_def_cfa_register %ebp
900 ; X86-NEXT: andl $-8, %esp
901 ; X86-NEXT: subl $8, %esp
902 ; X86-NEXT: movl 8(%ebp), %eax
903 ; X86-NEXT: movl 12(%ebp), %ecx
904 ; X86-NEXT: movl %ecx, {{[0-9]+}}(%esp)
905 ; X86-NEXT: movl %eax, (%esp)
906 ; X86-NEXT: shrl $31, %ecx
907 ; X86-NEXT: fildll (%esp)
908 ; X86-NEXT: fadds {{\.?LCPI[0-9]+_[0-9]+}}(,%ecx,4)
910 ; X86-NEXT: movl %ebp, %esp
911 ; X86-NEXT: popl %ebp
912 ; X86-NEXT: .cfi_def_cfa %esp, 4
915 ; X64-LABEL: uint64_to_fp80:
917 ; X64-NEXT: movq %rdi, -{{[0-9]+}}(%rsp)
918 ; X64-NEXT: xorl %eax, %eax
919 ; X64-NEXT: testq %rdi, %rdi
921 ; X64-NEXT: fildll -{{[0-9]+}}(%rsp)
922 ; X64-NEXT: fadds {{\.?LCPI[0-9]+_[0-9]+}}(,%rax,4)
925 %result = call x86_fp80 @llvm.experimental.constrained.uitofp.f80.i64(i64 %x,
926 metadata !"round.dynamic",
927 metadata !"fpexcept.strict") #0
931 attributes #0 = { strictfp }