10b57cec5SDimitry Andric //===-- lib/truncsfhf2.c - single -> half conversion --------------*- C -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #define SRC_SINGLE 100b57cec5SDimitry Andric #define DST_HALF 110b57cec5SDimitry Andric #include "fp_trunc_impl.inc" 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric // Use a forwarding definition and noinline to implement a poor man's alias, 140b57cec5SDimitry Andric // as there isn't a good cross-platform way of defining one. __truncsfhf2(float a)15*e8d8bef9SDimitry AndricCOMPILER_RT_ABI NOINLINE dst_t __truncsfhf2(float a) { 160b57cec5SDimitry Andric return __truncXfYf2__(a); 170b57cec5SDimitry Andric } 180b57cec5SDimitry Andric __gnu_f2h_ieee(float a)19*e8d8bef9SDimitry AndricCOMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); } 200b57cec5SDimitry Andric 210b57cec5SDimitry Andric #if defined(__ARM_EABI__) 220b57cec5SDimitry Andric #if defined(COMPILER_RT_ARMHF_TARGET) __aeabi_f2h(float a)23*e8d8bef9SDimitry AndricAEABI_RTABI dst_t __aeabi_f2h(float a) { return __truncsfhf2(a); } 240b57cec5SDimitry Andric #else 250b57cec5SDimitry Andric COMPILER_RT_ALIAS(__truncsfhf2, __aeabi_f2h) 260b57cec5SDimitry Andric #endif 270b57cec5SDimitry Andric #endif 28