xref: /openbsd-src/gnu/llvm/compiler-rt/lib/builtins/truncsfhf2.c (revision d89ec533011f513df1010f142a111086a0785f09)
13cab2bb3Spatrick //===-- lib/truncsfhf2.c - single -> half conversion --------------*- C -*-===//
23cab2bb3Spatrick //
33cab2bb3Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
43cab2bb3Spatrick // See https://llvm.org/LICENSE.txt for license information.
53cab2bb3Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
63cab2bb3Spatrick //
73cab2bb3Spatrick //===----------------------------------------------------------------------===//
83cab2bb3Spatrick 
93cab2bb3Spatrick #define SRC_SINGLE
103cab2bb3Spatrick #define DST_HALF
113cab2bb3Spatrick #include "fp_trunc_impl.inc"
123cab2bb3Spatrick 
133cab2bb3Spatrick // Use a forwarding definition and noinline to implement a poor man's alias,
143cab2bb3Spatrick // as there isn't a good cross-platform way of defining one.
__truncsfhf2(float a)15*d89ec533Spatrick COMPILER_RT_ABI NOINLINE dst_t __truncsfhf2(float a) {
163cab2bb3Spatrick   return __truncXfYf2__(a);
173cab2bb3Spatrick }
183cab2bb3Spatrick 
__gnu_f2h_ieee(float a)19*d89ec533Spatrick COMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); }
203cab2bb3Spatrick 
213cab2bb3Spatrick #if defined(__ARM_EABI__)
223cab2bb3Spatrick #if defined(COMPILER_RT_ARMHF_TARGET)
__aeabi_f2h(float a)23*d89ec533Spatrick AEABI_RTABI dst_t __aeabi_f2h(float a) { return __truncsfhf2(a); }
243cab2bb3Spatrick #else
253cab2bb3Spatrick COMPILER_RT_ALIAS(__truncsfhf2, __aeabi_f2h)
263cab2bb3Spatrick #endif
273cab2bb3Spatrick #endif
28