floatundixf.S 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  2. // See https://llvm.org/LICENSE.txt for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include "../assembly.h"
  5. // xf_float __floatundixf(du_int a);16
  6. #ifdef __i386__
  7. CONST_SECTION
  8. .balign 16
  9. twop52:
  10. .quad 0x4330000000000000
  11. .balign 16
  12. twop84_plus_twop52_neg:
  13. .quad 0xc530000000100000
  14. .balign 16
  15. twop84:
  16. .quad 0x4530000000000000
  17. #define REL_ADDR(_a) (_a)-0b(%eax)
  18. .text
  19. .balign 4
  20. DEFINE_COMPILERRT_FUNCTION(__floatundixf)
  21. calll 0f
  22. 0: popl %eax
  23. movss 8(%esp), %xmm0 // hi 32 bits of input
  24. movss 4(%esp), %xmm1 // lo 32 bits of input
  25. orpd REL_ADDR(twop84), %xmm0 // 2^84 + hi (as a double)
  26. orpd REL_ADDR(twop52), %xmm1 // 2^52 + lo (as a double)
  27. addsd REL_ADDR(twop84_plus_twop52_neg), %xmm0 // hi - 2^52 (no rounding occurs)
  28. movsd %xmm1, 4(%esp)
  29. fldl 4(%esp)
  30. movsd %xmm0, 4(%esp)
  31. faddl 4(%esp)
  32. ret
  33. END_COMPILERRT_FUNCTION(__floatundixf)
  34. #endif // __i386__
  35. NO_EXEC_STACK_DIRECTIVE