1 //===-- aeabi_dcmp.S - EABI dcmp* implementation ---------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "../assembly.h" 11 12 // int __aeabi_dcmp{eq,lt,le,ge,gt}(double a, double b) { 13 // int result = __{eq,lt,le,ge,gt}df2(a, b); 14 // if (result {==,<,<=,>=,>} 0) { 15 // return 1; 16 // } else { 17 // return 0; 18 // } 19 // } 20 21 #define DEFINE_AEABI_DCMP(cond) \ 22 .syntax unified SEPARATOR \ 23 .p2align 2 SEPARATOR \ 24 DEFINE_COMPILERRT_FUNCTION(__aeabi_dcmp ## cond) \ 25 push { r4, lr } SEPARATOR \ 26 bl SYMBOL_NAME(__ ## cond ## df2) SEPARATOR \ 27 cmp r0, #0 SEPARATOR \ 28 b ## cond 1f SEPARATOR \ 29 mov r0, #0 SEPARATOR \ 30 pop { r4, pc } SEPARATOR \ 31 1: SEPARATOR \ 32 mov r0, #1 SEPARATOR \ 33 pop { r4, pc } SEPARATOR \ 34 END_COMPILERRT_FUNCTION(__aeabi_dcmp ## cond) 35 36 DEFINE_AEABI_DCMP(eq) 37 DEFINE_AEABI_DCMP(lt) 38 DEFINE_AEABI_DCMP(le) 39 DEFINE_AEABI_DCMP(ge) 40 DEFINE_AEABI_DCMP(gt) 41 42 NO_EXEC_STACK_DIRECTIVE 43 44