1 /* Copyright (C) 2004 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 /* Common bits for implementing software divide. */
23 # include <asm/gentrap.h>
26 # include <machine/pal.h>
29 /* These are not normal C functions. Argument registers are t10 and t11;
30 the result goes in t12; the return address is in t9. Only t12 and AT
37 /* None of these functions should use implicit anything. */
41 /* Code fragment to invoke _mcount for profiling. This should be invoked
42 directly after allocation of the stack frame. */
48 cfi_rel_offset (ra
, 0)
49 cfi_rel_offset (pv
, 8)
50 cfi_rel_offset (gp
, 16)
64 /* Realign subsequent code with what we'd have without this
65 macro at all. This means aligned with one arithmetic insn
66 used within the bundle. */
72 /* In order to make the below work, all top-level divide routines must
73 use the same frame size. */
76 /* Code fragment to generate an integer divide-by-zero fault. When
77 building libc.so, we arrange for there to be one copy of this code
78 placed late in the dso, such that all branches are forward. When
79 building libc.a, we use multiple copies to avoid having an out of
80 range branch. Users should jump to DIVBYZERO. */
84 #define DIVBYZERO __divbyzero
85 .section
.gnu
.linkonce
.t
.divbyzero
, "ax", @progbits
87 .type __divbyzero
, @function
88 .usepv __divbyzero
, no
91 #define DIVBYZERO $divbyzero
97 cfi_return_column (RA
)
98 cfi_def_cfa_offset (FRAME
)
108 cfi_def_cfa_offset (0)
112 .size DIVBYZERO
, .-DIVBYZERO
115 /* Like the ev6 instructions, but fall back to stack use on prior machines. */
119 .macro _ITOFS gr
, fr
, slot
128 .macro _ITOFT gr
, fr
, slot
137 .macro _FTOIT fr
, gr
, slot
146 /* Similarly, but move two registers. Schedules better for pre-ev6. */
148 .macro _ITOFT2 gr1
, fr1
, slot1
, gr2
, fr2
, slot2