1ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang//===-- aeabi_fcmp.S - EABI fcmp* implementation ---------------------------===// 2ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// 3ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// The LLVM Compiler Infrastructure 4ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// 5ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// This file is dual licensed under the MIT and the University of Illinois Open 6ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// Source Licenses. See LICENSE.TXT for details. 7ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// 8ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang//===----------------------------------------------------------------------===// 9ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang 10ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang#include "../assembly.h" 11ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang 12ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// int __aeabi_fcmp{eq,lt,le,ge,gt}(float a, float b) { 13ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// int result = __{eq,lt,le,ge,gt}sf2(a, b); 14ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// if (result {==,<,<=,>=,>} 0) { 15ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// return 1; 16ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// } else { 17ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// return 0; 18ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// } 19ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang// } 20ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang 21ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang#define DEFINE_AEABI_FCMP(cond) \ 22ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang .syntax unified SEPARATOR \ 232d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines .p2align 2 SEPARATOR \ 24ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr ChangDEFINE_COMPILERRT_FUNCTION(__aeabi_fcmp ## cond) \ 25ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang push { r4, lr } SEPARATOR \ 26ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang bl SYMBOL_NAME(__ ## cond ## sf2) SEPARATOR \ 27ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang cmp r0, #0 SEPARATOR \ 28ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang b ## cond 1f SEPARATOR \ 29ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang mov r0, #0 SEPARATOR \ 30ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang pop { r4, pc } SEPARATOR \ 31ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang1: SEPARATOR \ 32ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang mov r0, #1 SEPARATOR \ 332d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines pop { r4, pc } SEPARATOR \ 342d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen HinesEND_COMPILERRT_FUNCTION(__aeabi_fcmp ## cond) 35ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr Chang 36ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr ChangDEFINE_AEABI_FCMP(eq) 37ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr ChangDEFINE_AEABI_FCMP(lt) 38ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr ChangDEFINE_AEABI_FCMP(le) 39ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr ChangDEFINE_AEABI_FCMP(ge) 40ce2f1840c8a15318e6e8958a8e36bc1ceaccba75Zonr ChangDEFINE_AEABI_FCMP(gt) 41