1// This file is dual licensed under the MIT and the University of Illinois Open 2// Source Licenses. See LICENSE.TXT for details. 3 4#include "../assembly.h" 5 6// float __floatundisf(du_int a); 7 8#ifdef __x86_64__ 9 10#if defined(__APPLE__) 11 .literal4 12#elif defined(__ELF__) 13 .rodata 14#else 15 .section .rdata,"rd" 16#endif 17two: 18 .single 2.0 19 20#define REL_ADDR(_a) (_a)(%rip) 21 22.text 23.balign 4 24DEFINE_COMPILERRT_FUNCTION(__floatundisf) 25 movq $1, %rsi 26 testq %rdi, %rdi 27 js 1f 28 cvtsi2ssq %rdi, %xmm0 29 ret 30 311: andq %rdi, %rsi 32 shrq %rdi 33 orq %rsi, %rdi 34 cvtsi2ssq %rdi, %xmm0 35 mulss REL_ADDR(two), %xmm0 36 ret 37END_COMPILERRT_FUNCTION(__floatundisf) 38 39#endif // __x86_64__ 40