xref: /aosp_15_r20/external/compiler-rt/lib/builtins/truncsfhf2.c (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot //===-- lib/truncsfhf2.c - single -> half conversion --------------*- C -*-===//
2*7c3d14c8STreehugger Robot //
3*7c3d14c8STreehugger Robot //                     The LLVM Compiler Infrastructure
4*7c3d14c8STreehugger Robot //
5*7c3d14c8STreehugger Robot // This file is dual licensed under the MIT and the University of Illinois Open
6*7c3d14c8STreehugger Robot // Source Licenses. See LICENSE.TXT for details.
7*7c3d14c8STreehugger Robot //
8*7c3d14c8STreehugger Robot //===----------------------------------------------------------------------===//
9*7c3d14c8STreehugger Robot 
10*7c3d14c8STreehugger Robot #define SRC_SINGLE
11*7c3d14c8STreehugger Robot #define DST_HALF
12*7c3d14c8STreehugger Robot #include "fp_trunc_impl.inc"
13*7c3d14c8STreehugger Robot 
ARM_EABI_FNALIAS(f2h,truncsfhf2)14*7c3d14c8STreehugger Robot ARM_EABI_FNALIAS(f2h, truncsfhf2)
15*7c3d14c8STreehugger Robot 
16*7c3d14c8STreehugger Robot // Use a forwarding definition and noinline to implement a poor man's alias,
17*7c3d14c8STreehugger Robot // as there isn't a good cross-platform way of defining one.
18*7c3d14c8STreehugger Robot COMPILER_RT_ABI NOINLINE uint16_t __truncsfhf2(float a) {
19*7c3d14c8STreehugger Robot     return __truncXfYf2__(a);
20*7c3d14c8STreehugger Robot }
21*7c3d14c8STreehugger Robot 
__gnu_f2h_ieee(float a)22*7c3d14c8STreehugger Robot COMPILER_RT_ABI uint16_t __gnu_f2h_ieee(float a) {
23*7c3d14c8STreehugger Robot     return __truncsfhf2(a);
24*7c3d14c8STreehugger Robot }
25