floatundidf.S 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //===-- floatundidf.S - Implement __floatundidf for i386 ------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file implements __floatundidf for the compiler_rt library.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "../assembly.h"
  13. // double __floatundidf(du_int a);
  14. #ifdef __i386__
  15. CONST_SECTION
  16. .balign 16
  17. twop52:
  18. .quad 0x4330000000000000
  19. .balign 16
  20. twop84_plus_twop52:
  21. .quad 0x4530000000100000
  22. .balign 16
  23. twop84:
  24. .quad 0x4530000000000000
  25. #define REL_ADDR(_a) (_a)-0b(%eax)
  26. .text
  27. .balign 4
  28. DEFINE_COMPILERRT_FUNCTION(__floatundidf)
  29. movss 8(%esp), %xmm1 // high 32 bits of a
  30. movss 4(%esp), %xmm0 // low 32 bits of a
  31. calll 0f
  32. 0: popl %eax
  33. orpd REL_ADDR(twop84), %xmm1 // 0x1p84 + a_hi (no rounding occurs)
  34. subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs)
  35. orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs)
  36. addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here)
  37. movsd %xmm0, 4(%esp)
  38. fldl 4(%esp)
  39. ret
  40. END_COMPILERRT_FUNCTION(__floatundidf)
  41. #endif // __i386__
  42. NO_EXEC_STACK_DIRECTIVE