gcc/libgcc/config/mcore/lib1funcs.S

304 lines
7.2 KiB
ArmAsm
Raw Normal View History

i * libgcc1-test.c, libgcc1.c, config/i386/perform.h: Delete file. * testsuite/gcc.dg/complete-port.c: New (revised version of libgcc1-test.c) * po/POTFILES.in: Remove libgcc1-test.c and libgcc1.c. * Makefile.in: Delete variables: OLDCC, CCLIBFLAGS, OLDAR, OLDAR_FLAGS, LIBGCC1, LIBGCC1_TEST, CROSS_LIBGCC1, LIB1FUNCS, and LIB1FUNCS_EXTRA. Delete rules: libgcc1-test, libgcc1-test.o. Clarify commentary now that libgcc1 no longer exists. * cross-make: Don't set LIBGCC1. * mklibgcc.in: Delete all code for building from libgcc1.c. Always honor LIB1ASMFUNCS if set. * crtstuff.c, floatlib.c, longlong.h, config/fp-bit.c, config/arc/lib1funcs.asm, config/arm/lib1funcs.asm, config/d30v/libgcc1.asm, config/fr30/lib1funcs.asm, config/h8300/lib1funcs.asm, config/i386/cygwin.asm, config/i386/uwin.asm, config/m68hc11/larith.asm, config/m68k/lb1sf68.asm, config/mcore/lib1.asm, config/mn10200/lib1funcs.asm, config/sh/lib1funcs.asm, config/sparc/lb1spc.asm, config/sparc/lb1spl.asm, config/v850/lib1funcs.asm, config/c4x/libgcc.S: Delete or update references to libgcc1 in commentary. * config/t-libc-ok, config/t-linux, config/t-linux-aout, config/t-netbsd, config/a29k/t-a29kbare, config/a29k/t-vx29k, config/alpha/t-interix, config/alpha/t-osf, config/alpha/t-vms, config/arc/t-arc, config/arm/t-arm-aout, config/arm/t-arm-coff, config/arm/t-arm-elf, config/arm/t-linux, config/arm/t-pe, config/arm/t-semi, config/arm/t-strongarm-coff, config/arm/t-strongarm-elf, config/arm/t-strongarm-pe, config/arm/t-xscale-coff, config/arm/t-xscale-elf, config/avr/t-avr, config/c4x/t-c4x, config/d30v/t-d30v, config/fr30/t-fr30, config/h8300/t-h8300, config/i386/t-beos, config/i386/t-cygwin, config/i386/t-i386elf, config/i386/t-interix, config/i386/t-netware, config/i386/t-next, config/i386/t-rtems-i386, config/i386/t-sol2, config/i960/t-960bare, config/i960/t-vxworks960, config/ia64/t-ia64, config/m32r/t-m32r, config/m68hc11/t-m68hc11-gas, config/m68k/t-lynx, config/m68k/t-m68kbare, config/m68k/t-m68kelf, config/m68k/t-mot3300-gald, config/m68k/t-mot3300-gas, config/m68k/t-next, config/m68k/t-vxworks68, config/m88k/t-bug, config/m88k/t-dgux, config/m88k/t-dgux-gas, config/m88k/t-dguxbcs, config/m88k/t-luna, config/m88k/t-luna-gas, config/m88k/t-m88k, config/m88k/t-m88k-gas, config/m88k/t-sysv4, config/mcore/t-mcore, config/mcore/t-mcore-pe, config/mips/t-bsd, config/mips/t-bsd-gas, config/mips/t-cross64, config/mips/t-ecoff, config/mips/t-elf, config/mips/t-iris6, config/mips/t-r3900, config/mips/t-svr3, config/mips/t-svr3-gas, config/mips/t-svr4, config/mips/t-svr4-gas, config/mips/t-ultrix, config/mn10200/t-mn10200, config/mn10300/t-mn10300, config/pa/t-linux, config/pa/t-linux64, config/pa/t-pa, config/pa/t-pa64, config/pa/t-pro, config/pdp11/t-pdp11, config/pj/t-pj, config/rs6000/t-aix43, config/rs6000/t-beos, config/rs6000/t-darwin, config/rs6000/t-newas, config/rs6000/t-ppccomm, config/rs6000/t-rs6000, config/sh/t-linux, config/sh/t-sh, config/sparc/t-chorus-elf, config/sparc/t-elf, config/sparc/t-sol2, config/sparc/t-sp86x, config/sparc/t-sparcbare, config/sparc/t-sparclite, config/sparc/t-splet, config/sparc/t-sunos41, config/sparc/t-vxsparc, config/sparc/t-vxsparc64, config/v850/t-v850: Don't set any of LIBGCC1, CROSS_LIBGCC1, or LIBGCC1_TEST. * config/alpha/alpha.h, config/i386/i386.h, config/i860/i860.h: Don't set FLOAT_VALUE_TYPE, FLOAT_ARG_TYPE, INTIFY, or FLOATIFY. * config/d30v/d30v.h: Don't mention LIBGCC_NEEDS_DOUBLE, FLOAT_VALUE_TYPE, FLOAT_ARG_TYPE, FLOATIFY, INTIFY, nongcc_SI_type, nongcc_word_type, or perform_* * config/i860/fx2800: Don't define perform_umodsi3 or perform_modsi3. * config/i386/386bsd.h, config/i386/beos-elf.h, config/i386/linux-aout.h, config/i386/linux-oldld.h, config/i386/linux.h, config/i386/mach.h, config/i386/netbsd.h, config/i386/openbsd.h, config/i386/osfrose.h, config/i386/rtemself.h: Don't include i386/perform.h. * config/a29k/t-a29k, config/arm/t-semiaof, config/i370/t-i370, config/i370/t-linux, config/i370/t-mvs, config/i370/t-oe, config/i386/t-djgpp, config/i386/t-i386bare, config/i386/t-vsta, config/ia64/t-hpux, config/mips/t-mips, config/mips/t-mips-gas, config/mips/t-osfrose, config/sparc/t-sp64, config/sparc/t-sunos40, config/vax/t-openbsd, config/vax/t-vax: Delete. * config.gcc: Remove references to deleted files. (arm-semi-aof): Use arm/t-semi for tmake_file. * gcc.texi, install.texi, invoke.texi, tm.texi: Delete or rewrite text which is no longer relevant now that libgcc1 no longer exists. * config/t-openbsd, config/alpha/t-interix, config/i386/t-interix: No need to set INSTALL_ASSERT_H. (Missed in previous sweep.) From-SVN: r42188
2001-05-17 05:16:18 +02:00
/* libgcc routines for the MCore.
2021-01-04 10:26:59 +01:00
Copyright (C) 1993-2021 Free Software Foundation, Inc.
2003-09-27 06:48:30 +02:00
This file is part of GCC.
2003-09-27 06:48:30 +02:00
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#define CONCAT1(a, b) CONCAT2(a, b)
#define CONCAT2(a, b) a ## b
/* Use the right prefix for global labels. */
#define SYM(x) CONCAT1 (__, x)
#ifdef __ELF__
#define TYPE(x) .type SYM (x),@function
#define SIZE(x) .size SYM (x), . - SYM (x)
#else
#define TYPE(x)
#define SIZE(x)
#endif
.macro FUNC_START name
.text
.globl SYM (\name)
TYPE (\name)
SYM (\name):
.endm
.macro FUNC_END name
SIZE (\name)
.endm
#ifdef L_udivsi3
FUNC_START udiv32
FUNC_START udivsi32
movi r1,0 // r1-r2 form 64 bit dividend
movi r4,1 // r4 is quotient (1 for a sentinel)
cmpnei r3,0 // look for 0 divisor
bt 9f
trap 3 // divide by 0
9:
// control iterations; skip across high order 0 bits in dividend
mov r7,r2
cmpnei r7,0
bt 8f
movi r2,0 // 0 dividend
jmp r15 // quick return
8:
ff1 r7 // figure distance to skip
lsl r4,r7 // move the sentinel along (with 0's behind)
lsl r2,r7 // and the low 32 bits of numerator
// appears to be wrong...
// tested out incorrectly in our OS work...
// mov r7,r3 // looking at divisor
// ff1 r7 // I can move 32-r7 more bits to left.
// addi r7,1 // ok, one short of that...
// mov r1,r2
// lsr r1,r7 // bits that came from low order...
// rsubi r7,31 // r7 == "32-n" == LEFT distance
// addi r7,1 // this is (32-n)
// lsl r4,r7 // fixes the high 32 (quotient)
// lsl r2,r7
// cmpnei r4,0
// bf 4f // the sentinel went away...
// run the remaining bits
1: lslc r2,1 // 1 bit left shift of r1-r2
addc r1,r1
cmphs r1,r3 // upper 32 of dividend >= divisor?
bf 2f
sub r1,r3 // if yes, subtract divisor
2: addc r4,r4 // shift by 1 and count subtracts
bf 1b // if sentinel falls out of quotient, stop
4: mov r2,r4 // return quotient
mov r3,r1 // and piggyback the remainder
jmp r15
FUNC_END udiv32
FUNC_END udivsi32
#endif
#ifdef L_umodsi3
FUNC_START urem32
FUNC_START umodsi3
movi r1,0 // r1-r2 form 64 bit dividend
movi r4,1 // r4 is quotient (1 for a sentinel)
cmpnei r3,0 // look for 0 divisor
bt 9f
trap 3 // divide by 0
9:
// control iterations; skip across high order 0 bits in dividend
mov r7,r2
cmpnei r7,0
bt 8f
movi r2,0 // 0 dividend
jmp r15 // quick return
8:
ff1 r7 // figure distance to skip
lsl r4,r7 // move the sentinel along (with 0's behind)
lsl r2,r7 // and the low 32 bits of numerator
1: lslc r2,1 // 1 bit left shift of r1-r2
addc r1,r1
cmphs r1,r3 // upper 32 of dividend >= divisor?
bf 2f
sub r1,r3 // if yes, subtract divisor
2: addc r4,r4 // shift by 1 and count subtracts
bf 1b // if sentinel falls out of quotient, stop
mov r2,r1 // return remainder
jmp r15
FUNC_END urem32
FUNC_END umodsi3
#endif
#ifdef L_divsi3
FUNC_START div32
FUNC_START divsi3
mov r5,r2 // calc sign of quotient
xor r5,r3
abs r2 // do unsigned divide
abs r3
movi r1,0 // r1-r2 form 64 bit dividend
movi r4,1 // r4 is quotient (1 for a sentinel)
cmpnei r3,0 // look for 0 divisor
bt 9f
trap 3 // divide by 0
9:
// control iterations; skip across high order 0 bits in dividend
mov r7,r2
cmpnei r7,0
bt 8f
movi r2,0 // 0 dividend
jmp r15 // quick return
8:
ff1 r7 // figure distance to skip
lsl r4,r7 // move the sentinel along (with 0's behind)
lsl r2,r7 // and the low 32 bits of numerator
// tested out incorrectly in our OS work...
// mov r7,r3 // looking at divisor
// ff1 r7 // I can move 32-r7 more bits to left.
// addi r7,1 // ok, one short of that...
// mov r1,r2
// lsr r1,r7 // bits that came from low order...
// rsubi r7,31 // r7 == "32-n" == LEFT distance
// addi r7,1 // this is (32-n)
// lsl r4,r7 // fixes the high 32 (quotient)
// lsl r2,r7
// cmpnei r4,0
// bf 4f // the sentinel went away...
// run the remaining bits
1: lslc r2,1 // 1 bit left shift of r1-r2
addc r1,r1
cmphs r1,r3 // upper 32 of dividend >= divisor?
bf 2f
sub r1,r3 // if yes, subtract divisor
2: addc r4,r4 // shift by 1 and count subtracts
bf 1b // if sentinel falls out of quotient, stop
4: mov r2,r4 // return quotient
mov r3,r1 // piggyback the remainder
btsti r5,31 // after adjusting for sign
bf 3f
rsubi r2,0
rsubi r3,0
3: jmp r15
FUNC_END div32
FUNC_END divsi3
#endif
#ifdef L_modsi3
FUNC_START rem32
FUNC_START modsi3
mov r5,r2 // calc sign of remainder
abs r2 // do unsigned divide
abs r3
movi r1,0 // r1-r2 form 64 bit dividend
movi r4,1 // r4 is quotient (1 for a sentinel)
cmpnei r3,0 // look for 0 divisor
bt 9f
trap 3 // divide by 0
9:
// control iterations; skip across high order 0 bits in dividend
mov r7,r2
cmpnei r7,0
bt 8f
movi r2,0 // 0 dividend
jmp r15 // quick return
8:
ff1 r7 // figure distance to skip
lsl r4,r7 // move the sentinel along (with 0's behind)
lsl r2,r7 // and the low 32 bits of numerator
1: lslc r2,1 // 1 bit left shift of r1-r2
addc r1,r1
cmphs r1,r3 // upper 32 of dividend >= divisor?
bf 2f
sub r1,r3 // if yes, subtract divisor
2: addc r4,r4 // shift by 1 and count subtracts
bf 1b // if sentinel falls out of quotient, stop
mov r2,r1 // return remainder
btsti r5,31 // after adjusting for sign
bf 3f
rsubi r2,0
3: jmp r15
FUNC_END rem32
FUNC_END modsi3
#endif
/* GCC expects that {__eq,__ne,__gt,__ge,__le,__lt}{df2,sf2}
will behave as __cmpdf2. So, we stub the implementations to
jump on to __cmpdf2 and __cmpsf2.
All of these shortcircuit the return path so that __cmp{sd}f2
will go directly back to the caller. */
.macro COMPARE_DF_JUMP name
.import SYM (cmpdf2)
FUNC_START \name
jmpi SYM (cmpdf2)
FUNC_END \name
.endm
#ifdef L_eqdf2
COMPARE_DF_JUMP eqdf2
#endif /* L_eqdf2 */
#ifdef L_nedf2
COMPARE_DF_JUMP nedf2
#endif /* L_nedf2 */
#ifdef L_gtdf2
COMPARE_DF_JUMP gtdf2
#endif /* L_gtdf2 */
#ifdef L_gedf2
COMPARE_DF_JUMP gedf2
#endif /* L_gedf2 */
#ifdef L_ltdf2
COMPARE_DF_JUMP ltdf2
#endif /* L_ltdf2 */
#ifdef L_ledf2
COMPARE_DF_JUMP ledf2
#endif /* L_ledf2 */
/* SINGLE PRECISION FLOATING POINT STUBS */
.macro COMPARE_SF_JUMP name
.import SYM (cmpsf2)
FUNC_START \name
jmpi SYM (cmpsf2)
FUNC_END \name
.endm
#ifdef L_eqsf2
COMPARE_SF_JUMP eqsf2
#endif /* L_eqsf2 */
#ifdef L_nesf2
COMPARE_SF_JUMP nesf2
#endif /* L_nesf2 */
#ifdef L_gtsf2
COMPARE_SF_JUMP gtsf2
#endif /* L_gtsf2 */
#ifdef L_gesf2
COMPARE_SF_JUMP __gesf2
#endif /* L_gesf2 */
#ifdef L_ltsf2
COMPARE_SF_JUMP __ltsf2
#endif /* L_ltsf2 */
#ifdef L_lesf2
COMPARE_SF_JUMP lesf2
#endif /* L_lesf2 */