Ahmed Bougacha | f1ac850 | 2015-05-12 18:33:42 +0000 | [diff] [blame] | 1 | //===-- lib/truncsfhf2.c - single -> half conversion --------------*- C -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #define SRC_SINGLE |
| 11 | #define DST_HALF |
| 12 | #include "fp_trunc_impl.inc" |
| 13 | |
Ahmed Bougacha | 9a43d5b | 2015-05-14 00:50:28 +0000 | [diff] [blame] | 14 | // Use a forwarding definition and noinline to implement a poor man's alias, |
| 15 | // as there isn't a good cross-platform way of defining one. |
Saleem Abdulrasool | e6f9652 | 2015-10-06 04:33:05 +0000 | [diff] [blame] | 16 | COMPILER_RT_ABI NOINLINE uint16_t __truncsfhf2(float a) { |
Ahmed Bougacha | f1ac850 | 2015-05-12 18:33:42 +0000 | [diff] [blame] | 17 | return __truncXfYf2__(a); |
| 18 | } |
| 19 | |
| 20 | COMPILER_RT_ABI uint16_t __gnu_f2h_ieee(float a) { |
Ahmed Bougacha | 9a43d5b | 2015-05-14 00:50:28 +0000 | [diff] [blame] | 21 | return __truncsfhf2(a); |
Ahmed Bougacha | f1ac850 | 2015-05-12 18:33:42 +0000 | [diff] [blame] | 22 | } |
Saleem Abdulrasool | 36ac5dd | 2017-05-16 16:41:37 +0000 | [diff] [blame] | 23 | |
| 24 | #if defined(__ARM_EABI__) |
Eli Friedman | 0d586d0 | 2017-10-03 21:25:07 +0000 | [diff] [blame] | 25 | #if defined(COMPILER_RT_ARMHF_TARGET) |
Saleem Abdulrasool | 36ac5dd | 2017-05-16 16:41:37 +0000 | [diff] [blame] | 26 | AEABI_RTABI uint16_t __aeabi_f2h(float a) { |
| 27 | return __truncsfhf2(a); |
| 28 | } |
Eli Friedman | 0d586d0 | 2017-10-03 21:25:07 +0000 | [diff] [blame] | 29 | #else |
| 30 | AEABI_RTABI uint16_t __aeabi_f2h(float a) COMPILER_RT_ALIAS(__truncsfhf2); |
Saleem Abdulrasool | 36ac5dd | 2017-05-16 16:41:37 +0000 | [diff] [blame] | 31 | #endif |
Eli Friedman | 0d586d0 | 2017-10-03 21:25:07 +0000 | [diff] [blame] | 32 | #endif |