bpabi.S revision 169689
1116744Ssam/* Miscellaneous BPABI functions.
2185522Ssam
3116744Ssam   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
4116744Ssam   Contributed by CodeSourcery, LLC.
5116744Ssam
6116744Ssam   This file is free software; you can redistribute it and/or modify it
7116744Ssam   under the terms of the GNU General Public License as published by the
8116744Ssam   Free Software Foundation; either version 2, or (at your option) any
9116744Ssam   later version.
10116744Ssam
11116744Ssam   In addition to the permissions in the GNU General Public License, the
12116744Ssam   Free Software Foundation gives you unlimited permission to link the
13116744Ssam   compiled version of this file into combinations with other programs,
14116744Ssam   and to distribute those combinations without any restriction coming
15116744Ssam   from the use of this file.  (The General Public License restrictions
16116744Ssam   do apply in other respects; for example, they cover modification of
17116744Ssam   the file, and distribution when not linked into a combine
18116744Ssam   executable.)
19116744Ssam
20116744Ssam   This file is distributed in the hope that it will be useful, but
21116744Ssam   WITHOUT ANY WARRANTY; without even the implied warranty of
22116744Ssam   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23116744Ssam   General Public License for more details.
24116744Ssam
25116744Ssam   You should have received a copy of the GNU General Public License
26116744Ssam   along with this program; see the file COPYING.  If not, write to
27116744Ssam   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
28116744Ssam   Boston, MA 02110-1301, USA.  */
29116744Ssam
30116744Ssam#ifdef __ARMEB__
31116744Ssam#define xxh r0
32186094Ssam#define xxl r1
33116744Ssam#define yyh r2
34186094Ssam#define yyl r3
35186094Ssam#else
36186094Ssam#define xxh r1
37186094Ssam#define xxl r0
38243837Sadrian#define yyh r3
39235679Sadrian#define yyl r2
40244952Sadrian#endif
41251655Sadrian
42186094Ssam#ifdef L_aeabi_lcmp
43203286Srpaulo
44190571SsamARM_FUNC_START aeabi_lcmp
45186094Ssam	subs	ip, xxl, yyl
46186094Ssam	sbcs	ip, xxh, yyh
47186094Ssam	subeqs  ip, xxl, yyl
48186094Ssam	mov	r0, ip
49186094Ssam	RET
50186094Ssam	FUNC_END aeabi_lcmp
51185522Ssam
52185522Ssam#endif /* L_aeabi_lcmp */
53185522Ssam
54186094Ssam#ifdef L_aeabi_ulcmp
55186094Ssam
56186094SsamARM_FUNC_START aeabi_ulcmp
57186094Ssam	cmp	xxh, yyh
58186094Ssam	movlo	r0, #-1
59186094Ssam	movhi	r0, #1
60186094Ssam	RETc(ne)
61185522Ssam	cmp	xxl, yyl
62185522Ssam	movlo	r0, #-1
63186094Ssam	movhi	r0, #1
64186094Ssam	moveq	r0, #0
65186094Ssam	RET
66186094Ssam	FUNC_END aeabi_ulcmp
67186094Ssam
68186094Ssam#endif /* L_aeabi_ulcmp */
69185522Ssam
70185522Ssam#ifdef L_aeabi_ldivmod
71186094Ssam
72186094SsamARM_FUNC_START aeabi_ldivmod
73186094Ssam	sub sp, sp, #8
74186094Ssam	stmfd sp!, {sp, lr}
75186094Ssam	bl SYM(__gnu_ldivmod_helper) __PLT__
76186094Ssam	ldr lr, [sp, #4]
77186094Ssam	add sp, sp, #8
78186094Ssam	ldmfd sp!, {r2, r3}
79186094Ssam	RET
80227421Sadrian
81221163Sadrian#endif /* L_aeabi_ldivmod */
82221163Sadrian
83221163Sadrian#ifdef L_aeabi_uldivmod
84186094Ssam
85186094SsamARM_FUNC_START aeabi_uldivmod
86186094Ssam	sub sp, sp, #8
87221163Sadrian	stmfd sp!, {sp, lr}
88186094Ssam	bl SYM(__gnu_uldivmod_helper) __PLT__
89203286Srpaulo	ldr lr, [sp, #4]
90243838Sadrian	add sp, sp, #8
91243838Sadrian	ldmfd sp!, {r2, r3}
92185522Ssam	RET
93244945Sadrian
94231927Sadrian#endif /* L_aeabi_divmod */
95217631Sadrian
96221163Sadrian