1 //===-- aeabi_cdcmp.S - EABI cdcmp* implementation ------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "../assembly.h"
12 #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
13 #error big endian support not implemented
16 #define APSR_Z (1 << 30)
17 #define APSR_C (1 << 29)
19 // void __aeabi_cdcmpeq(double a, double b) {
20 // if (isnan(a) || isnan(b)) {
23 // __aeabi_cdcmple(a, b);
29 DEFINE_COMPILERRT_FUNCTION(__aeabi_cdcmpeq)
31 bl __aeabi_cdcmpeq_check_nan
33 #if defined(USE_THUMB_1)
35 // NaN has been ruled out, so __aeabi_cdcmple can't trap
48 // NaN has been ruled out, so __aeabi_cdcmple can't trap
49 // Use "it ne" + unconditional branch to guarantee a supported relocation if
50 // __aeabi_cdcmple is in a different section for some builds.
54 #if defined(USE_THUMB_2)
58 msr APSR_nzcvq, #APSR_C
62 END_COMPILERRT_FUNCTION(__aeabi_cdcmpeq)
65 // void __aeabi_cdcmple(double a, double b) {
66 // if (__aeabi_dcmplt(a, b)) {
68 // } else if (__aeabi_dcmpeq(a, b)) {
77 DEFINE_COMPILERRT_FUNCTION(__aeabi_cdcmple)
78 // Per the RTABI, this function must preserve r0-r11.
79 // Save lr in the same instruction for compactness
84 #if defined(USE_THUMB_1)
114 moveq ip, #(APSR_C | APSR_Z)
122 END_COMPILERRT_FUNCTION(__aeabi_cdcmple)
124 // int __aeabi_cdrcmple(double a, double b) {
125 // return __aeabi_cdcmple(b, a);
130 DEFINE_COMPILERRT_FUNCTION(__aeabi_cdrcmple)
142 END_COMPILERRT_FUNCTION(__aeabi_cdrcmple)
144 NO_EXEC_STACK_DIRECTIVE