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