xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/truncsfhf2.c (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
1 //===-- lib/truncsfhf2.c - single -> half conversion --------------*- C -*-===//
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 #define SRC_SINGLE
10 #define DST_HALF
11 #include "fp_trunc_impl.inc"
12 
13 // Use a forwarding definition and noinline to implement a poor man's alias,
14 // as there isn't a good cross-platform way of defining one.
15 COMPILER_RT_ABI NOINLINE dst_t __truncsfhf2(float a) {
16   return __truncXfYf2__(a);
17 }
18 
19 COMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); }
20 
21 #if defined(__ARM_EABI__)
22 #if defined(COMPILER_RT_ARMHF_TARGET)
23 AEABI_RTABI dst_t __aeabi_f2h(float a) { return __truncsfhf2(a); }
24 #else
25 COMPILER_RT_ALIAS(__truncsfhf2, __aeabi_f2h)
26 #endif
27 #endif
28