xref: /netbsd-src/sys/external/bsd/compiler_rt/dist/lib/builtins/subsf3.c (revision d31434597b255f3fd7646698e04170d148f1de49)
1156cd587Sjoerg //===-- lib/subsf3.c - Single-precision subtraction ---------------*- C -*-===//
2156cd587Sjoerg //
3156cd587Sjoerg //                     The LLVM Compiler Infrastructure
4156cd587Sjoerg //
5156cd587Sjoerg // This file is dual licensed under the MIT and the University of Illinois Open
6156cd587Sjoerg // Source Licenses. See LICENSE.TXT for details.
7156cd587Sjoerg //
8156cd587Sjoerg //===----------------------------------------------------------------------===//
9156cd587Sjoerg //
10156cd587Sjoerg // This file implements single-precision soft-float subtraction with the
11156cd587Sjoerg // IEEE-754 default rounding (to nearest, ties to even).
12156cd587Sjoerg //
13156cd587Sjoerg //===----------------------------------------------------------------------===//
14156cd587Sjoerg 
15156cd587Sjoerg #define SINGLE_PRECISION
16156cd587Sjoerg #include "fp_lib.h"
17156cd587Sjoerg 
18156cd587Sjoerg // Subtraction; flip the sign bit of b and add.
19156cd587Sjoerg COMPILER_RT_ABI fp_t
__subsf3(fp_t a,fp_t b)20156cd587Sjoerg __subsf3(fp_t a, fp_t b) {
21156cd587Sjoerg     return __addsf3(a, fromRep(toRep(b) ^ signBit));
22156cd587Sjoerg }
23156cd587Sjoerg 
243044ee7eSrin #if defined(__ARM_EABI__)
25*d3143459Srin #if defined(COMPILER_RT_ARMHF_TARGET)
__aeabi_fsub(fp_t a,fp_t b)263044ee7eSrin AEABI_RTABI fp_t __aeabi_fsub(fp_t a, fp_t b) {
273044ee7eSrin   return __subsf3(a, b);
283044ee7eSrin }
29*d3143459Srin #else
30*d3143459Srin AEABI_RTABI fp_t __aeabi_fsub(fp_t a, fp_t b) COMPILER_RT_ALIAS(__subsf3);
313044ee7eSrin #endif
32*d3143459Srin #endif
33