]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/builtins/arm/aeabi_fcmp.S
Add LLVM openmp trunk r351319 (just before the release_80 branch point)
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / builtins / arm / aeabi_fcmp.S
1 //===-- aeabi_fcmp.S - EABI fcmp* 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_fcmp{eq,lt,le,ge,gt}(float a, float b) {
13 //   int result = __{eq,lt,le,ge,gt}sf2(a, b);
14 //   if (result {==,<,<=,>=,>} 0) {
15 //     return 1;
16 //   } else {
17 //     return 0;
18 //   }
19 // }
20
21 #if defined(COMPILER_RT_ARMHF_TARGET)
22 #  define CONVERT_FCMP_ARGS_TO_SF2_ARGS                    \
23         vmov      s0, r0                         SEPARATOR \
24         vmov      s1, r1
25 #else
26 #  define CONVERT_FCMP_ARGS_TO_SF2_ARGS
27 #endif
28
29 #define DEFINE_AEABI_FCMP(cond)                            \
30         .syntax unified                          SEPARATOR \
31         .p2align 2                               SEPARATOR \
32 DEFINE_COMPILERRT_FUNCTION(__aeabi_fcmp ## cond)           \
33         push      { r4, lr }                     SEPARATOR \
34         CONVERT_FCMP_ARGS_TO_SF2_ARGS            SEPARATOR \
35         bl        SYMBOL_NAME(__ ## cond ## sf2) SEPARATOR \
36         cmp       r0, #0                         SEPARATOR \
37         b ## cond 1f                             SEPARATOR \
38         movs      r0, #0                         SEPARATOR \
39         pop       { r4, pc }                     SEPARATOR \
40 1:                                               SEPARATOR \
41         movs      r0, #1                         SEPARATOR \
42         pop       { r4, pc }                     SEPARATOR \
43 END_COMPILERRT_FUNCTION(__aeabi_fcmp ## cond)
44
45 DEFINE_AEABI_FCMP(eq)
46 DEFINE_AEABI_FCMP(lt)
47 DEFINE_AEABI_FCMP(le)
48 DEFINE_AEABI_FCMP(ge)
49 DEFINE_AEABI_FCMP(gt)
50
51 NO_EXEC_STACK_DIRECTIVE
52