Howard Hinnant | 9ad441f | 2010-11-16 22:13:33 +0000 | [diff] [blame] | 1 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 2 | // Source Licenses. See LICENSE.TXT for details. |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 3 | |
Daniel Dunbar | 19336a2 | 2009-10-27 17:49:50 +0000 | [diff] [blame] | 4 | #include "../assembly.h" |
| 5 | |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 6 | // float __floatundisf(du_int a); |
| 7 | |
| 8 | #ifdef __x86_64__ |
| 9 | |
Edward O'Callaghan | eed1300 | 2009-11-04 23:52:51 +0000 | [diff] [blame] | 10 | #ifndef __ELF__ |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 11 | .literal4 |
Edward O'Callaghan | eed1300 | 2009-11-04 23:52:51 +0000 | [diff] [blame] | 12 | #endif |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 13 | two: .single 2.0 |
| 14 | |
| 15 | #define REL_ADDR(_a) (_a)(%rip) |
| 16 | |
| 17 | .text |
| 18 | .align 4 |
Daniel Dunbar | b4b1e8c | 2009-10-27 17:50:21 +0000 | [diff] [blame] | 19 | DEFINE_COMPILERRT_FUNCTION(__floatundisf) |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 20 | movq $1, %rsi |
| 21 | testq %rdi, %rdi |
| 22 | js 1f |
| 23 | cvtsi2ssq %rdi, %xmm0 |
| 24 | ret |
| 25 | |
| 26 | 1: andq %rdi, %rsi |
| 27 | shrq %rdi |
| 28 | orq %rsi, %rdi |
| 29 | cvtsi2ssq %rdi, %xmm0 |
| 30 | mulss REL_ADDR(two), %xmm0 |
| 31 | ret |
| 32 | |
Edward O'Callaghan | eed1300 | 2009-11-04 23:52:51 +0000 | [diff] [blame] | 33 | #endif // __x86_64__ |