blob: 9c84ab4f938ab7af11c307657238fdf59331be75 [file] [log] [blame]
Ahmed Bougachaf1ac8502015-05-12 18:33:42 +00001//===-- 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 Bougacha9a43d5b2015-05-14 00:50:28 +000014// 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 Abdulrasoole6f96522015-10-06 04:33:05 +000016COMPILER_RT_ABI NOINLINE uint16_t __truncsfhf2(float a) {
Ahmed Bougachaf1ac8502015-05-12 18:33:42 +000017 return __truncXfYf2__(a);
18}
19
20COMPILER_RT_ABI uint16_t __gnu_f2h_ieee(float a) {
Ahmed Bougacha9a43d5b2015-05-14 00:50:28 +000021 return __truncsfhf2(a);
Ahmed Bougachaf1ac8502015-05-12 18:33:42 +000022}
Saleem Abdulrasool36ac5dd2017-05-16 16:41:37 +000023
24#if defined(__ARM_EABI__)
Eli Friedman0d586d02017-10-03 21:25:07 +000025#if defined(COMPILER_RT_ARMHF_TARGET)
Saleem Abdulrasool36ac5dd2017-05-16 16:41:37 +000026AEABI_RTABI uint16_t __aeabi_f2h(float a) {
27 return __truncsfhf2(a);
28}
Eli Friedman0d586d02017-10-03 21:25:07 +000029#else
30AEABI_RTABI uint16_t __aeabi_f2h(float a) COMPILER_RT_ALIAS(__truncsfhf2);
Saleem Abdulrasool36ac5dd2017-05-16 16:41:37 +000031#endif
Eli Friedman0d586d02017-10-03 21:25:07 +000032#endif