Home | History | Annotate | Download | only in arm
      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 #define DEFINE_AEABI_FCMP(cond)                            \
     22         .syntax unified                          SEPARATOR \
     23         .p2align 2                               SEPARATOR \
     24 DEFINE_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 \
     31 1:                                               SEPARATOR \
     32         mov       r0, #1                         SEPARATOR \
     33         pop       { r4, pc }                     SEPARATOR \
     34 END_COMPILERRT_FUNCTION(__aeabi_fcmp ## cond)
     35 
     36 DEFINE_AEABI_FCMP(eq)
     37 DEFINE_AEABI_FCMP(lt)
     38 DEFINE_AEABI_FCMP(le)
     39 DEFINE_AEABI_FCMP(ge)
     40 DEFINE_AEABI_FCMP(gt)
     41