blob: 576a33f25542811f0c3c2f11a133c8fc6dcbfe57 [file] [log] [blame]
Zonr Changf1e4bce2013-02-07 08:29:47 +00001//===-- 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#define DEFINE_AEABI_FCMP(cond) \
22 .syntax unified SEPARATOR \
23 .align 2 SEPARATOR \
24DEFINE_COMPILERRT_FUNCTION(__aeabi_fcmp ## cond) \
25 push { r4, lr } SEPARATOR \
26 bl SYMBOL_NAME(__ ## cond ## sf2) SEPARATOR \
27 cmp r0, #0 SEPARATOR \
28 b ## cond 1f SEPARATOR \
29 mov r0, #0 SEPARATOR \
30 pop { r4, pc } SEPARATOR \
311: SEPARATOR \
32 mov r0, #1 SEPARATOR \
33 pop { r4, pc }
34
35DEFINE_AEABI_FCMP(eq)
36DEFINE_AEABI_FCMP(lt)
37DEFINE_AEABI_FCMP(le)
38DEFINE_AEABI_FCMP(ge)
39DEFINE_AEABI_FCMP(gt)