URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [config/] [sh/] [lib1funcs.asm] - Rev 282
Compare with Previous | Blame | View Log
/* Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,2004, 2005, 2006, 2009Free Software Foundation, Inc.This file is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation; either version 3, or (at your option) anylater version.This file is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.Under Section 7 of GPL version 3, you are granted additionalpermissions described in the GCC Runtime Library Exception, version3.1, as published by the Free Software Foundation.You should have received a copy of the GNU General Public License anda 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/>. */!! libgcc routines for the Renesas / SuperH SH CPUs.!! Contributed by Steve Chamberlain.!! sac@cygnus.com!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines!! recoded in assembly by Toshiyasu Morita!! tm@netcom.com#if defined(__ELF__) && defined(__linux__).section .note.GNU-stack,"",%progbits.previous#endif/* SH2 optimizations for ___ashrsi3, ___ashlsi3, ___lshrsi3 andELF local label prefixes by J"orn Renneckeamylaar@cygnus.com */#include "lib1funcs.h"/* t-vxworks needs to build both PIC and non-PIC versions of libgcc,so it is more convenient to define NO_FPSCR_VALUES here than todefine it on the command line. */#if defined __vxworks && defined __PIC__#define NO_FPSCR_VALUES#endif#if ! __SH5__#ifdef L_ashiftrt.global GLOBAL(ashiftrt_r4_0).global GLOBAL(ashiftrt_r4_1).global GLOBAL(ashiftrt_r4_2).global GLOBAL(ashiftrt_r4_3).global GLOBAL(ashiftrt_r4_4).global GLOBAL(ashiftrt_r4_5).global GLOBAL(ashiftrt_r4_6).global GLOBAL(ashiftrt_r4_7).global GLOBAL(ashiftrt_r4_8).global GLOBAL(ashiftrt_r4_9).global GLOBAL(ashiftrt_r4_10).global GLOBAL(ashiftrt_r4_11).global GLOBAL(ashiftrt_r4_12).global GLOBAL(ashiftrt_r4_13).global GLOBAL(ashiftrt_r4_14).global GLOBAL(ashiftrt_r4_15).global GLOBAL(ashiftrt_r4_16).global GLOBAL(ashiftrt_r4_17).global GLOBAL(ashiftrt_r4_18).global GLOBAL(ashiftrt_r4_19).global GLOBAL(ashiftrt_r4_20).global GLOBAL(ashiftrt_r4_21).global GLOBAL(ashiftrt_r4_22).global GLOBAL(ashiftrt_r4_23).global GLOBAL(ashiftrt_r4_24).global GLOBAL(ashiftrt_r4_25).global GLOBAL(ashiftrt_r4_26).global GLOBAL(ashiftrt_r4_27).global GLOBAL(ashiftrt_r4_28).global GLOBAL(ashiftrt_r4_29).global GLOBAL(ashiftrt_r4_30).global GLOBAL(ashiftrt_r4_31).global GLOBAL(ashiftrt_r4_32)HIDDEN_FUNC(GLOBAL(ashiftrt_r4_0))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_1))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_2))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_3))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_4))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_5))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_6))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_7))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_8))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_9))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_10))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_11))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_12))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_13))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_14))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_15))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_16))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_17))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_18))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_19))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_20))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_21))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_22))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_23))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_24))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_25))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_26))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_27))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_28))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_29))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_30))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_31))HIDDEN_FUNC(GLOBAL(ashiftrt_r4_32)).align 1GLOBAL(ashiftrt_r4_32):GLOBAL(ashiftrt_r4_31):rotcl r4rtssubc r4,r4GLOBAL(ashiftrt_r4_30):shar r4GLOBAL(ashiftrt_r4_29):shar r4GLOBAL(ashiftrt_r4_28):shar r4GLOBAL(ashiftrt_r4_27):shar r4GLOBAL(ashiftrt_r4_26):shar r4GLOBAL(ashiftrt_r4_25):shar r4GLOBAL(ashiftrt_r4_24):shlr16 r4shlr8 r4rtsexts.b r4,r4GLOBAL(ashiftrt_r4_23):shar r4GLOBAL(ashiftrt_r4_22):shar r4GLOBAL(ashiftrt_r4_21):shar r4GLOBAL(ashiftrt_r4_20):shar r4GLOBAL(ashiftrt_r4_19):shar r4GLOBAL(ashiftrt_r4_18):shar r4GLOBAL(ashiftrt_r4_17):shar r4GLOBAL(ashiftrt_r4_16):shlr16 r4rtsexts.w r4,r4GLOBAL(ashiftrt_r4_15):shar r4GLOBAL(ashiftrt_r4_14):shar r4GLOBAL(ashiftrt_r4_13):shar r4GLOBAL(ashiftrt_r4_12):shar r4GLOBAL(ashiftrt_r4_11):shar r4GLOBAL(ashiftrt_r4_10):shar r4GLOBAL(ashiftrt_r4_9):shar r4GLOBAL(ashiftrt_r4_8):shar r4GLOBAL(ashiftrt_r4_7):shar r4GLOBAL(ashiftrt_r4_6):shar r4GLOBAL(ashiftrt_r4_5):shar r4GLOBAL(ashiftrt_r4_4):shar r4GLOBAL(ashiftrt_r4_3):shar r4GLOBAL(ashiftrt_r4_2):shar r4GLOBAL(ashiftrt_r4_1):rtsshar r4GLOBAL(ashiftrt_r4_0):rtsnopENDFUNC(GLOBAL(ashiftrt_r4_0))ENDFUNC(GLOBAL(ashiftrt_r4_1))ENDFUNC(GLOBAL(ashiftrt_r4_2))ENDFUNC(GLOBAL(ashiftrt_r4_3))ENDFUNC(GLOBAL(ashiftrt_r4_4))ENDFUNC(GLOBAL(ashiftrt_r4_5))ENDFUNC(GLOBAL(ashiftrt_r4_6))ENDFUNC(GLOBAL(ashiftrt_r4_7))ENDFUNC(GLOBAL(ashiftrt_r4_8))ENDFUNC(GLOBAL(ashiftrt_r4_9))ENDFUNC(GLOBAL(ashiftrt_r4_10))ENDFUNC(GLOBAL(ashiftrt_r4_11))ENDFUNC(GLOBAL(ashiftrt_r4_12))ENDFUNC(GLOBAL(ashiftrt_r4_13))ENDFUNC(GLOBAL(ashiftrt_r4_14))ENDFUNC(GLOBAL(ashiftrt_r4_15))ENDFUNC(GLOBAL(ashiftrt_r4_16))ENDFUNC(GLOBAL(ashiftrt_r4_17))ENDFUNC(GLOBAL(ashiftrt_r4_18))ENDFUNC(GLOBAL(ashiftrt_r4_19))ENDFUNC(GLOBAL(ashiftrt_r4_20))ENDFUNC(GLOBAL(ashiftrt_r4_21))ENDFUNC(GLOBAL(ashiftrt_r4_22))ENDFUNC(GLOBAL(ashiftrt_r4_23))ENDFUNC(GLOBAL(ashiftrt_r4_24))ENDFUNC(GLOBAL(ashiftrt_r4_25))ENDFUNC(GLOBAL(ashiftrt_r4_26))ENDFUNC(GLOBAL(ashiftrt_r4_27))ENDFUNC(GLOBAL(ashiftrt_r4_28))ENDFUNC(GLOBAL(ashiftrt_r4_29))ENDFUNC(GLOBAL(ashiftrt_r4_30))ENDFUNC(GLOBAL(ashiftrt_r4_31))ENDFUNC(GLOBAL(ashiftrt_r4_32))#endif#ifdef L_ashiftrt_n!! GLOBAL(ashrsi3)!! Entry:!! r4: Value to shift! r5: Shifts!! Exit:!! r0: Result!! Destroys:!! (none)!.global GLOBAL(ashrsi3)HIDDEN_FUNC(GLOBAL(ashrsi3)).align 2GLOBAL(ashrsi3):mov #31,r0and r0,r5mova LOCAL(ashrsi3_table),r0mov.b @(r0,r5),r5#ifdef __sh1__add r5,r0jmp @r0#elsebraf r5#endifmov r4,r0.align 2LOCAL(ashrsi3_table):.byte LOCAL(ashrsi3_0)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_1)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_2)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_3)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_4)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_5)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_6)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_7)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_8)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_9)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_10)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_11)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_12)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_13)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_14)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_15)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_16)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_17)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_18)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_19)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_20)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_21)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_22)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_23)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_24)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_25)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_26)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_27)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_28)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_29)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_30)-LOCAL(ashrsi3_table).byte LOCAL(ashrsi3_31)-LOCAL(ashrsi3_table)LOCAL(ashrsi3_31):rotcl r0rtssubc r0,r0LOCAL(ashrsi3_30):shar r0LOCAL(ashrsi3_29):shar r0LOCAL(ashrsi3_28):shar r0LOCAL(ashrsi3_27):shar r0LOCAL(ashrsi3_26):shar r0LOCAL(ashrsi3_25):shar r0LOCAL(ashrsi3_24):shlr16 r0shlr8 r0rtsexts.b r0,r0LOCAL(ashrsi3_23):shar r0LOCAL(ashrsi3_22):shar r0LOCAL(ashrsi3_21):shar r0LOCAL(ashrsi3_20):shar r0LOCAL(ashrsi3_19):shar r0LOCAL(ashrsi3_18):shar r0LOCAL(ashrsi3_17):shar r0LOCAL(ashrsi3_16):shlr16 r0rtsexts.w r0,r0LOCAL(ashrsi3_15):shar r0LOCAL(ashrsi3_14):shar r0LOCAL(ashrsi3_13):shar r0LOCAL(ashrsi3_12):shar r0LOCAL(ashrsi3_11):shar r0LOCAL(ashrsi3_10):shar r0LOCAL(ashrsi3_9):shar r0LOCAL(ashrsi3_8):shar r0LOCAL(ashrsi3_7):shar r0LOCAL(ashrsi3_6):shar r0LOCAL(ashrsi3_5):shar r0LOCAL(ashrsi3_4):shar r0LOCAL(ashrsi3_3):shar r0LOCAL(ashrsi3_2):shar r0LOCAL(ashrsi3_1):rtsshar r0LOCAL(ashrsi3_0):rtsnopENDFUNC(GLOBAL(ashrsi3))#endif#ifdef L_ashiftlt!! GLOBAL(ashlsi3)!! Entry:!! r4: Value to shift! r5: Shifts!! Exit:!! r0: Result!! Destroys:!! (none)!.global GLOBAL(ashlsi3)HIDDEN_FUNC(GLOBAL(ashlsi3)).align 2GLOBAL(ashlsi3):mov #31,r0and r0,r5mova LOCAL(ashlsi3_table),r0mov.b @(r0,r5),r5#ifdef __sh1__add r5,r0jmp @r0#elsebraf r5#endifmov r4,r0.align 2LOCAL(ashlsi3_table):.byte LOCAL(ashlsi3_0)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_1)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_2)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_3)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_4)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_5)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_6)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_7)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_8)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_9)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_10)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_11)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_12)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_13)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_14)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_15)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_16)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_17)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_18)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_19)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_20)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_21)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_22)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_23)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_24)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_25)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_26)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_27)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_28)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_29)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_30)-LOCAL(ashlsi3_table).byte LOCAL(ashlsi3_31)-LOCAL(ashlsi3_table)LOCAL(ashlsi3_6):shll2 r0LOCAL(ashlsi3_4):shll2 r0LOCAL(ashlsi3_2):rtsshll2 r0LOCAL(ashlsi3_7):shll2 r0LOCAL(ashlsi3_5):shll2 r0LOCAL(ashlsi3_3):shll2 r0LOCAL(ashlsi3_1):rtsshll r0LOCAL(ashlsi3_14):shll2 r0LOCAL(ashlsi3_12):shll2 r0LOCAL(ashlsi3_10):shll2 r0LOCAL(ashlsi3_8):rtsshll8 r0LOCAL(ashlsi3_15):shll2 r0LOCAL(ashlsi3_13):shll2 r0LOCAL(ashlsi3_11):shll2 r0LOCAL(ashlsi3_9):shll8 r0rtsshll r0LOCAL(ashlsi3_22):shll2 r0LOCAL(ashlsi3_20):shll2 r0LOCAL(ashlsi3_18):shll2 r0LOCAL(ashlsi3_16):rtsshll16 r0LOCAL(ashlsi3_23):shll2 r0LOCAL(ashlsi3_21):shll2 r0LOCAL(ashlsi3_19):shll2 r0LOCAL(ashlsi3_17):shll16 r0rtsshll r0LOCAL(ashlsi3_30):shll2 r0LOCAL(ashlsi3_28):shll2 r0LOCAL(ashlsi3_26):shll2 r0LOCAL(ashlsi3_24):shll16 r0rtsshll8 r0LOCAL(ashlsi3_31):shll2 r0LOCAL(ashlsi3_29):shll2 r0LOCAL(ashlsi3_27):shll2 r0LOCAL(ashlsi3_25):shll16 r0shll8 r0rtsshll r0LOCAL(ashlsi3_0):rtsnopENDFUNC(GLOBAL(ashlsi3))#endif#ifdef L_lshiftrt!! GLOBAL(lshrsi3)!! Entry:!! r4: Value to shift! r5: Shifts!! Exit:!! r0: Result!! Destroys:!! (none)!.global GLOBAL(lshrsi3)HIDDEN_FUNC(GLOBAL(lshrsi3)).align 2GLOBAL(lshrsi3):mov #31,r0and r0,r5mova LOCAL(lshrsi3_table),r0mov.b @(r0,r5),r5#ifdef __sh1__add r5,r0jmp @r0#elsebraf r5#endifmov r4,r0.align 2LOCAL(lshrsi3_table):.byte LOCAL(lshrsi3_0)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_1)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_2)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_3)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_4)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_5)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_6)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_7)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_8)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_9)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_10)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_11)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_12)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_13)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_14)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_15)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_16)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_17)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_18)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_19)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_20)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_21)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_22)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_23)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_24)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_25)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_26)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_27)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_28)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_29)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_30)-LOCAL(lshrsi3_table).byte LOCAL(lshrsi3_31)-LOCAL(lshrsi3_table)LOCAL(lshrsi3_6):shlr2 r0LOCAL(lshrsi3_4):shlr2 r0LOCAL(lshrsi3_2):rtsshlr2 r0LOCAL(lshrsi3_7):shlr2 r0LOCAL(lshrsi3_5):shlr2 r0LOCAL(lshrsi3_3):shlr2 r0LOCAL(lshrsi3_1):rtsshlr r0LOCAL(lshrsi3_14):shlr2 r0LOCAL(lshrsi3_12):shlr2 r0LOCAL(lshrsi3_10):shlr2 r0LOCAL(lshrsi3_8):rtsshlr8 r0LOCAL(lshrsi3_15):shlr2 r0LOCAL(lshrsi3_13):shlr2 r0LOCAL(lshrsi3_11):shlr2 r0LOCAL(lshrsi3_9):shlr8 r0rtsshlr r0LOCAL(lshrsi3_22):shlr2 r0LOCAL(lshrsi3_20):shlr2 r0LOCAL(lshrsi3_18):shlr2 r0LOCAL(lshrsi3_16):rtsshlr16 r0LOCAL(lshrsi3_23):shlr2 r0LOCAL(lshrsi3_21):shlr2 r0LOCAL(lshrsi3_19):shlr2 r0LOCAL(lshrsi3_17):shlr16 r0rtsshlr r0LOCAL(lshrsi3_30):shlr2 r0LOCAL(lshrsi3_28):shlr2 r0LOCAL(lshrsi3_26):shlr2 r0LOCAL(lshrsi3_24):shlr16 r0rtsshlr8 r0LOCAL(lshrsi3_31):shlr2 r0LOCAL(lshrsi3_29):shlr2 r0LOCAL(lshrsi3_27):shlr2 r0LOCAL(lshrsi3_25):shlr16 r0shlr8 r0rtsshlr r0LOCAL(lshrsi3_0):rtsnopENDFUNC(GLOBAL(lshrsi3))#endif#ifdef L_movmem.text.balign 4.global GLOBAL(movmem)HIDDEN_FUNC(GLOBAL(movmem))HIDDEN_ALIAS(movstr,movmem)/* This would be a lot simpler if r6 contained the byte countminus 64, and we wouldn't be called here for a byte count of 64. */GLOBAL(movmem):sts.l pr,@-r15shll2 r6bsr GLOBAL(movmemSI52+2)mov.l @(48,r5),r0.balign 4LOCAL(movmem_loop): /* Reached with rts */mov.l @(60,r5),r0add #-64,r6mov.l r0,@(60,r4)tst r6,r6mov.l @(56,r5),r0bt LOCAL(movmem_done)mov.l r0,@(56,r4)cmp/pl r6mov.l @(52,r5),r0add #64,r5mov.l r0,@(52,r4)add #64,r4bt GLOBAL(movmemSI52)! done all the large groups, do the remainder! jump to movmem+mova GLOBAL(movmemSI4)+4,r0add r6,r0jmp @r0LOCAL(movmem_done): ! share slot insn, works out aligned.lds.l @r15+,prmov.l r0,@(56,r4)mov.l @(52,r5),r0rtsmov.l r0,@(52,r4).balign 4! ??? We need aliases movstr* for movmem* for the older libraries. These! aliases will be removed at the some point in the future..global GLOBAL(movmemSI64)HIDDEN_FUNC(GLOBAL(movmemSI64))HIDDEN_ALIAS(movstrSI64,movmemSI64)GLOBAL(movmemSI64):mov.l @(60,r5),r0mov.l r0,@(60,r4).global GLOBAL(movmemSI60)HIDDEN_FUNC(GLOBAL(movmemSI60))HIDDEN_ALIAS(movstrSI60,movmemSI60)GLOBAL(movmemSI60):mov.l @(56,r5),r0mov.l r0,@(56,r4).global GLOBAL(movmemSI56)HIDDEN_FUNC(GLOBAL(movmemSI56))HIDDEN_ALIAS(movstrSI56,movmemSI56)GLOBAL(movmemSI56):mov.l @(52,r5),r0mov.l r0,@(52,r4).global GLOBAL(movmemSI52)HIDDEN_FUNC(GLOBAL(movmemSI52))HIDDEN_ALIAS(movstrSI52,movmemSI52)GLOBAL(movmemSI52):mov.l @(48,r5),r0mov.l r0,@(48,r4).global GLOBAL(movmemSI48)HIDDEN_FUNC(GLOBAL(movmemSI48))HIDDEN_ALIAS(movstrSI48,movmemSI48)GLOBAL(movmemSI48):mov.l @(44,r5),r0mov.l r0,@(44,r4).global GLOBAL(movmemSI44)HIDDEN_FUNC(GLOBAL(movmemSI44))HIDDEN_ALIAS(movstrSI44,movmemSI44)GLOBAL(movmemSI44):mov.l @(40,r5),r0mov.l r0,@(40,r4).global GLOBAL(movmemSI40)HIDDEN_FUNC(GLOBAL(movmemSI40))HIDDEN_ALIAS(movstrSI40,movmemSI40)GLOBAL(movmemSI40):mov.l @(36,r5),r0mov.l r0,@(36,r4).global GLOBAL(movmemSI36)HIDDEN_FUNC(GLOBAL(movmemSI36))HIDDEN_ALIAS(movstrSI36,movmemSI36)GLOBAL(movmemSI36):mov.l @(32,r5),r0mov.l r0,@(32,r4).global GLOBAL(movmemSI32)HIDDEN_FUNC(GLOBAL(movmemSI32))HIDDEN_ALIAS(movstrSI32,movmemSI32)GLOBAL(movmemSI32):mov.l @(28,r5),r0mov.l r0,@(28,r4).global GLOBAL(movmemSI28)HIDDEN_FUNC(GLOBAL(movmemSI28))HIDDEN_ALIAS(movstrSI28,movmemSI28)GLOBAL(movmemSI28):mov.l @(24,r5),r0mov.l r0,@(24,r4).global GLOBAL(movmemSI24)HIDDEN_FUNC(GLOBAL(movmemSI24))HIDDEN_ALIAS(movstrSI24,movmemSI24)GLOBAL(movmemSI24):mov.l @(20,r5),r0mov.l r0,@(20,r4).global GLOBAL(movmemSI20)HIDDEN_FUNC(GLOBAL(movmemSI20))HIDDEN_ALIAS(movstrSI20,movmemSI20)GLOBAL(movmemSI20):mov.l @(16,r5),r0mov.l r0,@(16,r4).global GLOBAL(movmemSI16)HIDDEN_FUNC(GLOBAL(movmemSI16))HIDDEN_ALIAS(movstrSI16,movmemSI16)GLOBAL(movmemSI16):mov.l @(12,r5),r0mov.l r0,@(12,r4).global GLOBAL(movmemSI12)HIDDEN_FUNC(GLOBAL(movmemSI12))HIDDEN_ALIAS(movstrSI12,movmemSI12)GLOBAL(movmemSI12):mov.l @(8,r5),r0mov.l r0,@(8,r4).global GLOBAL(movmemSI8)HIDDEN_FUNC(GLOBAL(movmemSI8))HIDDEN_ALIAS(movstrSI8,movmemSI8)GLOBAL(movmemSI8):mov.l @(4,r5),r0mov.l r0,@(4,r4).global GLOBAL(movmemSI4)HIDDEN_FUNC(GLOBAL(movmemSI4))HIDDEN_ALIAS(movstrSI4,movmemSI4)GLOBAL(movmemSI4):mov.l @(0,r5),r0rtsmov.l r0,@(0,r4)ENDFUNC(GLOBAL(movmemSI64))ENDFUNC(GLOBAL(movmemSI60))ENDFUNC(GLOBAL(movmemSI56))ENDFUNC(GLOBAL(movmemSI52))ENDFUNC(GLOBAL(movmemSI48))ENDFUNC(GLOBAL(movmemSI44))ENDFUNC(GLOBAL(movmemSI40))ENDFUNC(GLOBAL(movmemSI36))ENDFUNC(GLOBAL(movmemSI32))ENDFUNC(GLOBAL(movmemSI28))ENDFUNC(GLOBAL(movmemSI24))ENDFUNC(GLOBAL(movmemSI20))ENDFUNC(GLOBAL(movmemSI16))ENDFUNC(GLOBAL(movmemSI12))ENDFUNC(GLOBAL(movmemSI8))ENDFUNC(GLOBAL(movmemSI4))ENDFUNC(GLOBAL(movmem))#endif#ifdef L_movmem_i4.text.global GLOBAL(movmem_i4_even).global GLOBAL(movmem_i4_odd).global GLOBAL(movmemSI12_i4)HIDDEN_FUNC(GLOBAL(movmem_i4_even))HIDDEN_FUNC(GLOBAL(movmem_i4_odd))HIDDEN_FUNC(GLOBAL(movmemSI12_i4))HIDDEN_ALIAS(movstr_i4_even,movmem_i4_even)HIDDEN_ALIAS(movstr_i4_odd,movmem_i4_odd)HIDDEN_ALIAS(movstrSI12_i4,movmemSI12_i4).p2align 5L_movmem_2mod4_end:mov.l r0,@(16,r4)rtsmov.l r1,@(20,r4).p2align 2GLOBAL(movmem_i4_even):mov.l @r5+,r0bra L_movmem_start_evenmov.l @r5+,r1GLOBAL(movmem_i4_odd):mov.l @r5+,r1add #-4,r4mov.l @r5+,r2mov.l @r5+,r3mov.l r1,@(4,r4)mov.l r2,@(8,r4)L_movmem_loop:mov.l r3,@(12,r4)dt r6mov.l @r5+,r0bt/s L_movmem_2mod4_endmov.l @r5+,r1add #16,r4L_movmem_start_even:mov.l @r5+,r2mov.l @r5+,r3mov.l r0,@r4dt r6mov.l r1,@(4,r4)bf/s L_movmem_loopmov.l r2,@(8,r4)rtsmov.l r3,@(12,r4)ENDFUNC(GLOBAL(movmem_i4_even))ENDFUNC(GLOBAL(movmem_i4_odd)).p2align 4GLOBAL(movmemSI12_i4):mov.l @r5,r0mov.l @(4,r5),r1mov.l @(8,r5),r2mov.l r0,@r4mov.l r1,@(4,r4)rtsmov.l r2,@(8,r4)ENDFUNC(GLOBAL(movmemSI12_i4))#endif#ifdef L_mulsi3.global GLOBAL(mulsi3)HIDDEN_FUNC(GLOBAL(mulsi3))! r4 = aabb! r5 = ccdd! r0 = aabb*ccdd via partial products!! if aa == 0 and cc = 0! r0 = bb*dd!! else! aa = bb*dd + (aa*dd*65536) + (cc*bb*65536)!GLOBAL(mulsi3):mulu.w r4,r5 ! multiply the lsws macl=bb*ddmov r5,r3 ! r3 = ccddswap.w r4,r2 ! r2 = bbaaxtrct r2,r3 ! r3 = aacctst r3,r3 ! msws zero ?bf hisetrts ! yes - then we have the answersts macl,r0hiset: sts macl,r0 ! r0 = bb*ddmulu.w r2,r5 ! brewing macl = aa*ddsts macl,r1mulu.w r3,r4 ! brewing macl = cc*bbsts macl,r2add r1,r2shll16 r2rtsadd r2,r0ENDFUNC(GLOBAL(mulsi3))#endif#endif /* ! __SH5__ */#ifdef L_sdivsi3_i4.title "SH DIVIDE"!! 4 byte integer Divide code for the Renesas SH#ifdef __SH4__!! args in r4 and r5, result in fpul, clobber dr0, dr2.global GLOBAL(sdivsi3_i4)HIDDEN_FUNC(GLOBAL(sdivsi3_i4))GLOBAL(sdivsi3_i4):lds r4,fpulfloat fpul,dr0lds r5,fpulfloat fpul,dr2fdiv dr2,dr0rtsftrc dr0,fpulENDFUNC(GLOBAL(sdivsi3_i4))#elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__)!! args in r4 and r5, result in fpul, clobber r2, dr0, dr2#if ! __SH5__ || __SH5__ == 32#if __SH5__.mode SHcompact#endif.global GLOBAL(sdivsi3_i4)HIDDEN_FUNC(GLOBAL(sdivsi3_i4))GLOBAL(sdivsi3_i4):sts.l fpscr,@-r15mov #8,r2swap.w r2,r2lds r2,fpscrlds r4,fpulfloat fpul,dr0lds r5,fpulfloat fpul,dr2fdiv dr2,dr0ftrc dr0,fpulrtslds.l @r15+,fpscrENDFUNC(GLOBAL(sdivsi3_i4))#endif /* ! __SH5__ || __SH5__ == 32 */#endif /* ! __SH4__ */#endif#ifdef L_sdivsi3/* __SH4_SINGLE_ONLY__ keeps this part for link compatibility withsh2e/sh3e code. */#if (! defined(__SH4__) && ! defined (__SH4_SINGLE__)) || defined (__linux__)!!!! Steve Chamberlain!! sac@cygnus.com!!!!!! args in r4 and r5, result in r0 clobber r1, r2, r3, and t bit.global GLOBAL(sdivsi3)#if __SHMEDIA__#if __SH5__ == 32.section .text..SHmedia32,"ax"#else.text#endif.align 2#if 0/* The assembly code that follows is a hand-optimized version of the Ccode that follows. Note that the registers that are modified areexactly those listed as clobbered in the patterns divsi3_i1 anddivsi3_i1_media.int __sdivsi3 (i, j)int i, j;{register unsigned long long r18 asm ("r18");register unsigned long long r19 asm ("r19");register unsigned long long r0 asm ("r0") = 0;register unsigned long long r1 asm ("r1") = 1;register int r2 asm ("r2") = i >> 31;register int r3 asm ("r3") = j >> 31;r2 = r2 ? r2 : r1;r3 = r3 ? r3 : r1;r18 = i * r2;r19 = j * r3;r2 *= r3;r19 <<= 31;r1 <<= 31;doif (r18 >= r19)r0 |= r1, r18 -= r19;while (r19 >>= 1, r1 >>= 1);return r2 * (int)r0;}*/GLOBAL(sdivsi3):pt/l LOCAL(sdivsi3_dontadd), tr2pt/l LOCAL(sdivsi3_loop), tr1ptabs/l r18, tr0movi 0, r0movi 1, r1shari.l r4, 31, r2shari.l r5, 31, r3cmveq r2, r1, r2cmveq r3, r1, r3muls.l r4, r2, r18muls.l r5, r3, r19muls.l r2, r3, r2shlli r19, 31, r19shlli r1, 31, r1LOCAL(sdivsi3_loop):bgtu r19, r18, tr2or r0, r1, r0sub r18, r19, r18LOCAL(sdivsi3_dontadd):shlri r1, 1, r1shlri r19, 1, r19bnei r1, 0, tr1muls.l r0, r2, r0add.l r0, r63, r0blink tr0, r63#elif 0 /* ! 0 */// inputs: r4,r5// clobbered: r1,r2,r3,r18,r19,r20,r21,r25,tr0// result in r0GLOBAL(sdivsi3):// can create absolute value without extra latency,// but dependent on proper sign extension of inputs:// shari.l r5,31,r2// xor r5,r2,r20// sub r20,r2,r20 // r20 is now absolute value of r5, zero-extended.shari.l r5,31,r2ori r2,1,r2muls.l r5,r2,r20 // r20 is now absolute value of r5, zero-extended.movi 0xffffffffffffbb0c,r19 // shift count eqiv 76shari.l r4,31,r3nsb r20,r0shlld r20,r0,r25shlri r25,48,r25sub r19,r25,r1mmulfx.w r1,r1,r2mshflo.w r1,r63,r1// If r4 was to be used in-place instead of r21, could use this sequence// to compute absolute:// sub r63,r4,r19 // compute absolute value of r4// shlri r4,32,r3 // into lower 32 bit of r4, keeping// mcmv r19,r3,r4 // the sign in the upper 32 bits intact.ori r3,1,r3mmulfx.w r25,r2,r2sub r19,r0,r0muls.l r4,r3,r21msub.w r1,r2,r2addi r2,-2,r1mulu.l r21,r1,r19mmulfx.w r2,r2,r2shlli r1,15,r1shlrd r19,r0,r19mulu.l r19,r20,r3mmacnfx.wl r25,r2,r1ptabs r18,tr0sub r21,r3,r25mulu.l r25,r1,r2addi r0,14,r0xor r4,r5,r18shlrd r2,r0,r2mulu.l r2,r20,r3add r19,r2,r19shari.l r18,31,r18sub r25,r3,r25mulu.l r25,r1,r2sub r25,r20,r25add r19,r18,r19shlrd r2,r0,r2mulu.l r2,r20,r3addi r25,1,r25add r19,r2,r19cmpgt r25,r3,r25add.l r19,r25,r0xor r0,r18,r0blink tr0,r63#else /* ! 0 && ! 0 */// inputs: r4,r5// clobbered: r1,r18,r19,r20,r21,r25,tr0// result in r0HIDDEN_FUNC(GLOBAL(sdivsi3_2))#ifndef __pic__FUNC(GLOBAL(sdivsi3))GLOBAL(sdivsi3): /* this is the shcompact entry point */// The special SHmedia entry point sdivsi3_1 prevents accidental linking// with the SHcompact implementation, which clobbers tr1 / tr2..global GLOBAL(sdivsi3_1)GLOBAL(sdivsi3_1):.global GLOBAL(div_table_internal)movi (GLOBAL(div_table_internal) >> 16) & 65535, r20shori GLOBAL(div_table_internal) & 65535, r20#endif.global GLOBAL(sdivsi3_2)// div_table in r20// clobbered: r1,r18,r19,r21,r25,tr0GLOBAL(sdivsi3_2):nsb r5, r1shlld r5, r1, r25 // normalize; [-2 ..1, 1..2) in s2.62shari r25, 58, r21 // extract 5(6) bit index (s2.4 with hole -1..1)ldx.ub r20, r21, r19 // u0.8shari r25, 32, r25 // normalize to s2.30shlli r21, 1, r21muls.l r25, r19, r19 // s2.38ldx.w r20, r21, r21 // s2.14ptabs r18, tr0shari r19, 24, r19 // truncate to s2.14sub r21, r19, r19 // some 11 bit inverse in s1.14muls.l r19, r19, r21 // u0.28sub r63, r1, r1addi r1, 92, r1muls.l r25, r21, r18 // s2.58shlli r19, 45, r19 // multiply by two and convert to s2.58/* bubble */sub r19, r18, r18shari r18, 28, r18 // some 22 bit inverse in s1.30muls.l r18, r25, r0 // s2.60muls.l r18, r4, r25 // s32.30/* bubble */shari r0, 16, r19 // s-16.44muls.l r19, r18, r19 // s-16.74shari r25, 63, r0shari r4, 14, r18 // s19.-14shari r19, 30, r19 // s-16.44muls.l r19, r18, r19 // s15.30xor r21, r0, r21 // You could also use the constant 1 << 27.add r21, r25, r21sub r21, r19, r21shard r21, r1, r21sub r21, r0, r0blink tr0, r63#ifndef __pic__ENDFUNC(GLOBAL(sdivsi3))#endifENDFUNC(GLOBAL(sdivsi3_2))#endif#elif defined __SHMEDIA__/* m5compact-nofpu */// clobbered: r18,r19,r20,r21,r25,tr0,tr1,tr2.mode SHmedia.section .text..SHmedia32,"ax".align 2FUNC(GLOBAL(sdivsi3))GLOBAL(sdivsi3):pt/l LOCAL(sdivsi3_dontsub), tr0pt/l LOCAL(sdivsi3_loop), tr1ptabs/l r18,tr2shari.l r4,31,r18shari.l r5,31,r19xor r4,r18,r20xor r5,r19,r21sub.l r20,r18,r20sub.l r21,r19,r21xor r18,r19,r19shlli r21,32,r25addi r25,-1,r21addz.l r20,r63,r20LOCAL(sdivsi3_loop):shlli r20,1,r20bgeu/u r21,r20,tr0sub r20,r21,r20LOCAL(sdivsi3_dontsub):addi.l r25,-1,r25bnei r25,-32,tr1xor r20,r19,r20sub.l r20,r19,r0blink tr2,r63ENDFUNC(GLOBAL(sdivsi3))#else /* ! __SHMEDIA__ */FUNC(GLOBAL(sdivsi3))GLOBAL(sdivsi3):mov r4,r1mov r5,r0tst r0,r0bt div0mov #0,r2div0s r2,r1subc r3,r3subc r2,r1div0s r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1div1 r0,r3rotcl r1addc r2,r1rtsmov r1,r0div0: rtsmov #0,r0ENDFUNC(GLOBAL(sdivsi3))#endif /* ! __SHMEDIA__ */#endif /* ! __SH4__ */#endif#ifdef L_udivsi3_i4.title "SH DIVIDE"!! 4 byte integer Divide code for the Renesas SH#ifdef __SH4__!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4,!! and t bit.global GLOBAL(udivsi3_i4)HIDDEN_FUNC(GLOBAL(udivsi3_i4))GLOBAL(udivsi3_i4):mov #1,r1cmp/hi r1,r5bf trivialrotr r1xor r1,r4lds r4,fpulmova L1,r0#ifdef FMOVD_WORKSfmov.d @r0+,dr4#elsefmov.s @r0+,DR40fmov.s @r0,DR41#endiffloat fpul,dr0xor r1,r5lds r5,fpulfloat fpul,dr2fadd dr4,dr0fadd dr4,dr2fdiv dr2,dr0rtsftrc dr0,fpultrivial:rtslds r4,fpul.align 2#ifdef FMOVD_WORKS.align 3 ! make double below 8 byte aligned.#endifL1:.double 2147483648ENDFUNC(GLOBAL(udivsi3_i4))#elif defined (__SH5__) && ! defined (__SH4_NOFPU__)#if ! __SH5__ || __SH5__ == 32!! args in r4 and r5, result in fpul, clobber r20, r21, dr0, fr33.mode SHmedia.global GLOBAL(udivsi3_i4)HIDDEN_FUNC(GLOBAL(udivsi3_i4))GLOBAL(udivsi3_i4):addz.l r4,r63,r20addz.l r5,r63,r21fmov.qd r20,dr0fmov.qd r21,dr32ptabs r18,tr0float.qd dr0,dr0float.qd dr32,dr32fdiv.d dr0,dr32,dr0ftrc.dq dr0,dr32fmov.s fr33,fr32blink tr0,r63ENDFUNC(GLOBAL(udivsi3_i4))#endif /* ! __SH5__ || __SH5__ == 32 */#elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__)!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4.global GLOBAL(udivsi3_i4)HIDDEN_FUNC(GLOBAL(udivsi3_i4))GLOBAL(udivsi3_i4):mov #1,r1cmp/hi r1,r5bf trivialsts.l fpscr,@-r15mova L1,r0lds.l @r0+,fpscrrotr r1xor r1,r4lds r4,fpul#ifdef FMOVD_WORKSfmov.d @r0+,dr4#elsefmov.s @r0+,DR40fmov.s @r0,DR41#endiffloat fpul,dr0xor r1,r5lds r5,fpulfloat fpul,dr2fadd dr4,dr0fadd dr4,dr2fdiv dr2,dr0ftrc dr0,fpulrtslds.l @r15+,fpscr#ifdef FMOVD_WORKS.align 3 ! make double below 8 byte aligned.#endiftrivial:rtslds r4,fpul.align 2L1:#ifndef FMOVD_WORKS.long 0x80000#else.long 0x180000#endif.double 2147483648ENDFUNC(GLOBAL(udivsi3_i4))#endif /* ! __SH4__ */#endif#ifdef L_udivsi3/* __SH4_SINGLE_ONLY__ keeps this part for link compatibility withsh2e/sh3e code. */#if (! defined(__SH4__) && ! defined (__SH4_SINGLE__)) || defined (__linux__)!! args in r4 and r5, result in r0, clobbers r4, pr, and t bit.global GLOBAL(udivsi3)HIDDEN_FUNC(GLOBAL(udivsi3))#if __SHMEDIA__#if __SH5__ == 32.section .text..SHmedia32,"ax"#else.text#endif.align 2#if 0/* The assembly code that follows is a hand-optimized version of the Ccode that follows. Note that the registers that are modified areexactly those listed as clobbered in the patterns udivsi3_i1 andudivsi3_i1_media.unsigned__udivsi3 (i, j)unsigned i, j;{register unsigned long long r0 asm ("r0") = 0;register unsigned long long r18 asm ("r18") = 1;register unsigned long long r4 asm ("r4") = i;register unsigned long long r19 asm ("r19") = j;r19 <<= 31;r18 <<= 31;doif (r4 >= r19)r0 |= r18, r4 -= r19;while (r19 >>= 1, r18 >>= 1);return r0;}*/GLOBAL(udivsi3):pt/l LOCAL(udivsi3_dontadd), tr2pt/l LOCAL(udivsi3_loop), tr1ptabs/l r18, tr0movi 0, r0movi 1, r18addz.l r5, r63, r19addz.l r4, r63, r4shlli r19, 31, r19shlli r18, 31, r18LOCAL(udivsi3_loop):bgtu r19, r4, tr2or r0, r18, r0sub r4, r19, r4LOCAL(udivsi3_dontadd):shlri r18, 1, r18shlri r19, 1, r19bnei r18, 0, tr1blink tr0, r63#elseGLOBAL(udivsi3):// inputs: r4,r5// clobbered: r18,r19,r20,r21,r22,r25,tr0// result in r0.addz.l r5,r63,r22nsb r22,r0shlld r22,r0,r25shlri r25,48,r25movi 0xffffffffffffbb0c,r20 // shift count eqiv 76sub r20,r25,r21mmulfx.w r21,r21,r19mshflo.w r21,r63,r21ptabs r18,tr0mmulfx.w r25,r19,r19sub r20,r0,r0/* bubble */msub.w r21,r19,r19addi r19,-2,r21 /* It would be nice for scheduling to do this add to r21before the msub.w, but we need a different value forr19 to keep errors under control. */mulu.l r4,r21,r18mmulfx.w r19,r19,r19shlli r21,15,r21shlrd r18,r0,r18mulu.l r18,r22,r20mmacnfx.wl r25,r19,r21/* bubble */sub r4,r20,r25mulu.l r25,r21,r19addi r0,14,r0/* bubble */shlrd r19,r0,r19mulu.l r19,r22,r20add r18,r19,r18/* bubble */sub.l r25,r20,r25mulu.l r25,r21,r19addz.l r25,r63,r25sub r25,r22,r25shlrd r19,r0,r19mulu.l r19,r22,r20addi r25,1,r25add r18,r19,r18cmpgt r25,r20,r25add.l r18,r25,r0blink tr0,r63#endif#elif defined (__SHMEDIA__)/* m5compact-nofpu - more emphasis on code size than on speed, but don'tignore speed altogether - div1 needs 9 cycles, subc 7 and rotcl 4.So use a short shmedia loop. */// clobbered: r20,r21,r25,tr0,tr1,tr2.mode SHmedia.section .text..SHmedia32,"ax".align 2GLOBAL(udivsi3):pt/l LOCAL(udivsi3_dontsub), tr0pt/l LOCAL(udivsi3_loop), tr1ptabs/l r18,tr2shlli r5,32,r25addi r25,-1,r21addz.l r4,r63,r20LOCAL(udivsi3_loop):shlli r20,1,r20bgeu/u r21,r20,tr0sub r20,r21,r20LOCAL(udivsi3_dontsub):addi.l r25,-1,r25bnei r25,-32,tr1add.l r20,r63,r0blink tr2,r63#else /* ! defined (__SHMEDIA__) */LOCAL(div8):div1 r5,r4LOCAL(div7):div1 r5,r4; div1 r5,r4; div1 r5,r4div1 r5,r4; div1 r5,r4; div1 r5,r4; rts; div1 r5,r4LOCAL(divx4):div1 r5,r4; rotcl r0div1 r5,r4; rotcl r0div1 r5,r4; rotcl r0rts; div1 r5,r4GLOBAL(udivsi3):sts.l pr,@-r15extu.w r5,r0cmp/eq r5,r0#ifdef __sh1__bf LOCAL(large_divisor)#elsebf/s LOCAL(large_divisor)#endifdiv0uswap.w r4,r0shlr16 r4bsr LOCAL(div8)shll16 r5bsr LOCAL(div7)div1 r5,r4xtrct r4,r0xtrct r0,r4bsr LOCAL(div8)swap.w r4,r4bsr LOCAL(div7)div1 r5,r4lds.l @r15+,prxtrct r4,r0swap.w r0,r0rotcl r0rtsshlr16 r5LOCAL(large_divisor):#ifdef __sh1__div0u#endifmov #0,r0xtrct r4,r0xtrct r0,r4bsr LOCAL(divx4)rotcl r0bsr LOCAL(divx4)rotcl r0bsr LOCAL(divx4)rotcl r0bsr LOCAL(divx4)rotcl r0lds.l @r15+,prrtsrotcl r0ENDFUNC(GLOBAL(udivsi3))#endif /* ! __SHMEDIA__ */#endif /* __SH4__ */#endif /* L_udivsi3 */#ifdef L_udivdi3#ifdef __SHMEDIA__.mode SHmedia.section .text..SHmedia32,"ax".align 2.global GLOBAL(udivdi3)FUNC(GLOBAL(udivdi3))GLOBAL(udivdi3):HIDDEN_ALIAS(udivdi3_internal,udivdi3)shlri r3,1,r4nsb r4,r22shlld r3,r22,r6shlri r6,49,r5movi 0xffffffffffffbaf1,r21 /* .l shift count 17. */sub r21,r5,r1mmulfx.w r1,r1,r4mshflo.w r1,r63,r1sub r63,r22,r20 // r63 == 64 % 64mmulfx.w r5,r4,r4pta LOCAL(large_divisor),tr0addi r20,32,r9msub.w r1,r4,r1madd.w r1,r1,r1mmulfx.w r1,r1,r4shlri r6,32,r7bgt/u r9,r63,tr0 // large_divisormmulfx.w r5,r4,r4shlri r2,32+14,r19addi r22,-31,r0msub.w r1,r4,r1mulu.l r1,r7,r4addi r1,-3,r5mulu.l r5,r19,r5sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, asthe case may be, %0000000000000000 000.11111111111, still */muls.l r1,r4,r4 /* leaving at least one sign bit. */mulu.l r5,r3,r8mshalds.l r1,r21,r1shari r4,26,r4shlld r8,r0,r8add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)sub r2,r8,r2/* Can do second step of 64 : 32 div now, using r1 and the rest in r2. */shlri r2,22,r21mulu.l r21,r1,r21shlld r5,r0,r8addi r20,30-22,r0shlrd r21,r0,r21mulu.l r21,r3,r5add r8,r21,r8mcmpgt.l r21,r63,r21 // See Note 1addi r20,30,r0mshfhi.l r63,r21,r21sub r2,r5,r2andc r2,r21,r2/* small divisor: need a third divide step */mulu.l r2,r1,r7ptabs r18,tr0addi r2,1,r2shlrd r7,r0,r7mulu.l r7,r3,r5add r8,r7,r8sub r2,r3,r2cmpgt r2,r5,r5add r8,r5,r2/* could test r3 here to check for divide by zero. */blink tr0,r63LOCAL(large_divisor):mmulfx.w r5,r4,r4shlrd r2,r9,r25shlri r25,32,r8msub.w r1,r4,r1mulu.l r1,r7,r4addi r1,-3,r5mulu.l r5,r8,r5sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, asthe case may be, %0000000000000000 000.11111111111, still */muls.l r1,r4,r4 /* leaving at least one sign bit. */shlri r5,14-1,r8mulu.l r8,r7,r5mshalds.l r1,r21,r1shari r4,26,r4add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)sub r25,r5,r25/* Can do second step of 64 : 32 div now, using r1 and the rest in r25. */shlri r25,22,r21mulu.l r21,r1,r21pta LOCAL(no_lo_adj),tr0addi r22,32,r0shlri r21,40,r21mulu.l r21,r7,r5add r8,r21,r8shlld r2,r0,r2sub r25,r5,r25bgtu/u r7,r25,tr0 // no_lo_adjaddi r8,1,r8sub r25,r7,r25LOCAL(no_lo_adj):mextr4 r2,r25,r2/* large_divisor: only needs a few adjustments. */mulu.l r8,r6,r5ptabs r18,tr0/* bubble */cmpgtu r5,r2,r5sub r8,r5,r2blink tr0,r63ENDFUNC(GLOBAL(udivdi3))/* Note 1: To shift the result of the second divide stage so that the resultalways fits into 32 bits, yet we still reduce the rest sufficientlywould require a lot of instructions to do the shifts just right. Usingthe full 64 bit shift result to multiply with the divisor would requirefour extra instructions for the upper 32 bits (shift / mulu / shift / sub).Fortunately, if the upper 32 bits of the shift result are nonzero, weknow that the rest after taking this partial result into account willfit into 32 bits. So we just clear the upper 32 bits of the rest if theupper 32 bits of the partial result are nonzero. */#endif /* __SHMEDIA__ */#endif /* L_udivdi3 */#ifdef L_divdi3#ifdef __SHMEDIA__.mode SHmedia.section .text..SHmedia32,"ax".align 2.global GLOBAL(divdi3)FUNC(GLOBAL(divdi3))GLOBAL(divdi3):pta GLOBAL(udivdi3_internal),tr0shari r2,63,r22shari r3,63,r23xor r2,r22,r2xor r3,r23,r3sub r2,r22,r2sub r3,r23,r3beq/u r22,r23,tr0ptabs r18,tr1blink tr0,r18sub r63,r2,r2blink tr1,r63ENDFUNC(GLOBAL(divdi3))#endif /* __SHMEDIA__ */#endif /* L_divdi3 */#ifdef L_umoddi3#ifdef __SHMEDIA__.mode SHmedia.section .text..SHmedia32,"ax".align 2.global GLOBAL(umoddi3)FUNC(GLOBAL(umoddi3))GLOBAL(umoddi3):HIDDEN_ALIAS(umoddi3_internal,umoddi3)shlri r3,1,r4nsb r4,r22shlld r3,r22,r6shlri r6,49,r5movi 0xffffffffffffbaf1,r21 /* .l shift count 17. */sub r21,r5,r1mmulfx.w r1,r1,r4mshflo.w r1,r63,r1sub r63,r22,r20 // r63 == 64 % 64mmulfx.w r5,r4,r4pta LOCAL(large_divisor),tr0addi r20,32,r9msub.w r1,r4,r1madd.w r1,r1,r1mmulfx.w r1,r1,r4shlri r6,32,r7bgt/u r9,r63,tr0 // large_divisormmulfx.w r5,r4,r4shlri r2,32+14,r19addi r22,-31,r0msub.w r1,r4,r1mulu.l r1,r7,r4addi r1,-3,r5mulu.l r5,r19,r5sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, asthe case may be, %0000000000000000 000.11111111111, still */muls.l r1,r4,r4 /* leaving at least one sign bit. */mulu.l r5,r3,r5mshalds.l r1,r21,r1shari r4,26,r4shlld r5,r0,r5add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)sub r2,r5,r2/* Can do second step of 64 : 32 div now, using r1 and the rest in r2. */shlri r2,22,r21mulu.l r21,r1,r21addi r20,30-22,r0/* bubble */ /* could test r3 here to check for divide by zero. */shlrd r21,r0,r21mulu.l r21,r3,r5mcmpgt.l r21,r63,r21 // See Note 1addi r20,30,r0mshfhi.l r63,r21,r21sub r2,r5,r2andc r2,r21,r2/* small divisor: need a third divide step */mulu.l r2,r1,r7ptabs r18,tr0sub r2,r3,r8 /* re-use r8 here for rest - r3 */shlrd r7,r0,r7mulu.l r7,r3,r5/* bubble */addi r8,1,r7cmpgt r7,r5,r7cmvne r7,r8,r2sub r2,r5,r2blink tr0,r63LOCAL(large_divisor):mmulfx.w r5,r4,r4shlrd r2,r9,r25shlri r25,32,r8msub.w r1,r4,r1mulu.l r1,r7,r4addi r1,-3,r5mulu.l r5,r8,r5sub r63,r4,r4 // Negate to make sure r1 ends up <= 1/r2shlri r4,2,r4 /* chop off leading %0000000000000000 001.00000000000 - or, asthe case may be, %0000000000000000 000.11111111111, still */muls.l r1,r4,r4 /* leaving at least one sign bit. */shlri r5,14-1,r8mulu.l r8,r7,r5mshalds.l r1,r21,r1shari r4,26,r4add r1,r4,r1 // 31 bit unsigned reciprocal now in r1 (msb equiv. 0.5)sub r25,r5,r25/* Can do second step of 64 : 32 div now, using r1 and the rest in r25. */shlri r25,22,r21mulu.l r21,r1,r21pta LOCAL(no_lo_adj),tr0addi r22,32,r0shlri r21,40,r21mulu.l r21,r7,r5add r8,r21,r8shlld r2,r0,r2sub r25,r5,r25bgtu/u r7,r25,tr0 // no_lo_adjaddi r8,1,r8sub r25,r7,r25LOCAL(no_lo_adj):mextr4 r2,r25,r2/* large_divisor: only needs a few adjustments. */mulu.l r8,r6,r5ptabs r18,tr0add r2,r6,r7cmpgtu r5,r2,r8cmvne r8,r7,r2sub r2,r5,r2shlrd r2,r22,r2blink tr0,r63ENDFUNC(GLOBAL(umoddi3))/* Note 1: To shift the result of the second divide stage so that the resultalways fits into 32 bits, yet we still reduce the rest sufficientlywould require a lot of instructions to do the shifts just right. Usingthe full 64 bit shift result to multiply with the divisor would requirefour extra instructions for the upper 32 bits (shift / mulu / shift / sub).Fortunately, if the upper 32 bits of the shift result are nonzero, weknow that the rest after taking this partial result into account willfit into 32 bits. So we just clear the upper 32 bits of the rest if theupper 32 bits of the partial result are nonzero. */#endif /* __SHMEDIA__ */#endif /* L_umoddi3 */#ifdef L_moddi3#ifdef __SHMEDIA__.mode SHmedia.section .text..SHmedia32,"ax".align 2.global GLOBAL(moddi3)FUNC(GLOBAL(moddi3))GLOBAL(moddi3):pta GLOBAL(umoddi3_internal),tr0shari r2,63,r22shari r3,63,r23xor r2,r22,r2xor r3,r23,r3sub r2,r22,r2sub r3,r23,r3beq/u r22,r63,tr0ptabs r18,tr1blink tr0,r18sub r63,r2,r2blink tr1,r63ENDFUNC(GLOBAL(moddi3))#endif /* __SHMEDIA__ */#endif /* L_moddi3 */#ifdef L_set_fpscr#if !defined (__SH2A_NOFPU__)#if defined (__SH2E__) || defined (__SH2A__) || defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || __SH5__ == 32#ifdef __SH5__.mode SHcompact#endif.global GLOBAL(set_fpscr)HIDDEN_FUNC(GLOBAL(set_fpscr))GLOBAL(set_fpscr):lds r4,fpscr#ifdef __PIC__mov.l r12,@-r15#ifdef __vxworksmov.l LOCAL(set_fpscr_L0_base),r12mov.l LOCAL(set_fpscr_L0_index),r0mov.l @r12,r12mov.l @(r0,r12),r12#elsemova LOCAL(set_fpscr_L0),r0mov.l LOCAL(set_fpscr_L0),r12add r0,r12#endifmov.l LOCAL(set_fpscr_L1),r0mov.l @(r0,r12),r1mov.l @r15+,r12#elsemov.l LOCAL(set_fpscr_L1),r1#endifswap.w r4,r0or #24,r0#ifndef FMOVD_WORKSxor #16,r0#endif#if defined(__SH4__) || defined (__SH2A_DOUBLE__)swap.w r0,r3mov.l r3,@(4,r1)#else /* defined (__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE*__) */swap.w r0,r2mov.l r2,@r1#endif#ifndef FMOVD_WORKSxor #8,r0#elsexor #24,r0#endif#if defined(__SH4__) || defined (__SH2A_DOUBLE__)swap.w r0,r2rtsmov.l r2,@r1#else /* defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE*__) */swap.w r0,r3rtsmov.l r3,@(4,r1)#endif.align 2#ifdef __PIC__#ifdef __vxworksLOCAL(set_fpscr_L0_base):.long ___GOTT_BASE__LOCAL(set_fpscr_L0_index):.long ___GOTT_INDEX__#elseLOCAL(set_fpscr_L0):.long _GLOBAL_OFFSET_TABLE_#endifLOCAL(set_fpscr_L1):.long GLOBAL(fpscr_values@GOT)#elseLOCAL(set_fpscr_L1):.long GLOBAL(fpscr_values)#endifENDFUNC(GLOBAL(set_fpscr))#ifndef NO_FPSCR_VALUES#ifdef __ELF__.comm GLOBAL(fpscr_values),8,4#else.comm GLOBAL(fpscr_values),8#endif /* ELF */#endif /* NO_FPSCR_VALUES */#endif /* SH2E / SH3E / SH4 */#endif /* __SH2A_NOFPU__ */#endif /* L_set_fpscr */#ifdef L_ic_invalidate#if __SH5__ == 32.mode SHmedia.section .text..SHmedia32,"ax".align 2.global GLOBAL(init_trampoline)HIDDEN_FUNC(GLOBAL(init_trampoline))GLOBAL(init_trampoline):st.l r0,8,r2#ifdef __LITTLE_ENDIAN__movi 9,r20shori 0x402b,r20shori 0xd101,r20shori 0xd002,r20#elsemovi 0xffffffffffffd002,r20shori 0xd101,r20shori 0x402b,r20shori 9,r20#endifst.q r0,0,r20st.l r0,12,r3ENDFUNC(GLOBAL(init_trampoline)).global GLOBAL(ic_invalidate)HIDDEN_FUNC(GLOBAL(ic_invalidate))GLOBAL(ic_invalidate):ocbwb r0,0syncoicbi r0, 0ptabs r18, tr0synciblink tr0, r63ENDFUNC(GLOBAL(ic_invalidate))#elif defined(__SH4A__).global GLOBAL(ic_invalidate)HIDDEN_FUNC(GLOBAL(ic_invalidate))GLOBAL(ic_invalidate):ocbwb @r4syncoicbi @r4rtsnopENDFUNC(GLOBAL(ic_invalidate))#elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || (defined(__SH4_NOFPU__) && !defined(__SH5__))/* For system code, we use ic_invalidate_line_i, but user codeneeds a different mechanism. A kernel call is generally notavailable, and it would also be slow. Different SH4 variants usedifferent sizes and associativities of the Icache. We use a smallbit of dispatch code that can be put hidden in every shared object,which calls the actual processor-specific invalidation code in aseparate module.Or if you have operating system support, the OS could mmap theprocesor-specific code from a single page, since it is highlyrepetitive. */.global GLOBAL(ic_invalidate)HIDDEN_FUNC(GLOBAL(ic_invalidate))GLOBAL(ic_invalidate):#ifdef __pic__#ifdef __vxworksmov.l 1f,r1mov.l 2f,r0mov.l @r1,r1mov.l 0f,r2mov.l @(r0,r1),r0#elsemov.l 1f,r1mova 1f,r0mov.l 0f,r2add r1,r0#endifmov.l @(r0,r2),r1#elsemov.l 0f,r1#endifocbwb @r4mov.l @(8,r1),r0sub r1,r4and r4,r0add r1,r0jmp @r0mov.l @(4,r1),r0.align 2#ifndef __pic__0: .long GLOBAL(ic_invalidate_array)#else /* __pic__ */.global GLOBAL(ic_invalidate_array)0: .long GLOBAL(ic_invalidate_array)@GOT#ifdef __vxworks1: .long ___GOTT_BASE__2: .long ___GOTT_INDEX__#else1: .long _GLOBAL_OFFSET_TABLE_#endifENDFUNC(GLOBAL(ic_invalidate))#endif /* __pic__ */#endif /* SH4 */#endif /* L_ic_invalidate */#ifdef L_ic_invalidate_array#if defined(__SH4A__) || (defined (__FORCE_SH4A__) && (defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || (defined(__SH4_NOFPU__) && !defined(__SH5__)))).global GLOBAL(ic_invalidate_array)/* This is needed when an SH4 dso with trampolines is used on SH4A. */.global GLOBAL(ic_invalidate_array)FUNC(GLOBAL(ic_invalidate_array))GLOBAL(ic_invalidate_array):add r1,r4syncoicbi @r4rtsnop.align 2.long 0ENDFUNC(GLOBAL(ic_invalidate_array))#elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || (defined(__SH4_NOFPU__) && !defined(__SH5__)).global GLOBAL(ic_invalidate_array).p2align 5FUNC(GLOBAL(ic_invalidate_array))/* This must be aligned to the beginning of a cache line. */GLOBAL(ic_invalidate_array):#ifndef WAYS#define WAYS 4#define WAY_SIZE 0x4000#endif#if WAYS == 1.rept WAY_SIZE * WAYS / 32rtsnop.rept 7.long WAY_SIZE - 32.endr.endr#elif WAYS <= 6.rept WAY_SIZE * WAYS / 32braf r0add #-8,r0.long WAY_SIZE + 8.long WAY_SIZE - 32.rept WAYS-2braf r0nop.endr.rept 7 - WAYSrtsnop.endr.endr#else /* WAYS > 6 *//* This variant needs two different pages for mmap-ing. */.rept WAYS-1.rept WAY_SIZE / 32braf r0nop.long WAY_SIZE.rept 6.long WAY_SIZE - 32.endr.endr.endr.rept WAY_SIZE / 32rts.rept 15nop.endr.endr#endif /* WAYS */ENDFUNC(GLOBAL(ic_invalidate_array))#endif /* SH4 */#endif /* L_ic_invalidate_array */#if defined (__SH5__) && __SH5__ == 32#ifdef L_shcompact_call_trampoline.section .rodata.align 1LOCAL(ct_main_table):.word LOCAL(ct_r2_fp) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r2_ld) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r2_pop) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r3_fp) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r3_ld) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r3_pop) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r4_fp) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r4_ld) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r4_pop) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r5_fp) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r5_ld) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r5_pop) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r6_fph) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r6_fpl) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r6_ld) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r6_pop) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r7_fph) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r7_fpl) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r7_ld) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r7_pop) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r8_fph) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r8_fpl) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r8_ld) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r8_pop) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r9_fph) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r9_fpl) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r9_ld) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r9_pop) - datalabel LOCAL(ct_main_label).word LOCAL(ct_pop_seq) - datalabel LOCAL(ct_main_label).word LOCAL(ct_pop_seq) - datalabel LOCAL(ct_main_label).word LOCAL(ct_r9_pop) - datalabel LOCAL(ct_main_label).word LOCAL(ct_ret_wide) - datalabel LOCAL(ct_main_label).word LOCAL(ct_call_func) - datalabel LOCAL(ct_main_label).mode SHmedia.section .text..SHmedia32, "ax".align 2/* This function loads 64-bit general-purpose registers from thestack, from a memory address contained in them or from an FPregister, according to a cookie passed in r1. Its executiontime is linear on the number of registers that actually haveto be copied. See sh.h for details on the actual bit pattern.The function to be called is passed in r0. If a 32-bit returnvalue is expected, the actual function will be tail-called,otherwise the return address will be stored in r10 (that thecaller should expect to be clobbered) and the return valuewill be expanded into r2/r3 upon return. */.global GLOBAL(GCC_shcompact_call_trampoline)FUNC(GLOBAL(GCC_shcompact_call_trampoline))GLOBAL(GCC_shcompact_call_trampoline):ptabs/l r0, tr0 /* Prepare to call the actual function. */movi ((datalabel LOCAL(ct_main_table) - 31 * 2) >> 16) & 65535, r0pt/l LOCAL(ct_loop), tr1addz.l r1, r63, r1shori ((datalabel LOCAL(ct_main_table) - 31 * 2)) & 65535, r0LOCAL(ct_loop):nsb r1, r28shlli r28, 1, r29ldx.w r0, r29, r30LOCAL(ct_main_label):ptrel/l r30, tr2blink tr2, r63LOCAL(ct_r2_fp): /* Copy r2 from an FP register. *//* It must be dr0, so just do it. */fmov.dq dr0, r2movi 7, r30shlli r30, 29, r31andc r1, r31, r1blink tr1, r63LOCAL(ct_r3_fp): /* Copy r3 from an FP register. *//* It is either dr0 or dr2. */movi 7, r30shlri r1, 26, r32shlli r30, 26, r31andc r1, r31, r1fmov.dq dr0, r3beqi/l r32, 4, tr1fmov.dq dr2, r3blink tr1, r63LOCAL(ct_r4_fp): /* Copy r4 from an FP register. */shlri r1, 23 - 3, r34andi r34, 3 << 3, r33addi r33, LOCAL(ct_r4_fp_copy) - datalabel LOCAL(ct_r4_fp_base), r32LOCAL(ct_r4_fp_base):ptrel/l r32, tr2movi 7, r30shlli r30, 23, r31andc r1, r31, r1blink tr2, r63LOCAL(ct_r4_fp_copy):fmov.dq dr0, r4blink tr1, r63fmov.dq dr2, r4blink tr1, r63fmov.dq dr4, r4blink tr1, r63LOCAL(ct_r5_fp): /* Copy r5 from an FP register. */shlri r1, 20 - 3, r34andi r34, 3 << 3, r33addi r33, LOCAL(ct_r5_fp_copy) - datalabel LOCAL(ct_r5_fp_base), r32LOCAL(ct_r5_fp_base):ptrel/l r32, tr2movi 7, r30shlli r30, 20, r31andc r1, r31, r1blink tr2, r63LOCAL(ct_r5_fp_copy):fmov.dq dr0, r5blink tr1, r63fmov.dq dr2, r5blink tr1, r63fmov.dq dr4, r5blink tr1, r63fmov.dq dr6, r5blink tr1, r63LOCAL(ct_r6_fph): /* Copy r6 from a high FP register. *//* It must be dr8. */fmov.dq dr8, r6movi 15, r30shlli r30, 16, r31andc r1, r31, r1blink tr1, r63LOCAL(ct_r6_fpl): /* Copy r6 from a low FP register. */shlri r1, 16 - 3, r34andi r34, 3 << 3, r33addi r33, LOCAL(ct_r6_fp_copy) - datalabel LOCAL(ct_r6_fp_base), r32LOCAL(ct_r6_fp_base):ptrel/l r32, tr2movi 7, r30shlli r30, 16, r31andc r1, r31, r1blink tr2, r63LOCAL(ct_r6_fp_copy):fmov.dq dr0, r6blink tr1, r63fmov.dq dr2, r6blink tr1, r63fmov.dq dr4, r6blink tr1, r63fmov.dq dr6, r6blink tr1, r63LOCAL(ct_r7_fph): /* Copy r7 from a high FP register. *//* It is either dr8 or dr10. */movi 15 << 12, r31shlri r1, 12, r32andc r1, r31, r1fmov.dq dr8, r7beqi/l r32, 8, tr1fmov.dq dr10, r7blink tr1, r63LOCAL(ct_r7_fpl): /* Copy r7 from a low FP register. */shlri r1, 12 - 3, r34andi r34, 3 << 3, r33addi r33, LOCAL(ct_r7_fp_copy) - datalabel LOCAL(ct_r7_fp_base), r32LOCAL(ct_r7_fp_base):ptrel/l r32, tr2movi 7 << 12, r31andc r1, r31, r1blink tr2, r63LOCAL(ct_r7_fp_copy):fmov.dq dr0, r7blink tr1, r63fmov.dq dr2, r7blink tr1, r63fmov.dq dr4, r7blink tr1, r63fmov.dq dr6, r7blink tr1, r63LOCAL(ct_r8_fph): /* Copy r8 from a high FP register. *//* It is either dr8 or dr10. */movi 15 << 8, r31andi r1, 1 << 8, r32andc r1, r31, r1fmov.dq dr8, r8beq/l r32, r63, tr1fmov.dq dr10, r8blink tr1, r63LOCAL(ct_r8_fpl): /* Copy r8 from a low FP register. */shlri r1, 8 - 3, r34andi r34, 3 << 3, r33addi r33, LOCAL(ct_r8_fp_copy) - datalabel LOCAL(ct_r8_fp_base), r32LOCAL(ct_r8_fp_base):ptrel/l r32, tr2movi 7 << 8, r31andc r1, r31, r1blink tr2, r63LOCAL(ct_r8_fp_copy):fmov.dq dr0, r8blink tr1, r63fmov.dq dr2, r8blink tr1, r63fmov.dq dr4, r8blink tr1, r63fmov.dq dr6, r8blink tr1, r63LOCAL(ct_r9_fph): /* Copy r9 from a high FP register. *//* It is either dr8 or dr10. */movi 15 << 4, r31andi r1, 1 << 4, r32andc r1, r31, r1fmov.dq dr8, r9beq/l r32, r63, tr1fmov.dq dr10, r9blink tr1, r63LOCAL(ct_r9_fpl): /* Copy r9 from a low FP register. */shlri r1, 4 - 3, r34andi r34, 3 << 3, r33addi r33, LOCAL(ct_r9_fp_copy) - datalabel LOCAL(ct_r9_fp_base), r32LOCAL(ct_r9_fp_base):ptrel/l r32, tr2movi 7 << 4, r31andc r1, r31, r1blink tr2, r63LOCAL(ct_r9_fp_copy):fmov.dq dr0, r9blink tr1, r63fmov.dq dr2, r9blink tr1, r63fmov.dq dr4, r9blink tr1, r63fmov.dq dr6, r9blink tr1, r63LOCAL(ct_r2_ld): /* Copy r2 from a memory address. */pt/l LOCAL(ct_r2_load), tr2movi 3, r30shlli r30, 29, r31and r1, r31, r32andc r1, r31, r1beq/l r31, r32, tr2addi.l r2, 8, r3ldx.q r2, r63, r2/* Fall through. */LOCAL(ct_r3_ld): /* Copy r3 from a memory address. */pt/l LOCAL(ct_r3_load), tr2movi 3, r30shlli r30, 26, r31and r1, r31, r32andc r1, r31, r1beq/l r31, r32, tr2addi.l r3, 8, r4ldx.q r3, r63, r3LOCAL(ct_r4_ld): /* Copy r4 from a memory address. */pt/l LOCAL(ct_r4_load), tr2movi 3, r30shlli r30, 23, r31and r1, r31, r32andc r1, r31, r1beq/l r31, r32, tr2addi.l r4, 8, r5ldx.q r4, r63, r4LOCAL(ct_r5_ld): /* Copy r5 from a memory address. */pt/l LOCAL(ct_r5_load), tr2movi 3, r30shlli r30, 20, r31and r1, r31, r32andc r1, r31, r1beq/l r31, r32, tr2addi.l r5, 8, r6ldx.q r5, r63, r5LOCAL(ct_r6_ld): /* Copy r6 from a memory address. */pt/l LOCAL(ct_r6_load), tr2movi 3 << 16, r31and r1, r31, r32andc r1, r31, r1beq/l r31, r32, tr2addi.l r6, 8, r7ldx.q r6, r63, r6LOCAL(ct_r7_ld): /* Copy r7 from a memory address. */pt/l LOCAL(ct_r7_load), tr2movi 3 << 12, r31and r1, r31, r32andc r1, r31, r1beq/l r31, r32, tr2addi.l r7, 8, r8ldx.q r7, r63, r7LOCAL(ct_r8_ld): /* Copy r8 from a memory address. */pt/l LOCAL(ct_r8_load), tr2movi 3 << 8, r31and r1, r31, r32andc r1, r31, r1beq/l r31, r32, tr2addi.l r8, 8, r9ldx.q r8, r63, r8LOCAL(ct_r9_ld): /* Copy r9 from a memory address. */pt/l LOCAL(ct_check_tramp), tr2ldx.q r9, r63, r9blink tr2, r63LOCAL(ct_r2_load):ldx.q r2, r63, r2blink tr1, r63LOCAL(ct_r3_load):ldx.q r3, r63, r3blink tr1, r63LOCAL(ct_r4_load):ldx.q r4, r63, r4blink tr1, r63LOCAL(ct_r5_load):ldx.q r5, r63, r5blink tr1, r63LOCAL(ct_r6_load):ldx.q r6, r63, r6blink tr1, r63LOCAL(ct_r7_load):ldx.q r7, r63, r7blink tr1, r63LOCAL(ct_r8_load):ldx.q r8, r63, r8blink tr1, r63LOCAL(ct_r2_pop): /* Pop r2 from the stack. */movi 1, r30ldx.q r15, r63, r2shlli r30, 29, r31addi.l r15, 8, r15andc r1, r31, r1blink tr1, r63LOCAL(ct_r3_pop): /* Pop r3 from the stack. */movi 1, r30ldx.q r15, r63, r3shlli r30, 26, r31addi.l r15, 8, r15andc r1, r31, r1blink tr1, r63LOCAL(ct_r4_pop): /* Pop r4 from the stack. */movi 1, r30ldx.q r15, r63, r4shlli r30, 23, r31addi.l r15, 8, r15andc r1, r31, r1blink tr1, r63LOCAL(ct_r5_pop): /* Pop r5 from the stack. */movi 1, r30ldx.q r15, r63, r5shlli r30, 20, r31addi.l r15, 8, r15andc r1, r31, r1blink tr1, r63LOCAL(ct_r6_pop): /* Pop r6 from the stack. */movi 1, r30ldx.q r15, r63, r6shlli r30, 16, r31addi.l r15, 8, r15andc r1, r31, r1blink tr1, r63LOCAL(ct_r7_pop): /* Pop r7 from the stack. */ldx.q r15, r63, r7movi 1 << 12, r31addi.l r15, 8, r15andc r1, r31, r1blink tr1, r63LOCAL(ct_r8_pop): /* Pop r8 from the stack. */ldx.q r15, r63, r8movi 1 << 8, r31addi.l r15, 8, r15andc r1, r31, r1blink tr1, r63LOCAL(ct_pop_seq): /* Pop a sequence of registers off the stack. */andi r1, 7 << 1, r30movi (LOCAL(ct_end_of_pop_seq) >> 16) & 65535, r32shlli r30, 2, r31shori LOCAL(ct_end_of_pop_seq) & 65535, r32sub.l r32, r31, r33ptabs/l r33, tr2blink tr2, r63LOCAL(ct_start_of_pop_seq): /* Beginning of pop sequence. */ldx.q r15, r63, r3addi.l r15, 8, r15ldx.q r15, r63, r4addi.l r15, 8, r15ldx.q r15, r63, r5addi.l r15, 8, r15ldx.q r15, r63, r6addi.l r15, 8, r15ldx.q r15, r63, r7addi.l r15, 8, r15ldx.q r15, r63, r8addi.l r15, 8, r15LOCAL(ct_r9_pop): /* Pop r9 from the stack. */ldx.q r15, r63, r9addi.l r15, 8, r15LOCAL(ct_end_of_pop_seq): /* Label used to compute first pop instruction. */LOCAL(ct_check_tramp): /* Check whether we need a trampoline. */pt/u LOCAL(ct_ret_wide), tr2andi r1, 1, r1bne/u r1, r63, tr2LOCAL(ct_call_func): /* Just branch to the function. */blink tr0, r63LOCAL(ct_ret_wide): /* Call the function, so that we can unpack its64-bit return value. */add.l r18, r63, r10blink tr0, r18ptabs r10, tr0#if __LITTLE_ENDIAN__shari r2, 32, r3add.l r2, r63, r2#elseadd.l r2, r63, r3shari r2, 32, r2#endifblink tr0, r63ENDFUNC(GLOBAL(GCC_shcompact_call_trampoline))#endif /* L_shcompact_call_trampoline */#ifdef L_shcompact_return_trampoline/* This function does the converse of the code in `ret_wide'above. It is tail-called by SHcompact functions returning64-bit non-floating-point values, to pack the 32-bit values inr2 and r3 into r2. */.mode SHmedia.section .text..SHmedia32, "ax".align 2.global GLOBAL(GCC_shcompact_return_trampoline)HIDDEN_FUNC(GLOBAL(GCC_shcompact_return_trampoline))GLOBAL(GCC_shcompact_return_trampoline):ptabs/l r18, tr0#if __LITTLE_ENDIAN__addz.l r2, r63, r2shlli r3, 32, r3#elseaddz.l r3, r63, r3shlli r2, 32, r2#endifor r3, r2, r2blink tr0, r63ENDFUNC(GLOBAL(GCC_shcompact_return_trampoline))#endif /* L_shcompact_return_trampoline */#ifdef L_shcompact_incoming_args.section .rodata.align 1LOCAL(ia_main_table):.word 1 /* Invalid, just loop */.word LOCAL(ia_r2_ld) - datalabel LOCAL(ia_main_label).word LOCAL(ia_r2_push) - datalabel LOCAL(ia_main_label).word 1 /* Invalid, just loop */.word LOCAL(ia_r3_ld) - datalabel LOCAL(ia_main_label).word LOCAL(ia_r3_push) - datalabel LOCAL(ia_main_label).word 1 /* Invalid, just loop */.word LOCAL(ia_r4_ld) - datalabel LOCAL(ia_main_label).word LOCAL(ia_r4_push) - datalabel LOCAL(ia_main_label).word 1 /* Invalid, just loop */.word LOCAL(ia_r5_ld) - datalabel LOCAL(ia_main_label).word LOCAL(ia_r5_push) - datalabel LOCAL(ia_main_label).word 1 /* Invalid, just loop */.word 1 /* Invalid, just loop */.word LOCAL(ia_r6_ld) - datalabel LOCAL(ia_main_label).word LOCAL(ia_r6_push) - datalabel LOCAL(ia_main_label).word 1 /* Invalid, just loop */.word 1 /* Invalid, just loop */.word LOCAL(ia_r7_ld) - datalabel LOCAL(ia_main_label).word LOCAL(ia_r7_push) - datalabel LOCAL(ia_main_label).word 1 /* Invalid, just loop */.word 1 /* Invalid, just loop */.word LOCAL(ia_r8_ld) - datalabel LOCAL(ia_main_label).word LOCAL(ia_r8_push) - datalabel LOCAL(ia_main_label).word 1 /* Invalid, just loop */.word 1 /* Invalid, just loop */.word LOCAL(ia_r9_ld) - datalabel LOCAL(ia_main_label).word LOCAL(ia_r9_push) - datalabel LOCAL(ia_main_label).word LOCAL(ia_push_seq) - datalabel LOCAL(ia_main_label).word LOCAL(ia_push_seq) - datalabel LOCAL(ia_main_label).word LOCAL(ia_r9_push) - datalabel LOCAL(ia_main_label).word LOCAL(ia_return) - datalabel LOCAL(ia_main_label).word LOCAL(ia_return) - datalabel LOCAL(ia_main_label).mode SHmedia.section .text..SHmedia32, "ax".align 2/* This function stores 64-bit general-purpose registers back inthe stack, and loads the address in which each registerwas stored into itself. The lower 32 bits of r17 hold the addressto begin storing, and the upper 32 bits of r17 hold the cookie.Its execution time is linear on thenumber of registers that actually have to be copied, and it isoptimized for structures larger than 64 bits, as opposed toindividual `long long' arguments. See sh.h for details on theactual bit pattern. */.global GLOBAL(GCC_shcompact_incoming_args)FUNC(GLOBAL(GCC_shcompact_incoming_args))GLOBAL(GCC_shcompact_incoming_args):ptabs/l r18, tr0 /* Prepare to return. */shlri r17, 32, r0 /* Load the cookie. */movi ((datalabel LOCAL(ia_main_table) - 31 * 2) >> 16) & 65535, r43pt/l LOCAL(ia_loop), tr1add.l r17, r63, r17shori ((datalabel LOCAL(ia_main_table) - 31 * 2)) & 65535, r43LOCAL(ia_loop):nsb r0, r36shlli r36, 1, r37ldx.w r43, r37, r38LOCAL(ia_main_label):ptrel/l r38, tr2blink tr2, r63LOCAL(ia_r2_ld): /* Store r2 and load its address. */movi 3, r38shlli r38, 29, r39and r0, r39, r40andc r0, r39, r0stx.q r17, r63, r2add.l r17, r63, r2addi.l r17, 8, r17beq/u r39, r40, tr1LOCAL(ia_r3_ld): /* Store r3 and load its address. */movi 3, r38shlli r38, 26, r39and r0, r39, r40andc r0, r39, r0stx.q r17, r63, r3add.l r17, r63, r3addi.l r17, 8, r17beq/u r39, r40, tr1LOCAL(ia_r4_ld): /* Store r4 and load its address. */movi 3, r38shlli r38, 23, r39and r0, r39, r40andc r0, r39, r0stx.q r17, r63, r4add.l r17, r63, r4addi.l r17, 8, r17beq/u r39, r40, tr1LOCAL(ia_r5_ld): /* Store r5 and load its address. */movi 3, r38shlli r38, 20, r39and r0, r39, r40andc r0, r39, r0stx.q r17, r63, r5add.l r17, r63, r5addi.l r17, 8, r17beq/u r39, r40, tr1LOCAL(ia_r6_ld): /* Store r6 and load its address. */movi 3, r38shlli r38, 16, r39and r0, r39, r40andc r0, r39, r0stx.q r17, r63, r6add.l r17, r63, r6addi.l r17, 8, r17beq/u r39, r40, tr1LOCAL(ia_r7_ld): /* Store r7 and load its address. */movi 3 << 12, r39and r0, r39, r40andc r0, r39, r0stx.q r17, r63, r7add.l r17, r63, r7addi.l r17, 8, r17beq/u r39, r40, tr1LOCAL(ia_r8_ld): /* Store r8 and load its address. */movi 3 << 8, r39and r0, r39, r40andc r0, r39, r0stx.q r17, r63, r8add.l r17, r63, r8addi.l r17, 8, r17beq/u r39, r40, tr1LOCAL(ia_r9_ld): /* Store r9 and load its address. */stx.q r17, r63, r9add.l r17, r63, r9blink tr0, r63LOCAL(ia_r2_push): /* Push r2 onto the stack. */movi 1, r38shlli r38, 29, r39andc r0, r39, r0stx.q r17, r63, r2addi.l r17, 8, r17blink tr1, r63LOCAL(ia_r3_push): /* Push r3 onto the stack. */movi 1, r38shlli r38, 26, r39andc r0, r39, r0stx.q r17, r63, r3addi.l r17, 8, r17blink tr1, r63LOCAL(ia_r4_push): /* Push r4 onto the stack. */movi 1, r38shlli r38, 23, r39andc r0, r39, r0stx.q r17, r63, r4addi.l r17, 8, r17blink tr1, r63LOCAL(ia_r5_push): /* Push r5 onto the stack. */movi 1, r38shlli r38, 20, r39andc r0, r39, r0stx.q r17, r63, r5addi.l r17, 8, r17blink tr1, r63LOCAL(ia_r6_push): /* Push r6 onto the stack. */movi 1, r38shlli r38, 16, r39andc r0, r39, r0stx.q r17, r63, r6addi.l r17, 8, r17blink tr1, r63LOCAL(ia_r7_push): /* Push r7 onto the stack. */movi 1 << 12, r39andc r0, r39, r0stx.q r17, r63, r7addi.l r17, 8, r17blink tr1, r63LOCAL(ia_r8_push): /* Push r8 onto the stack. */movi 1 << 8, r39andc r0, r39, r0stx.q r17, r63, r8addi.l r17, 8, r17blink tr1, r63LOCAL(ia_push_seq): /* Push a sequence of registers onto the stack. */andi r0, 7 << 1, r38movi (LOCAL(ia_end_of_push_seq) >> 16) & 65535, r40shlli r38, 2, r39shori LOCAL(ia_end_of_push_seq) & 65535, r40sub.l r40, r39, r41ptabs/l r41, tr2blink tr2, r63LOCAL(ia_stack_of_push_seq): /* Beginning of push sequence. */stx.q r17, r63, r3addi.l r17, 8, r17stx.q r17, r63, r4addi.l r17, 8, r17stx.q r17, r63, r5addi.l r17, 8, r17stx.q r17, r63, r6addi.l r17, 8, r17stx.q r17, r63, r7addi.l r17, 8, r17stx.q r17, r63, r8addi.l r17, 8, r17LOCAL(ia_r9_push): /* Push r9 onto the stack. */stx.q r17, r63, r9LOCAL(ia_return): /* Return. */blink tr0, r63LOCAL(ia_end_of_push_seq): /* Label used to compute the first push instruction. */ENDFUNC(GLOBAL(GCC_shcompact_incoming_args))#endif /* L_shcompact_incoming_args */#endif#if __SH5__#ifdef L_nested_trampoline#if __SH5__ == 32.section .text..SHmedia32,"ax"#else.text#endif.align 3 /* It is copied in units of 8 bytes in SHmedia mode. */.global GLOBAL(GCC_nested_trampoline)HIDDEN_FUNC(GLOBAL(GCC_nested_trampoline))GLOBAL(GCC_nested_trampoline):.mode SHmediaptrel/u r63, tr0gettr tr0, r0#if __SH5__ == 64ld.q r0, 24, r1#elseld.l r0, 24, r1#endifptabs/l r1, tr1#if __SH5__ == 64ld.q r0, 32, r1#elseld.l r0, 28, r1#endifblink tr1, r63ENDFUNC(GLOBAL(GCC_nested_trampoline))#endif /* L_nested_trampoline */#endif /* __SH5__ */#if __SH5__ == 32#ifdef L_push_pop_shmedia_regs.section .text..SHmedia32,"ax".mode SHmedia.align 2#ifndef __SH4_NOFPU__.global GLOBAL(GCC_push_shmedia_regs)FUNC(GLOBAL(GCC_push_shmedia_regs))GLOBAL(GCC_push_shmedia_regs):addi.l r15, -14*8, r15fst.d r15, 13*8, dr62fst.d r15, 12*8, dr60fst.d r15, 11*8, dr58fst.d r15, 10*8, dr56fst.d r15, 9*8, dr54fst.d r15, 8*8, dr52fst.d r15, 7*8, dr50fst.d r15, 6*8, dr48fst.d r15, 5*8, dr46fst.d r15, 4*8, dr44fst.d r15, 3*8, dr42fst.d r15, 2*8, dr40fst.d r15, 1*8, dr38fst.d r15, 0*8, dr36#else /* ! __SH4_NOFPU__ */.global GLOBAL(GCC_push_shmedia_regs_nofpu)FUNC(GLOBAL(GCC_push_shmedia_regs_nofpu))GLOBAL(GCC_push_shmedia_regs_nofpu):#endif /* ! __SH4_NOFPU__ */ptabs/l r18, tr0addi.l r15, -27*8, r15gettr tr7, r62gettr tr6, r61gettr tr5, r60st.q r15, 26*8, r62st.q r15, 25*8, r61st.q r15, 24*8, r60st.q r15, 23*8, r59st.q r15, 22*8, r58st.q r15, 21*8, r57st.q r15, 20*8, r56st.q r15, 19*8, r55st.q r15, 18*8, r54st.q r15, 17*8, r53st.q r15, 16*8, r52st.q r15, 15*8, r51st.q r15, 14*8, r50st.q r15, 13*8, r49st.q r15, 12*8, r48st.q r15, 11*8, r47st.q r15, 10*8, r46st.q r15, 9*8, r45st.q r15, 8*8, r44st.q r15, 7*8, r35st.q r15, 6*8, r34st.q r15, 5*8, r33st.q r15, 4*8, r32st.q r15, 3*8, r31st.q r15, 2*8, r30st.q r15, 1*8, r29st.q r15, 0*8, r28blink tr0, r63#ifndef __SH4_NOFPU__ENDFUNC(GLOBAL(GCC_push_shmedia_regs))#elseENDFUNC(GLOBAL(GCC_push_shmedia_regs_nofpu))#endif#ifndef __SH4_NOFPU__.global GLOBAL(GCC_pop_shmedia_regs)FUNC(GLOBAL(GCC_pop_shmedia_regs))GLOBAL(GCC_pop_shmedia_regs):pt .L0, tr1movi 41*8, r0fld.d r15, 40*8, dr62fld.d r15, 39*8, dr60fld.d r15, 38*8, dr58fld.d r15, 37*8, dr56fld.d r15, 36*8, dr54fld.d r15, 35*8, dr52fld.d r15, 34*8, dr50fld.d r15, 33*8, dr48fld.d r15, 32*8, dr46fld.d r15, 31*8, dr44fld.d r15, 30*8, dr42fld.d r15, 29*8, dr40fld.d r15, 28*8, dr38fld.d r15, 27*8, dr36blink tr1, r63#else /* ! __SH4_NOFPU__ */.global GLOBAL(GCC_pop_shmedia_regs_nofpu)FUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu))GLOBAL(GCC_pop_shmedia_regs_nofpu):#endif /* ! __SH4_NOFPU__ */movi 27*8, r0.L0:ptabs r18, tr0ld.q r15, 26*8, r62ld.q r15, 25*8, r61ld.q r15, 24*8, r60ptabs r62, tr7ptabs r61, tr6ptabs r60, tr5ld.q r15, 23*8, r59ld.q r15, 22*8, r58ld.q r15, 21*8, r57ld.q r15, 20*8, r56ld.q r15, 19*8, r55ld.q r15, 18*8, r54ld.q r15, 17*8, r53ld.q r15, 16*8, r52ld.q r15, 15*8, r51ld.q r15, 14*8, r50ld.q r15, 13*8, r49ld.q r15, 12*8, r48ld.q r15, 11*8, r47ld.q r15, 10*8, r46ld.q r15, 9*8, r45ld.q r15, 8*8, r44ld.q r15, 7*8, r35ld.q r15, 6*8, r34ld.q r15, 5*8, r33ld.q r15, 4*8, r32ld.q r15, 3*8, r31ld.q r15, 2*8, r30ld.q r15, 1*8, r29ld.q r15, 0*8, r28add.l r15, r0, r15blink tr0, r63#ifndef __SH4_NOFPU__ENDFUNC(GLOBAL(GCC_pop_shmedia_regs))#elseENDFUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu))#endif#endif /* __SH5__ == 32 */#endif /* L_push_pop_shmedia_regs */#ifdef L_div_table#if __SH5__#if defined(__pic__) && defined(__SHMEDIA__).global GLOBAL(sdivsi3)FUNC(GLOBAL(sdivsi3))#if __SH5__ == 32.section .text..SHmedia32,"ax"#else.text#endif#if 0/* ??? FIXME: Presumably due to a linker bug, exporting data symbolsin a text section does not work (at least for shared libraries):the linker sets the LSB of the address as if this was SHmedia code. */#define TEXT_DATA_BUG#endif.align 2// inputs: r4,r5// clobbered: r1,r18,r19,r20,r21,r25,tr0// result in r0.global GLOBAL(sdivsi3)GLOBAL(sdivsi3):#ifdef TEXT_DATA_BUGptb datalabel Local_div_table,tr0#elseptb GLOBAL(div_table_internal),tr0#endifnsb r5, r1shlld r5, r1, r25 // normalize; [-2 ..1, 1..2) in s2.62shari r25, 58, r21 // extract 5(6) bit index (s2.4 with hole -1..1)/* bubble */gettr tr0,r20ldx.ub r20, r21, r19 // u0.8shari r25, 32, r25 // normalize to s2.30shlli r21, 1, r21muls.l r25, r19, r19 // s2.38ldx.w r20, r21, r21 // s2.14ptabs r18, tr0shari r19, 24, r19 // truncate to s2.14sub r21, r19, r19 // some 11 bit inverse in s1.14muls.l r19, r19, r21 // u0.28sub r63, r1, r1addi r1, 92, r1muls.l r25, r21, r18 // s2.58shlli r19, 45, r19 // multiply by two and convert to s2.58/* bubble */sub r19, r18, r18shari r18, 28, r18 // some 22 bit inverse in s1.30muls.l r18, r25, r0 // s2.60muls.l r18, r4, r25 // s32.30/* bubble */shari r0, 16, r19 // s-16.44muls.l r19, r18, r19 // s-16.74shari r25, 63, r0shari r4, 14, r18 // s19.-14shari r19, 30, r19 // s-16.44muls.l r19, r18, r19 // s15.30xor r21, r0, r21 // You could also use the constant 1 << 27.add r21, r25, r21sub r21, r19, r21shard r21, r1, r21sub r21, r0, r0blink tr0, r63ENDFUNC(GLOBAL(sdivsi3))/* This table has been generated by divtab.c .Defects for bias -330:Max defect: 6.081536e-07 at -1.000000e+00Min defect: 2.849516e-08 at 1.030651e+00Max 2nd step defect: 9.606539e-12 at -1.000000e+00Min 2nd step defect: 0.000000e+00 at 0.000000e+00Defect at 1: 1.238659e-07Defect at -2: 1.061708e-07 */#else /* ! __pic__ || ! __SHMEDIA__ */.section .rodata#endif /* __pic__ */#if defined(TEXT_DATA_BUG) && defined(__pic__) && defined(__SHMEDIA__).balign 2.type Local_div_table,@object.size Local_div_table,128/* negative division constants */.word -16638.word -17135.word -17737.word -18433.word -19103.word -19751.word -20583.word -21383.word -22343.word -23353.word -24407.word -25582.word -26863.word -28382.word -29965.word -31800/* negative division factors */.byte 66.byte 70.byte 75.byte 81.byte 87.byte 93.byte 101.byte 109.byte 119.byte 130.byte 142.byte 156.byte 172.byte 192.byte 214.byte 241.skip 16Local_div_table:.skip 16/* positive division factors */.byte 241.byte 214.byte 192.byte 172.byte 156.byte 142.byte 130.byte 119.byte 109.byte 101.byte 93.byte 87.byte 81.byte 75.byte 70.byte 66/* positive division constants */.word 31801.word 29966.word 28383.word 26864.word 25583.word 24408.word 23354.word 22344.word 21384.word 20584.word 19752.word 19104.word 18434.word 17738.word 17136.word 16639.section .rodata#endif /* TEXT_DATA_BUG */.balign 2.type GLOBAL(div_table),@object.size GLOBAL(div_table),128/* negative division constants */.word -16638.word -17135.word -17737.word -18433.word -19103.word -19751.word -20583.word -21383.word -22343.word -23353.word -24407.word -25582.word -26863.word -28382.word -29965.word -31800/* negative division factors */.byte 66.byte 70.byte 75.byte 81.byte 87.byte 93.byte 101.byte 109.byte 119.byte 130.byte 142.byte 156.byte 172.byte 192.byte 214.byte 241.skip 16.global GLOBAL(div_table)GLOBAL(div_table):HIDDEN_ALIAS(div_table_internal,div_table).skip 16/* positive division factors */.byte 241.byte 214.byte 192.byte 172.byte 156.byte 142.byte 130.byte 119.byte 109.byte 101.byte 93.byte 87.byte 81.byte 75.byte 70.byte 66/* positive division constants */.word 31801.word 29966.word 28383.word 26864.word 25583.word 24408.word 23354.word 22344.word 21384.word 20584.word 19752.word 19104.word 18434.word 17738.word 17136.word 16639#elif defined (__SH3__) || defined (__SH3E__) || defined (__SH4__) || defined (__SH4_SINGLE__) || defined (__SH4_SINGLE_ONLY__) || defined (__SH4_NOFPU__)/* This code used shld, thus is not suitable for SH1 / SH2. *//* Signed / unsigned division without use of FPU, optimized for SH4.Uses a lookup table for divisors in the range -128 .. +128, anddiv1 with case distinction for larger divisors in three more ranges.The code is lumped together with the table to allow the use of mova. */#ifdef __LITTLE_ENDIAN__#define L_LSB 0#define L_LSWMSB 1#define L_MSWLSB 2#else#define L_LSB 3#define L_LSWMSB 2#define L_MSWLSB 1#endif.balign 4.global GLOBAL(udivsi3_i4i)FUNC(GLOBAL(udivsi3_i4i))GLOBAL(udivsi3_i4i):mov.w LOCAL(c128_w), r1div0umov r4,r0shlr8 r0cmp/hi r1,r5extu.w r5,r1bf LOCAL(udiv_le128)cmp/eq r5,r1bf LOCAL(udiv_ge64k)shlr r0mov r5,r1shll16 r5mov.l r4,@-r15div1 r5,r0mov.l r1,@-r15div1 r5,r0div1 r5,r0bra LOCAL(udiv_25)div1 r5,r0LOCAL(div_le128):mova LOCAL(div_table_ix),r0bra LOCAL(div_le128_2)mov.b @(r0,r5),r1LOCAL(udiv_le128):mov.l r4,@-r15mova LOCAL(div_table_ix),r0mov.b @(r0,r5),r1mov.l r5,@-r15LOCAL(div_le128_2):mova LOCAL(div_table_inv),r0mov.l @(r0,r1),r1mov r5,r0tst #0xfe,r0mova LOCAL(div_table_clz),r0dmulu.l r1,r4mov.b @(r0,r5),r1bt/s LOCAL(div_by_1)mov r4,r0mov.l @r15+,r5sts mach,r0/* clrt */addc r4,r0mov.l @r15+,r4rotcr r0rtsshld r1,r0LOCAL(div_by_1_neg):neg r4,r0LOCAL(div_by_1):mov.l @r15+,r5rtsmov.l @r15+,r4LOCAL(div_ge64k):bt/s LOCAL(div_r8)div0ushll8 r5bra LOCAL(div_ge64k_2)div1 r5,r0LOCAL(udiv_ge64k):cmp/hi r0,r5mov r5,r1bt LOCAL(udiv_r8)shll8 r5mov.l r4,@-r15div1 r5,r0mov.l r1,@-r15LOCAL(div_ge64k_2):div1 r5,r0mov.l LOCAL(zero_l),r1.rept 4div1 r5,r0.endrmov.l r1,@-r15div1 r5,r0mov.w LOCAL(m256_w),r1div1 r5,r0mov.b r0,@(L_LSWMSB,r15)xor r4,r0and r1,r0bra LOCAL(div_ge64k_end)xor r4,r0LOCAL(div_r8):shll16 r4bra LOCAL(div_r8_2)shll8 r4LOCAL(udiv_r8):mov.l r4,@-r15shll16 r4clrtshll8 r4mov.l r5,@-r15LOCAL(div_r8_2):rotcl r4mov r0,r1div1 r5,r1mov r4,r0rotcl r0mov r5,r4div1 r5,r1.rept 5rotcl r0; div1 r5,r1.endrrotcl r0mov.l @r15+,r5div1 r4,r1mov.l @r15+,r4rtsrotcl r0ENDFUNC(GLOBAL(udivsi3_i4i)).global GLOBAL(sdivsi3_i4i)FUNC(GLOBAL(sdivsi3_i4i))/* This is link-compatible with a GLOBAL(sdivsi3) call,but we effectively clobber only r1. */GLOBAL(sdivsi3_i4i):mov.l r4,@-r15cmp/pz r5mov.w LOCAL(c128_w), r1bt/s LOCAL(pos_divisor)cmp/pz r4mov.l r5,@-r15neg r5,r5bt/s LOCAL(neg_result)cmp/hi r1,r5neg r4,r4LOCAL(pos_result):extu.w r5,r0bf LOCAL(div_le128)cmp/eq r5,r0mov r4,r0shlr8 r0bf/s LOCAL(div_ge64k)cmp/hi r0,r5div0ushll16 r5div1 r5,r0div1 r5,r0div1 r5,r0LOCAL(udiv_25):mov.l LOCAL(zero_l),r1div1 r5,r0div1 r5,r0mov.l r1,@-r15.rept 3div1 r5,r0.endrmov.b r0,@(L_MSWLSB,r15)xtrct r4,r0swap.w r0,r0.rept 8div1 r5,r0.endrmov.b r0,@(L_LSWMSB,r15)LOCAL(div_ge64k_end):.rept 8div1 r5,r0.endrmov.l @r15+,r4 ! zero-extension and swap using LS unit.extu.b r0,r0mov.l @r15+,r5or r4,r0mov.l @r15+,r4rtsrotcl r0LOCAL(div_le128_neg):tst #0xfe,r0mova LOCAL(div_table_ix),r0mov.b @(r0,r5),r1mova LOCAL(div_table_inv),r0bt/s LOCAL(div_by_1_neg)mov.l @(r0,r1),r1mova LOCAL(div_table_clz),r0dmulu.l r1,r4mov.b @(r0,r5),r1mov.l @r15+,r5sts mach,r0/* clrt */addc r4,r0mov.l @r15+,r4rotcr r0shld r1,r0rtsneg r0,r0LOCAL(pos_divisor):mov.l r5,@-r15bt/s LOCAL(pos_result)cmp/hi r1,r5neg r4,r4LOCAL(neg_result):extu.w r5,r0bf LOCAL(div_le128_neg)cmp/eq r5,r0mov r4,r0shlr8 r0bf/s LOCAL(div_ge64k_neg)cmp/hi r0,r5div0umov.l LOCAL(zero_l),r1shll16 r5div1 r5,r0mov.l r1,@-r15.rept 7div1 r5,r0.endrmov.b r0,@(L_MSWLSB,r15)xtrct r4,r0swap.w r0,r0.rept 8div1 r5,r0.endrmov.b r0,@(L_LSWMSB,r15)LOCAL(div_ge64k_neg_end):.rept 8div1 r5,r0.endrmov.l @r15+,r4 ! zero-extension and swap using LS unit.extu.b r0,r1mov.l @r15+,r5or r4,r1LOCAL(div_r8_neg_end):mov.l @r15+,r4rotcl r1rtsneg r1,r0LOCAL(div_ge64k_neg):bt/s LOCAL(div_r8_neg)div0ushll8 r5mov.l LOCAL(zero_l),r1.rept 6div1 r5,r0.endrmov.l r1,@-r15div1 r5,r0mov.w LOCAL(m256_w),r1div1 r5,r0mov.b r0,@(L_LSWMSB,r15)xor r4,r0and r1,r0bra LOCAL(div_ge64k_neg_end)xor r4,r0LOCAL(c128_w):.word 128LOCAL(div_r8_neg):clrtshll16 r4mov r4,r1shll8 r1mov r5,r4.rept 7rotcl r1; div1 r5,r0.endrmov.l @r15+,r5rotcl r1bra LOCAL(div_r8_neg_end)div1 r4,r0LOCAL(m256_w):.word 0xff00/* This table has been generated by divtab-sh4.c. */.balign 4LOCAL(div_table_clz):.byte 0.byte 1.byte 0.byte -1.byte -1.byte -2.byte -2.byte -2.byte -2.byte -3.byte -3.byte -3.byte -3.byte -3.byte -3.byte -3.byte -3.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -4.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -5.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6.byte -6/* Lookup table translating positive divisor to index into table ofnormalized inverse. N.B. the '0' entry is also the last entry of theprevious table, and causes an unaligned access for division by zero. */LOCAL(div_table_ix):.byte -6.byte -128.byte -128.byte 0.byte -128.byte -64.byte 0.byte 64.byte -128.byte -96.byte -64.byte -32.byte 0.byte 32.byte 64.byte 96.byte -128.byte -112.byte -96.byte -80.byte -64.byte -48.byte -32.byte -16.byte 0.byte 16.byte 32.byte 48.byte 64.byte 80.byte 96.byte 112.byte -128.byte -120.byte -112.byte -104.byte -96.byte -88.byte -80.byte -72.byte -64.byte -56.byte -48.byte -40.byte -32.byte -24.byte -16.byte -8.byte 0.byte 8.byte 16.byte 24.byte 32.byte 40.byte 48.byte 56.byte 64.byte 72.byte 80.byte 88.byte 96.byte 104.byte 112.byte 120.byte -128.byte -124.byte -120.byte -116.byte -112.byte -108.byte -104.byte -100.byte -96.byte -92.byte -88.byte -84.byte -80.byte -76.byte -72.byte -68.byte -64.byte -60.byte -56.byte -52.byte -48.byte -44.byte -40.byte -36.byte -32.byte -28.byte -24.byte -20.byte -16.byte -12.byte -8.byte -4.byte 0.byte 4.byte 8.byte 12.byte 16.byte 20.byte 24.byte 28.byte 32.byte 36.byte 40.byte 44.byte 48.byte 52.byte 56.byte 60.byte 64.byte 68.byte 72.byte 76.byte 80.byte 84.byte 88.byte 92.byte 96.byte 100.byte 104.byte 108.byte 112.byte 116.byte 120.byte 124.byte -128/* 1/64 .. 1/127, normalized. There is an implicit leading 1 in bit 32. */.balign 4LOCAL(zero_l):.long 0x0.long 0xF81F81F9.long 0xF07C1F08.long 0xE9131AC0.long 0xE1E1E1E2.long 0xDAE6076C.long 0xD41D41D5.long 0xCD856891.long 0xC71C71C8.long 0xC0E07039.long 0xBACF914D.long 0xB4E81B4F.long 0xAF286BCB.long 0xA98EF607.long 0xA41A41A5.long 0x9EC8E952.long 0x9999999A.long 0x948B0FCE.long 0x8F9C18FA.long 0x8ACB90F7.long 0x86186187.long 0x81818182.long 0x7D05F418.long 0x78A4C818.long 0x745D1746.long 0x702E05C1.long 0x6C16C16D.long 0x68168169.long 0x642C8591.long 0x60581606.long 0x5C9882BA.long 0x58ED2309LOCAL(div_table_inv):.long 0x55555556.long 0x51D07EAF.long 0x4E5E0A73.long 0x4AFD6A06.long 0x47AE147B.long 0x446F8657.long 0x41414142.long 0x3E22CBCF.long 0x3B13B13C.long 0x38138139.long 0x3521CFB3.long 0x323E34A3.long 0x2F684BDB.long 0x2C9FB4D9.long 0x29E4129F.long 0x27350B89.long 0x24924925.long 0x21FB7813.long 0x1F7047DD.long 0x1CF06ADB.long 0x1A7B9612.long 0x18118119.long 0x15B1E5F8.long 0x135C8114.long 0x11111112.long 0xECF56BF.long 0xC9714FC.long 0xA6810A7.long 0x8421085.long 0x624DD30.long 0x4104105.long 0x2040811/* maximum error: 0.987342 scaled: 0.921875*/ENDFUNC(GLOBAL(sdivsi3_i4i))#endif /* SH3 / SH4 */#endif /* L_div_table */#ifdef L_udiv_qrnnd_16#if !__SHMEDIA__HIDDEN_FUNC(GLOBAL(udiv_qrnnd_16))/* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m *//* n1 < d, but n1 might be larger than d1. */.global GLOBAL(udiv_qrnnd_16).balign 8GLOBAL(udiv_qrnnd_16):div0ucmp/hi r6,r0bt .Lots.rept 16div1 r6,r0.endrextu.w r0,r1bt 0fadd r6,r00: rotcl r1mulu.w r1,r5xtrct r4,r0swap.w r0,r0sts macl,r2cmp/hs r2,r0sub r2,r0bt 0faddc r5,r0add #-1,r1bt 0f1: add #-1,r1rtsadd r5,r0.balign 8.Lots:sub r5,r0swap.w r4,r1xtrct r0,r1clrtmov r1,r0addc r5,r0mov #-1,r1SL1(bf, 1b,shlr16 r1)0: rtsnopENDFUNC(GLOBAL(udiv_qrnnd_16))#endif /* !__SHMEDIA__ */#endif /* L_udiv_qrnnd_16 */
