xref: /llvm-project/compiler-rt/lib/builtins/subdf3.c (revision 33b8a55329b9a968e4f2d859610d638d7fb394e5)
1a6b264b5SAlexey Samsonov //===-- lib/adddf3.c - Double-precision subtraction ---------------*- C -*-===//
2a6b264b5SAlexey Samsonov //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6a6b264b5SAlexey Samsonov //
7a6b264b5SAlexey Samsonov //===----------------------------------------------------------------------===//
8a6b264b5SAlexey Samsonov //
9*33b8a553SYi Kong // This file implements double-precision soft-float subtraction.
10a6b264b5SAlexey Samsonov //
11a6b264b5SAlexey Samsonov //===----------------------------------------------------------------------===//
12a6b264b5SAlexey Samsonov 
13a6b264b5SAlexey Samsonov #define DOUBLE_PRECISION
14a6b264b5SAlexey Samsonov #include "fp_lib.h"
15a6b264b5SAlexey Samsonov 
16a6b264b5SAlexey Samsonov // Subtraction; flip the sign bit of b and add.
__subdf3(fp_t a,fp_t b)17082b89b2SPetr Hosek COMPILER_RT_ABI fp_t __subdf3(fp_t a, fp_t b) {
18a6b264b5SAlexey Samsonov   return __adddf3(a, fromRep(toRep(b) ^ signBit));
19a6b264b5SAlexey Samsonov }
20a6b264b5SAlexey Samsonov 
2136ac5ddfSSaleem Abdulrasool #if defined(__ARM_EABI__)
220d586d06SEli Friedman #if defined(COMPILER_RT_ARMHF_TARGET)
__aeabi_dsub(fp_t a,fp_t b)23082b89b2SPetr Hosek AEABI_RTABI fp_t __aeabi_dsub(fp_t a, fp_t b) { return __subdf3(a, b); }
240d586d06SEli Friedman #else
2584da0e1bSPetr Hosek COMPILER_RT_ALIAS(__subdf3, __aeabi_dsub)
2636ac5ddfSSaleem Abdulrasool #endif
270d586d06SEli Friedman #endif
28