1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-apple-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-apple-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X64
5 ; Verify that we are using the efficient uitofp --> sitofp lowering illustrated
6 ; by the compiler_rt implementation of __floatundisf.
7 ; <rdar://problem/8493982>
9 define float @test(i64 %a) nounwind {
11 ; X86: # %bb.0: # %entry
12 ; X86-NEXT: pushl %ebp
13 ; X86-NEXT: movl %esp, %ebp
14 ; X86-NEXT: andl $-8, %esp
15 ; X86-NEXT: subl $16, %esp
16 ; X86-NEXT: movl 12(%ebp), %eax
17 ; X86-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
18 ; X86-NEXT: movlps %xmm0, {{[0-9]+}}(%esp)
19 ; X86-NEXT: shrl $31, %eax
20 ; X86-NEXT: fildll {{[0-9]+}}(%esp)
21 ; X86-NEXT: fadds {{\.?LCPI[0-9]+_[0-9]+}}(,%eax,4)
22 ; X86-NEXT: fstps {{[0-9]+}}(%esp)
23 ; X86-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
24 ; X86-NEXT: movss %xmm0, (%esp)
25 ; X86-NEXT: flds (%esp)
26 ; X86-NEXT: movl %ebp, %esp
31 ; X64: # %bb.0: # %entry
32 ; X64-NEXT: testq %rdi, %rdi
33 ; X64-NEXT: js .LBB0_1
34 ; X64-NEXT: # %bb.2: # %entry
35 ; X64-NEXT: cvtsi2ss %rdi, %xmm0
38 ; X64-NEXT: movq %rdi, %rax
40 ; X64-NEXT: andl $1, %edi
41 ; X64-NEXT: orq %rax, %rdi
42 ; X64-NEXT: cvtsi2ss %rdi, %xmm0
43 ; X64-NEXT: addss %xmm0, %xmm0
46 %b = uitofp i64 %a to float