| 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 | |
| 5 | #include "../assembly.h" |
| 6 | |
| 7 | // float __floatundisf(du_int a); |
| 8 | |
| 9 | #ifdef __x86_64__ |
| 10 | |
| 11 | CONST_SECTION |
| 12 | |
| 13 | .balign 16 |
| 14 | two: |
| 15 | .single 2.0 |
| 16 | |
| 17 | #define REL_ADDR(_a) (_a)(%rip) |
| 18 | |
| 19 | .text |
| 20 | .balign 4 |
| 21 | DEFINE_COMPILERRT_FUNCTION(__floatundisf) |
| 22 | movq $1, %rsi |
| 23 | testq %rdi, %rdi |
| 24 | js 1f |
| 25 | cvtsi2ssq %rdi, %xmm0 |
| 26 | ret |
| 27 | |
| 28 | 1: andq %rdi, %rsi |
| 29 | shrq %rdi |
| 30 | orq %rsi, %rdi |
| 31 | cvtsi2ssq %rdi, %xmm0 |
| 32 | mulss REL_ADDR(two), %xmm0 |
| 33 | ret |
| 34 | END_COMPILERRT_FUNCTION(__floatundisf) |
| 35 | |
| 36 | #endif // __x86_64__ |
| 37 | |
| 38 | NO_EXEC_STACK_DIRECTIVE |
| 39 | |
| 40 | |