2008-01-25 Douglas Gregor <doug.gregor@gmail.com>
[official-gcc.git] / gcc / config / arm / bpabi.S
blob1f08346598054f36bb18e233ce6ad7345616606c
1 /* Miscellaneous BPABI functions.
3    Copyright (C) 2003, 2004, 2007  Free Software Foundation, Inc.
4    Contributed by CodeSourcery, LLC.
6    This file is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by the
8    Free Software Foundation; either version 2, or (at your option) any
9    later version.
11    In addition to the permissions in the GNU General Public License, the
12    Free Software Foundation gives you unlimited permission to link the
13    compiled version of this file into combinations with other programs,
14    and to distribute those combinations without any restriction coming
15    from the use of this file.  (The General Public License restrictions
16    do apply in other respects; for example, they cover modification of
17    the file, and distribution when not linked into a combine
18    executable.)
20    This file is distributed in the hope that it will be useful, but
21    WITHOUT ANY WARRANTY; without even the implied warranty of
22    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23    General Public License for more details.
25    You should have received a copy of the GNU General Public License
26    along with this program; see the file COPYING.  If not, write to
27    the Free Software Foundation, 51 Franklin Street, Fifth Floor,
28    Boston, MA 02110-1301, USA.  */
30 #ifdef __ARMEB__
31 #define xxh r0
32 #define xxl r1
33 #define yyh r2
34 #define yyl r3
35 #else
36 #define xxh r1
37 #define xxl r0
38 #define yyh r3
39 #define yyl r2
40 #endif  
41         
42 #ifdef L_aeabi_lcmp
44 ARM_FUNC_START aeabi_lcmp
45         cmp     xxh, yyh
46         do_it   lt
47         movlt   r0, #-1
48         do_it   gt
49         movgt   r0, #1
50         do_it   ne
51         RETc(ne)
52         subs    r0, xxl, yyl
53         do_it   lo
54         movlo   r0, #-1
55         do_it   hi
56         movhi   r0, #1
57         RET
58         FUNC_END aeabi_lcmp
60 #endif /* L_aeabi_lcmp */
61         
62 #ifdef L_aeabi_ulcmp
64 ARM_FUNC_START aeabi_ulcmp
65         cmp     xxh, yyh
66         do_it   lo
67         movlo   r0, #-1
68         do_it   hi
69         movhi   r0, #1
70         do_it   ne
71         RETc(ne)
72         cmp     xxl, yyl
73         do_it   lo
74         movlo   r0, #-1
75         do_it   hi
76         movhi   r0, #1
77         do_it   eq
78         moveq   r0, #0
79         RET
80         FUNC_END aeabi_ulcmp
82 #endif /* L_aeabi_ulcmp */
84 #ifdef L_aeabi_ldivmod
86 ARM_FUNC_START aeabi_ldivmod
87         sub sp, sp, #8
88 #if defined(__thumb2__)
89         mov ip, sp
90         push {ip, lr}
91 #else
92         do_push {sp, lr}
93 #endif
94         bl SYM(__gnu_ldivmod_helper) __PLT__
95         ldr lr, [sp, #4]
96         add sp, sp, #8
97         do_pop {r2, r3}
98         RET
99         
100 #endif /* L_aeabi_ldivmod */
102 #ifdef L_aeabi_uldivmod
104 ARM_FUNC_START aeabi_uldivmod
105         sub sp, sp, #8
106 #if defined(__thumb2__)
107         mov ip, sp
108         push {ip, lr}
109 #else
110         do_push {sp, lr}
111 #endif
112         bl SYM(__gnu_uldivmod_helper) __PLT__
113         ldr lr, [sp, #4]
114         add sp, sp, #8
115         do_pop {r2, r3}
116         RET
117         
118 #endif /* L_aeabi_divmod */
119