1 //===-- aeabi_cfcmp.S - EABI cfcmp* 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_cfcmpeq(float a, float b) {
20 // if (isnan(a) || isnan(b)) {
23 // __aeabi_cfcmple(a, b);
29 DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmpeq)
31 bl __aeabi_cfcmpeq_check_nan
33 #if defined(USE_THUMB_1)
35 // NaN has been ruled out, so __aeabi_cfcmple can't trap
48 // NaN has been ruled out, so __aeabi_cfcmple can't trap
49 // Use "it ne" + unconditional branch to guarantee a supported relocation if
50 // __aeabi_cfcmple 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_cfcmpeq)
65 // void __aeabi_cfcmple(float a, float b) {
66 // if (__aeabi_fcmplt(a, b)) {
68 // } else if (__aeabi_fcmpeq(a, b)) {
77 DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmple)
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_cfcmple)
124 // int __aeabi_cfrcmple(float a, float b) {
125 // return __aeabi_cfcmple(b, a);
130 DEFINE_COMPILERRT_FUNCTION(__aeabi_cfrcmple)
137 END_COMPILERRT_FUNCTION(__aeabi_cfrcmple)
139 NO_EXEC_STACK_DIRECTIVE