1 //===-- aeabi_cdcmp.S - EABI cdcmp* implementation ------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "../assembly.h"
11 #define APSR_Z (1 << 30)
12 #define APSR_C (1 << 29)
14 // void __aeabi_cdcmpeq(double a, double b) {
15 // if (isnan(a) || isnan(b)) {
18 // __aeabi_cdcmple(a, b);
24 DEFINE_COMPILERRT_FUNCTION(__aeabi_cdcmpeq)
26 bl __aeabi_cdcmpeq_check_nan
28 #if defined(USE_THUMB_1)
30 // NaN has been ruled out, so __aeabi_cdcmple can't trap
43 // NaN has been ruled out, so __aeabi_cdcmple can't trap
44 // Use "it ne" + unconditional branch to guarantee a supported relocation if
45 // __aeabi_cdcmple is in a different section for some builds.
49 #if defined(USE_THUMB_2)
53 msr APSR_nzcvq, #APSR_C
57 END_COMPILERRT_FUNCTION(__aeabi_cdcmpeq)
60 // void __aeabi_cdcmple(double a, double b) {
61 // if (__aeabi_dcmplt(a, b)) {
63 // } else if (__aeabi_dcmpeq(a, b)) {
72 DEFINE_COMPILERRT_FUNCTION(__aeabi_cdcmple)
73 // Per the RTABI, this function must preserve r0-r11.
74 // Save lr in the same instruction for compactness
79 #if defined(USE_THUMB_1)
109 moveq ip, #(APSR_C | APSR_Z)
117 END_COMPILERRT_FUNCTION(__aeabi_cdcmple)
119 // int __aeabi_cdrcmple(double a, double b) {
120 // return __aeabi_cdcmple(b, a);
125 DEFINE_COMPILERRT_FUNCTION(__aeabi_cdrcmple)
137 END_COMPILERRT_FUNCTION(__aeabi_cdrcmple)
139 NO_EXEC_STACK_DIRECTIVE