Commit dfccfad9 by Bob Wilson Committed by Bob Wilson

crti.asm (_init, _fini): Add alternate code for new call0 ABI.

        * config/xtensa/crti.asm (_init, _fini): Add alternate code for new
        call0 ABI.
        * config/xtensa/crtn.asm (_init, _fini): Likewise.
        * config/xtensa/lib1funcs.asm (__mulsi3, __udivsi3, __divsi3,
        __umodsi3, __modsi3): Likewise.
        * config/xtensa/t-xtensa (crti.o, crtn.o): Add $(GCC_CFLAGS) and
        $(INCLUDES).

From-SVN: r70552
parent ba45771e
2003-08-18 Bob Wilson <bob.wilson@acm.org>
* config/xtensa/crti.asm (_init, _fini): Add alternate code for new
call0 ABI.
* config/xtensa/crtn.asm (_init, _fini): Likewise.
* config/xtensa/lib1funcs.asm (__mulsi3, __udivsi3, __divsi3,
__umodsi3, __modsi3): Likewise.
* config/xtensa/t-xtensa (crti.o, crtn.o): Add $(GCC_CFLAGS) and
$(INCLUDES).
2003-08-18 Aldy Hernandez <aldyh@redhat.com> 2003-08-18 Aldy Hernandez <aldyh@redhat.com>
* config/rs6000/spe.md ("*nabssf2_gpr"): New. * config/rs6000/spe.md ("*nabssf2_gpr"): New.
......
...@@ -29,16 +29,28 @@ ...@@ -29,16 +29,28 @@
# .init sections. Users may put any desired instructions in those # .init sections. Users may put any desired instructions in those
# sections. # sections.
#include "xtensa-config.h"
.section .init .section .init
.globl _init .globl _init
.type _init,@function .type _init,@function
.align 4 .align 4
_init: _init:
#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
entry sp, 64 entry sp, 64
#else
addi sp, sp, -32
s32i a0, sp, 0
#endif
.section .fini .section .fini
.globl _fini .globl _fini
.type _fini,@function .type _fini,@function
.align 4 .align 4
_fini: _fini:
#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
entry sp, 64 entry sp, 64
#else
addi sp, sp, -32
s32i a0, sp, 0
#endif
...@@ -29,8 +29,22 @@ ...@@ -29,8 +29,22 @@
# fact return. Users may put any desired instructions in those sections. # fact return. Users may put any desired instructions in those sections.
# This file is the last thing linked into any executable. # This file is the last thing linked into any executable.
#include "xtensa-config.h"
.section .init .section .init
#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
retw retw
#else
l32i a0, sp, 0
addi sp, sp, 32
ret
#endif
.section .fini .section .fini
#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
retw retw
#else
l32i a0, sp, 0
addi sp, sp, 32
ret
#endif
...@@ -75,19 +75,41 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -75,19 +75,41 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#endif #endif
.endm .endm
# Define macros for function entry and return, supporting either the
# standard register windowed ABI or the non-windowed call0 ABI. These
# macros do not allocate any extra stack space, so they only work for
# leaf functions that do not need to spill anything to the stack.
.macro abi_entry reg, size
#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
entry \reg, \size
#else
/* do nothing */
#endif
.endm
.macro abi_return
#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
retw
#else
ret
#endif
.endm
#ifdef L_mulsi3 #ifdef L_mulsi3
.align 4 .align 4
.global __mulsi3 .global __mulsi3
.type __mulsi3,@function .type __mulsi3,@function
__mulsi3: __mulsi3:
entry sp, 32 abi_entry sp, 32
#if XCHAL_HAVE_MUL16 #if XCHAL_HAVE_MUL16
or a4, a2, a3 or a4, a2, a3
srai a4, a4, 16 srai a4, a4, 16
bnez a4, .LMUL16 bnez a4, .LMUL16
mul16u a2, a2, a3 mul16u a2, a2, a3
retw abi_return
.LMUL16: .LMUL16:
srai a4, a2, 16 srai a4, a2, 16
srai a5, a3, 16 srai a5, a3, 16
...@@ -143,7 +165,7 @@ __mulsi3: ...@@ -143,7 +165,7 @@ __mulsi3:
bgeui a3, 16, .Lmult_main_loop bgeui a3, 16, .Lmult_main_loop
neg a3, a2 neg a3, a2
movltz a2, a3, a5 movltz a2, a3, a5
retw abi_return
.align 4 .align 4
.Lmult_main_loop: .Lmult_main_loop:
...@@ -173,7 +195,7 @@ __mulsi3: ...@@ -173,7 +195,7 @@ __mulsi3:
#endif /* !XCHAL_HAVE_MUL16 && !XCHAL_HAVE_MAC16 */ #endif /* !XCHAL_HAVE_MUL16 && !XCHAL_HAVE_MAC16 */
retw abi_return
.size __mulsi3,.-__mulsi3 .size __mulsi3,.-__mulsi3
#endif /* L_mulsi3 */ #endif /* L_mulsi3 */
...@@ -242,7 +264,7 @@ __nsau_data: ...@@ -242,7 +264,7 @@ __nsau_data:
.global __udivsi3 .global __udivsi3
.type __udivsi3,@function .type __udivsi3,@function
__udivsi3: __udivsi3:
entry sp, 32 abi_entry sp, 32
bltui a3, 2, .Lle_one # check if the divisor <= 1 bltui a3, 2, .Lle_one # check if the divisor <= 1
mov a6, a2 # keep dividend in a6 mov a6, a2 # keep dividend in a6
...@@ -275,7 +297,7 @@ __udivsi3: ...@@ -275,7 +297,7 @@ __udivsi3:
bltu a6, a3, .Lreturn bltu a6, a3, .Lreturn
addi a2, a2, 1 # increment quotient if dividend >= divisor addi a2, a2, 1 # increment quotient if dividend >= divisor
.Lreturn: .Lreturn:
retw abi_return
.Lspecial: .Lspecial:
# return dividend >= divisor # return dividend >= divisor
...@@ -283,14 +305,14 @@ __udivsi3: ...@@ -283,14 +305,14 @@ __udivsi3:
bltu a6, a3, .Lreturn2 bltu a6, a3, .Lreturn2
movi a2, 1 movi a2, 1
.Lreturn2: .Lreturn2:
retw abi_return
.Lle_one: .Lle_one:
beqz a3, .Lerror # if divisor == 1, return the dividend beqz a3, .Lerror # if divisor == 1, return the dividend
retw abi_return
.Lerror: .Lerror:
movi a2, 0 # just return 0; could throw an exception movi a2, 0 # just return 0; could throw an exception
retw abi_return
.size __udivsi3,.-__udivsi3 .size __udivsi3,.-__udivsi3
#endif /* L_udivsi3 */ #endif /* L_udivsi3 */
...@@ -301,7 +323,7 @@ __udivsi3: ...@@ -301,7 +323,7 @@ __udivsi3:
.global __divsi3 .global __divsi3
.type __divsi3,@function .type __divsi3,@function
__divsi3: __divsi3:
entry sp, 32 abi_entry sp, 32
xor a7, a2, a3 # sign = dividend ^ divisor xor a7, a2, a3 # sign = dividend ^ divisor
do_abs a6, a2, a4 # udividend = abs(dividend) do_abs a6, a2, a4 # udividend = abs(dividend)
do_abs a3, a3, a4 # udivisor = abs(divisor) do_abs a3, a3, a4 # udivisor = abs(divisor)
...@@ -337,7 +359,7 @@ __divsi3: ...@@ -337,7 +359,7 @@ __divsi3:
.Lreturn: .Lreturn:
neg a5, a2 neg a5, a2
movltz a2, a5, a7 # return (sign < 0) ? -quotient : quotient movltz a2, a5, a7 # return (sign < 0) ? -quotient : quotient
retw abi_return
.Lspecial: .Lspecial:
movi a2, 0 movi a2, 0
...@@ -346,16 +368,16 @@ __divsi3: ...@@ -346,16 +368,16 @@ __divsi3:
movi a4, -1 movi a4, -1
movltz a2, a4, a7 # else return (sign < 0) ? -1 : 1 movltz a2, a4, a7 # else return (sign < 0) ? -1 : 1
.Lreturn2: .Lreturn2:
retw abi_return
.Lle_one: .Lle_one:
beqz a3, .Lerror beqz a3, .Lerror
neg a2, a6 # if udivisor == 1, then return... neg a2, a6 # if udivisor == 1, then return...
movgez a2, a6, a7 # (sign < 0) ? -udividend : udividend movgez a2, a6, a7 # (sign < 0) ? -udividend : udividend
retw abi_return
.Lerror: .Lerror:
movi a2, 0 # just return 0; could throw an exception movi a2, 0 # just return 0; could throw an exception
retw abi_return
.size __divsi3,.-__divsi3 .size __divsi3,.-__divsi3
#endif /* L_divsi3 */ #endif /* L_divsi3 */
...@@ -366,7 +388,7 @@ __divsi3: ...@@ -366,7 +388,7 @@ __divsi3:
.global __umodsi3 .global __umodsi3
.type __umodsi3,@function .type __umodsi3,@function
__umodsi3: __umodsi3:
entry sp, 32 abi_entry sp, 32
bltui a3, 2, .Lle_one # check if the divisor is <= 1 bltui a3, 2, .Lle_one # check if the divisor is <= 1
do_nsau a5, a2, a6, a7 # dividend_shift = nsau(dividend) do_nsau a5, a2, a6, a7 # dividend_shift = nsau(dividend)
...@@ -395,19 +417,19 @@ __umodsi3: ...@@ -395,19 +417,19 @@ __umodsi3:
bltu a2, a3, .Lreturn bltu a2, a3, .Lreturn
sub a2, a2, a3 # subtract once more if dividend >= divisor sub a2, a2, a3 # subtract once more if dividend >= divisor
.Lreturn: .Lreturn:
retw abi_return
.Lspecial: .Lspecial:
bltu a2, a3, .Lreturn2 bltu a2, a3, .Lreturn2
sub a2, a2, a3 # subtract once if dividend >= divisor sub a2, a2, a3 # subtract once if dividend >= divisor
.Lreturn2: .Lreturn2:
retw abi_return
.Lle_one: .Lle_one:
# the divisor is either 0 or 1, so just return 0. # the divisor is either 0 or 1, so just return 0.
# someday we may want to throw an exception if the divisor is 0. # someday we may want to throw an exception if the divisor is 0.
movi a2, 0 movi a2, 0
retw abi_return
.size __umodsi3,.-__umodsi3 .size __umodsi3,.-__umodsi3
#endif /* L_umodsi3 */ #endif /* L_umodsi3 */
...@@ -418,7 +440,7 @@ __umodsi3: ...@@ -418,7 +440,7 @@ __umodsi3:
.global __modsi3 .global __modsi3
.type __modsi3,@function .type __modsi3,@function
__modsi3: __modsi3:
entry sp, 32 abi_entry sp, 32
mov a7, a2 # save original (signed) dividend mov a7, a2 # save original (signed) dividend
do_abs a2, a2, a4 # udividend = abs(dividend) do_abs a2, a2, a4 # udividend = abs(dividend)
do_abs a3, a3, a4 # udivisor = abs(divisor) do_abs a3, a3, a4 # udivisor = abs(divisor)
...@@ -452,7 +474,7 @@ __modsi3: ...@@ -452,7 +474,7 @@ __modsi3:
bgez a7, .Lpositive bgez a7, .Lpositive
neg a2, a2 # if (dividend < 0), return -udividend neg a2, a2 # if (dividend < 0), return -udividend
.Lpositive: .Lpositive:
retw abi_return
.Lspecial: .Lspecial:
bltu a2, a3, .Lreturn2 bltu a2, a3, .Lreturn2
...@@ -461,13 +483,13 @@ __modsi3: ...@@ -461,13 +483,13 @@ __modsi3:
bgez a7, .Lpositive2 bgez a7, .Lpositive2
neg a2, a2 # if (dividend < 0), return -udividend neg a2, a2 # if (dividend < 0), return -udividend
.Lpositive2: .Lpositive2:
retw abi_return
.Lle_one: .Lle_one:
# udivisor is either 0 or 1, so just return 0. # udivisor is either 0 or 1, so just return 0.
# someday we may want to throw an exception if udivisor is 0. # someday we may want to throw an exception if udivisor is 0.
movi a2, 0 movi a2, 0
retw abi_return
.size __modsi3,.-__modsi3 .size __modsi3,.-__modsi3
#endif /* L_modsi3 */ #endif /* L_modsi3 */
...@@ -17,11 +17,11 @@ LIB1ASMFUNCS = _mulsi3 _nsau _divsi3 _modsi3 _udivsi3 _umodsi3 ...@@ -17,11 +17,11 @@ LIB1ASMFUNCS = _mulsi3 _nsau _divsi3 _modsi3 _udivsi3 _umodsi3
LIB2FUNCS_EXTRA += $(srcdir)/config/xtensa/lib2funcs.S LIB2FUNCS_EXTRA += $(srcdir)/config/xtensa/lib2funcs.S
$(T)crti.o: $(srcdir)/config/xtensa/crti.asm $(GCC_PASSES) $(T)crti.o: $(srcdir)/config/xtensa/crti.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o \ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
-x assembler-with-cpp $(srcdir)/config/xtensa/crti.asm -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/xtensa/crti.asm
$(T)crtn.o: $(srcdir)/config/xtensa/crtn.asm $(GCC_PASSES) $(T)crtn.o: $(srcdir)/config/xtensa/crtn.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o \ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
-x assembler-with-cpp $(srcdir)/config/xtensa/crtn.asm -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/xtensa/crtn.asm
$(out_object_file): gt-xtensa.h $(out_object_file): gt-xtensa.h
gt-xtensa.h : s-gtype ; @true gt-xtensa.h : s-gtype ; @true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment