aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sh/lib1funcs.asm
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2002-02-09 03:08:08 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2002-02-09 03:08:08 +0000
commitfa5322fa5824e95a7aa82413782b510c8d91e7d8 (patch)
treed0a27ffe9a822025fe0fa1929bfd170fabd4723e /gcc/config/sh/lib1funcs.asm
parent7aa00daf451b0cb94479991499fc74e33fd90582 (diff)
downloadgcc-fa5322fa5824e95a7aa82413782b510c8d91e7d8.zip
gcc-fa5322fa5824e95a7aa82413782b510c8d91e7d8.tar.gz
gcc-fa5322fa5824e95a7aa82413782b510c8d91e7d8.tar.bz2
Contribute sh64-elf.
2002-02-09 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.c (TARGET_CANNOT_MODIFY_JUMPS_P): Define to... (sh_cannot_modify_jumps_p): New function. 2002-02-05 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.c (TARGET_MS_BITFIELD_LAYOUT_P): Define to... (sh_ms_bitfield_layout_p): New function. 2002-02-04 Alexandre Oliva <aoliva@redhat.com> Zack Weinberg <zack@codesourcery.com> * config/sh/sh.h (TRAMPOLINE_ADJUST_ADDRESS): Use expand_simple_binop instead of expand_binop. 2002-02-03 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (OVERRIDE_OPTIONS) [! TARGET_SH5]: Disable use of .quad and .uaquad. * config/sh/sh.c (TARGET_ASM_UNALIGNED_DI_OP, TARGET_ASM_ALIGNED_DI_OP): Add comment pointing to the above. 2002-01-24 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (movdi_const, movdi_const_32bit, movdi_const_16bit): Make sure all CONSTs have modes. (sym2PIC): Ditto, but by adjusting all callers. * config/sh/sh.c (calc_live_regs) [TARGET_SHCOMPACT]: Set pr_live if the prologue calls the SHmedia argument decoder or register saver. 2002-01-24 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.c (TARGET_ASM_UNALIGNED_DI_OP): Define. (TARGET_ASM_ALIGNED_DI_OP): Likewise. (sh_expand_epilogue): Don't emit USE of return target register. (prepare_move_operands): Legitimize DImode PIC addresses. (sh_media_register_for_return): Skip tr0, used to initialize the PIC register. (sh_expand_prologue): Remove explicit USE of return register. (nonpic_symbol_mentioned_p): PC is non-PIC. Don't recurse in CONST_DOUBLEs. UNSPEC_GOTPLT is PIC. * config/sh/sh.h (ASM_OUTPUT_DOUBLE_INT): Removed, obsolete. (OVERRIDE_OPTIONS): Don't disable PIC on SH5. (EXTRA_CONSTRAINT_S): Use MOVI_SHORI_BASE_OPERAND_P instead of EXTRA_CONSTRAINT_T. (GOT_ENTRY_P, GOTPLT_ENTRY_P, GOTOFF_P, PIC_ADDR_P): New. (MOVI_SHORI_BASE_OPERAND_P): New. (NON_PIC_REFERENCE_P, PIC_REFERENCE_P): New. (EXTRA_CONSTRAINT_T): Define in terms of them. (OUTPUT_ADDR_CONST_EXTRA): Handle UNSPEC_GOTPLT. * config/sh/sh.md (movsi_media, movsi_media_nofpu, movdi_media, movdi_media_nofpu): Add SIBCALL_REGS class to alternatives supporting TARGET_REGS. (UNSPEC_GOTPLT): New constant. (movdi split): Move incrementing of LABEL_NUSES... (movdi_const, movdi_const_32bit): Here. Use MOVI_SHORI_BASE_OPERAND_P instead of EXTRA_CONSTRAINT_T. (movdi_const_16bit): New. (call, call_value) [flag_pic]: Use GOTPLT. (call_pop, call_value_pop): New expands. (call_pop_compact, call_pop_rettramp): New insns. (call_value_pop_compact, call_value_pop_rettramp): New insns. (sibcall) [flag_pic]: Use GOT. (builtint_setjmp_receiver): Remove bogus, unused expand. (GOTaddr2picreg): Implement for SHcompact and SHmedia. (*pt, *ptb, ptrel): New insns. (sym2GOT): Handle DImode GOT. (sym2GOTPLT, symGOTPLT2reg): New expands. (sym2PIC): New expand. (shcompact_return_tramp): Use GOTPLT to return trampoline. (shcompact_return_tramp_i): Use return register explicitly. * config/sh/sh.h (OVERRIDE_OPTIONS) [TARGET_SHMEDIA]: Don't disable flag_reorder_blocks. 2002-01-19 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (sibcall_compact): Reorder return, uses and clobbers, for clarity. (sibcall_epilogue) [TARGET_SHCOMPACT]: Mark saving and restoring of r0 in macl as MAYBE_DEAD. 2002-01-18 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (LONG_DOUBLE_TYPE_SIZE): Define. * config/sh/sh.md (movv4sf_i, movv16sf_i): Fix uses of alter_subreg all over. (jump) [TARGET_SHMEDIA]: FAIL to create new jumps after reload, instead of emitting instructions that would require reloading. (casesi_load_media): Add missing modes. 2001-11-09 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.c (sh_expand_prologue): Mark the PIC register as used if the argument decoder is called. 2001-08-28 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (udivsi3, divsi3): Load libcall symbol name in Pmode, then extend it to DImode if necessary. 2001-08-28 Stephen Clarke <Stephen.Clarke@st.com> * config/sh/sh.h (LEGITIMATE_CONSTANT_P): Don't accept DFmode constants in FPU-enabled SHmedia, let them be loaded from memory. 2001-08-28 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (cmpeqdi_media, cmpgtdi_media, cmpgtudi_media): Adjust whitespace in assembly output templates. 2001-08-28 Stephen Clarke <Stephen.Clarke@st.com> * config/sh/sh.md (movdicc_false, movdicc_true, movdicc): Adjust mode of if_then_else. 2001-08-04 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh64.h (CPP_DEFAULT_CPU_SPEC): Override definition in sh.h. 2001-07-26 Andrew Haley <aph@cambridge.redhat.com> Joern Rennecke <amylaar@redhat.com> * config/sh/sh64.h (CPP_DEFAULT_CPU_SPEC): New. (SUBTARGET_CPP_PTR_SPEC): New. (SUBTARGET_CPP_SPEC): Remove. 2001-07-06 Chandrakala Chavva <cchavva@redhat.com> * config/sh/sh.md (movsf_media_nofpu+1, movdf_media_nofpu+1): Fix typo in previous checkin. 2001-07-11 Chandrakala Chavva <cchavva@redhat.com> * config/sh/sh.h (MODES_TIEABLE_P): Fix redact indentations. 2001-07-10 Chandrakala Chavva <cchavva@cygnus.com> Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (MODES_TIEABLE_P): Don't tie modes wider than what single FP register can hold for SHmedia target. 2001-07-06 Chandrakala Chavva <cchavva@redhat.com> Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (movsf_media_nofpu+1, movdf_media_nofpu+1): Do not split into SUBREG. 2001-06-14 Alexandre Oliva <aoliva@redhat.com> * config/sh/ushmedia.h, config/sh/sshmedia.h: Updated signatures and added new functions as specified in SH5 ABI r9. 2001-06-04 Alexandre Oliva <aoliva@redhat.com> * config/sh/lib1funcs.asm (GCC_nested_trampoline): Align to an 8-byte boundary. 2001-06-03 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.c (dump_table): Add const0_rtx in calls of gen_consttable_4 and gen_consttable_8. Emit multiple labels and consttable_window_ends. 2001-06-03 Graham Stott <grahams@redhat,com> * config/sh/sh.md (movdi split): Remove unused variable last_insn. 2001-05-16 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.c (print_operand): Handle floating-point pair, vector and matrix registers. * config/sh/sh.h (REGISTER_MOVE_COST): Take floating-pointer vector modes into account. * config/sh/sh.md (movv2sf): Split move between registers into movdf. (movv4sf, movv16sf): Introduce insns that get split only after reload. * config/sh/shmedia.h: Fix Copyright dates. * config/sh/ushmedia.h: Likewise. Move loop counter declarations into conditionals that uses them. (sh_media_FVADD_S, sh_media_FVSUB_S): Fix off-by-one error in loop boundary. * config/sh/sshmedia.h: Fix Copyright dates. (sh_media_PUTCFG): Fix constraints. 2001-05-12 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (TARGET_PTRMEMFUNC_VBIT_LOCATION): Define to ptrmemfunc_vbit_in_delta for SH5. 2001-05-08 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (TARGET_SWITCHES): Document -m5-*. * invoke.texi: Likewise. 2001-04-14 Alexandre Oliva <aoliva@redhat.com> * config/sh/lib1funcs.asm (GCC_push_shmedia_regs, GCC_push_shmedia_regs_nofpu, GCC_pop_shmedia_regs, GCC_pop_shmedia_regs_nofpu): New global symbols. * config/sh/t-sh64 (LIB1ASMFUNCS): Add them. * config/sh/sh.h (SHMEDIA_REGS_STACK_ADJUST): New macro. * config/sh/sh.c (calc_live_regs): Account for PR's saving in compact function with nonlocal labels. (sh_expand_prologue) [SHcompact]: Push SHmedia regs if needed. (sh_expand_epilogue) [SHcompact]: Pop them when appropriate. (initial_elimination_offset): Account for their stack space. * config/sh/sh.md (shmedia_save_restore_regs_compact): New insn. * config/sh/sh.md (movsi_media, movsi_media_nofpu, movqi_media, movhi_media, movdi_media, movdi_media_nofpu, movdf_media, movdf_media_nofpu, movsf_media, movsf_media_nofpu): Require at least one of the operands to be a register. (movv2sf): Likewise. Renamed to movv2sf_i. (movdi, movdf, movv2sf, movv4sf, movv16sf, movsf): prepare_move_operands() before emitting SHmedia insns. 2001-04-03 Alexandre Oliva <aoliva@redhat.com> * config/sh/crti.asm (init, fini) [__SH5__ && ! __SHMEDIA__]: Don't save nor initialize r12. Don't mis-align the stack. Pad the code with a nop. * config/sh/crti.asm: Don't restore r12. Don't mis-align the stack. 2001-03-13 Alexandre Oliva <aoliva@redhat.com> * gcc/longlong.h (__umulsidi3, count_leading_zeros) [__SHMEDIA__]: Implement. 2001-03-11 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md: Set latency of `pt' closer to reality. (movsi_media, movsi_media_nofpu, movdi_media, movdi_media_nofpu, movdf_media, movdf_media_nofpu, movsf_media, movsf_media_nofpu): Set move, load and store type attributes. * config/sh/sh.c (sh_loop_align) [TARGET_SH5]: Set to 3. * config/sh/sh.h (OVERRIDE_OPTIONS) [TARGET_SH5]: Disable profiling. * config/sh/sh.h (PROMOTE_MODE): Sign-extend SImode to DImode. * config/sh/sh-protos.h (sh_media_register_for_return): Declare. * config/sh/sh.c (sh_media_register_for_return): New function. (sh_expand_prologue) [TARGET_SHMEDIA]: Copy r18 to an available branch-target register. (sh_expand_epilogue) [TARGET_SHMEDIA]: Explicitly USE it. * config/sh/sh.md (return_media_i): Use any call-clobbered branch-target register. (return_media): If r18 wasn't copied in the prologue, copy it here. * config/sh/sh.h (CONDITIONAL_REGISTER_USAGE) [TARGET_SHMEDIA]: Clear class FP0_REGS. * config/sh/sh64.h (LINK_SPEC): Removed incorrect default copied from elf.h. 2001-03-08 DJ Delorie <dj@redhat.com> * config/sh/sh.h (OVERRIDE_OPTIONS): Disable relaxing for SHMEDIA. 2001-02-09 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (sibcall_compact): Set fp_mode to single. 2001-02-07 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (INT_ASM_OP) [SHMEDIA64]: Use `.quad'. 2001-02-03 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (INIT_CUMULATIVE_ARGS): Compute size of BLKmode return value correctly for call_cookie. 2001-02-01 Alexandre Oliva <aoliva@redhat.com> * config/sh/crt1.asm (start): Modified so as to call ___setup_argv_and_call_main. 2001-01-26 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (FUNCTION_ARG_ADVANCE): Don't count stack_regs in SHmedia mode. 2001-01-20 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (STRIP_DATALABEL_ENCODING): New macro. (STRIP_NAME_ENCODING): Use it. (ASM_OUTPUT_LABELREF): Likewise. Don't call assemble_name(). 2001-01-19 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (sgeu) [! SHMEDIA]: Fix invocation of prepare_scc_operands(). * config/sh/sh.h (SH_DATALABEL_ENCODING): Change to "#"... (DATALABEL_SYMNAME_P): ... so that we don't need memcmp here. 2001-01-17 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (STRIP_NAME_ENCODING): Strip leading `*'. 2001-01-13 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (shcompact_incoming_args): Use R0_REG. * config/sh/sh.md (R7_REG, R8_REG, R9_REG): Define as constants, used in shcompact_incoming_args. * config/sh/sh.c (sh_expand_epilogue): Fix thinko in previous change. * config/sh/crt1.asm (start) [SH5]: Switch to single-precision mode. * config/sh/lib1funcs.asm (sdivsi3_i4, udivsi3_i4, set_fpscr): Adjust accordingly. * config/sh/sh.c (sh_expand_prologue, sh_expand_epilogue): Simplify. Adjust. Add sanity check. * config/sh/sh.h (TARGET_SWITCHES) [5-compact]: Set FPU_SINGLE_BIT. * config/sh/sh.md (udivsi3_i4_single, divsi3_i4_single): Match TARGET_SHCOMPACT. (udivsi3, divsi3): Use them. (force_mode_for_call): New insn. (call, call_value, sibcall_value): Emit it before SHcompact calls. 2001-01-11 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (call, call_value, sibcall): Make sure the call cookie is non-NULL before taking its value. 2001-01-10 Alexandre Oliva <aoliva@redhat.com> * config.gcc (sh64): Set target_requires_64bit_host_wide_int. 2001-01-09 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (shcompact_incoming_args): Set argument memory block. * config/sh/sh.h (STATIC_CHAIN_REGNUM) [SH5]: Use r1. * config/sh/sh.c (sh_expand_prologue) [SH5]: Use r0 as temporary for stack adjusts. Use MACL and MACH to pass arguments to shcompact_incoming_args. * config/sh/sh.md (shcompact_incoming_args): Adjust. Don't clobber r1. * config/sh/lib1funcs.asm (shcompact_incoming_args): Likewise. (nested_trampoline): Load static chain address into r1. * config/sh/sh.md (movdi_media splits): Fix sign-extension. 2001-01-07 Alexandre Oliva <aoliva@redhat.com * config/sh/sh.c (fpul_operand) [SHMEDIA]: Just call fp_arith_reg_operand(). 2001-01-06 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (casesi): Sign-extend the first two operands, and use signed compares for them. * config/sh/sh.c (dump_table): Don't emit 8-byte constants after 4-byte ones. Instead, inter-leave them, maintaining the 8-byte ones properly aligned. (find_barrier): Account for extra alignment needed for 8-byte wide constants. (machine_dependent_reorg): Require a label for the second 4-byte constant after an 8-byte one. * config/sh/lib1funcs.asm (sdivsi3): Fix typo in yesterday's change. 2001-01-05 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.c (machine_dependent_reorg) [SHCOMPACT]: Reset last_float when switching float modes. * config/sh/sh.md (movdf) [SH5]: Don't use stack-pointer auto-increment for general-purpose registers. * config/sh/lib1funcs.asm (sdivsi3) [SHMEDIA]: Sign-extend the result. * config/sh/sh.c (sh_expand_prologue) [SH5]: Use r1 as temporary for stack adjust. * config/sh/sh.c (sh_builtin_saveregs): Support using all registers for varargs. 2001-01-01 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (FUNCTION_ARG_ADVANCE): Simplify. * config/sh/sh.h (CALL_COOKIE_STACKSEQ, CALL_COOKIE_STACKSEQ_SHIFT, CALL_COOKIE_STACKSEQ_GET): New macros. (CALL_COOKIE_INT_REG_SHIFT): Adjust. (FUNCTION_ARG_ADVANCE): Use SHCOMPACT_FORCE_ON_STACK. Adjust call_cookie accordingly. (FUNCTION_ARG): Test SHCOMPACT_FORCE_ON_STACK. (SHCOMPACT_BYREF): Likewise. (SHCOMPACT_FORCE_ON_STACK): New macro. * config/sh/sh.c (sh_expand_prologue): Use new call_cookie format. (sh_builtin_saveregs): Likewise. * config/sh/lib1funcs.asm (shcompact_call_trampoline, shcompact_incoming_args): Use new shift values. Support sequences of consecutive and non-consecutive pushes/pops. * config/sh/sh.md (return): Don't explicitly use PR_REG. 2001-01-05 Hans-Peter Nilsson <hpn@cygnus.com> * config/sh/sh.h (TEXT_SECTION): Define. * config/sh/elf.h (ASM_FILE_START): Output TEXT_SECTION_ASM_OP. 2001-01-05 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (INIT_CUMULATIVE_LIBCALL_ARGS): New macro. * config/sh/sh.h (BASE_RETURN_VALUE_REG): Use FP regs for return values on FPU-enabled SHmedia. (FUNCTION_VALUE_REGNO_P): Mark FIRST_FP_RET_REG as used on FPU-enabled SHmedia. (INIT_CUMULATIVE_ARGS): Set up return trampoline only if value is returned in a non-FP reg and is not returned by reference. * config/sh/sh.md (shcompact_return_tramp_i): Change type to jump_ind. 2000-01-04 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (SH_MIN_ALIGN_FOR_CALLEE_COPY): New. (FUNCTION_ARG_CALLEE_COPIES): Require argument to be quad-aligned to be passed by callee-copy reference. 2001-01-03 Alexandre Oliva <aoliva@redhat.com> * config/sh/elf.h (MAX_WCHAR_TYPE_SIZE): Define. * config/sh/sh64.h (MAX_WCHAR_TYPE_SIZE): Undefine. 2001-01-02 Alexandre Oliva <aoliva@redhat.com> * config/sh/lib1funcs.asm (shcompact_call_trampoline): Fix error in copying low-numbered FP regs to r7 and r8. * config/sh/sh.h (FUNCTION_ARG_ADVANCE): Don't request copying of FP regs to general-purpose regs only if the copy was passed on the stack. * config/sh/lib1funcs.asm (shcompact_call_trampoline): Fix typo in copying FP reg to r9. * config/sh/sh.h (FUNCTION_ARG_ADVANCE): Use trampoline to copy FP regs to general-purpose regs only in outgoing calls. * config/sh/sh.md (movdf_media, movsf_media): Revert incorrect change from 2000-10-30. Adjust for 64-bit (or 32-bit) HOST_WIDE_INT. * config/sh/sh.h (struct sh_args): Document all fields. (FUNCTION_OK_FOR_SIBCALL): Functions that receive arguments passed partially on the stack should not consider making sibcalls. * config/sh/sh.h (FUNCTION_ARG_ADVANCE): Add byref regs to stack_regs only for incoming calls. When passing FP args, make sure there are FP regs available before modifying call_cookie. (SHCOMPACT_BYREF): Pass double args in general-purpose registers by reference. 2000-12-30 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (FUNCTION_OK_FOR_SIBCALL) [SHCOMPACT]: Don't attempt to generate sibcalls if the caller got any arguments by reference. * config/sh/lib1funcs.asm (set_fpscr) [SH5]: Default to double. * config/sh/sh.c (dump_table) [SHCOMPACT]: Align DImode and DFmode to 8-byte boundaries. * config/sh/sh.md (shcompact_preserve_incoming_args): New insn. * config/sh/sh.h (CALL_COOKIE_INT_REG_GET): New macro. * config/sh/sh.c (sh_expand_prologue): Preserve args that will be stored in the stack. * config/sh/lib1funcs.asm (ct_main_table, ia_main_table): Arrange for the offsets to have the ISA bit set. (shcompact_call_trampoline): Document. Swap r0 and r1, to match invocation. Use beq instead of bgt to mark end of sequence of loads. (shcompact_incoming_args): Fix store of r2. Use beq instead of bgt to mark end of sequence of stores. * config/sh/sh.c (arith_operand): Don't check whether CONST_OK_FOR_J for now. * config/sh/sh.md (movdf_media, movsf_media): Use HOST_WIDE_INT instead of long for conversion. 2000-12-29 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.c (print_operand_address): Convert INTVAL to int before passing it to fprintf. 2000-12-28 Alexandre Oliva <aoliva@redhat.com> * config/sh/crt1.asm (start): Reset SR.FD, to enable the FP unit. Call set_fpscr before reading/writing SR. * config/sh/crt1.asm (start): Set SR.SZ and SR.PR, but not SR.FR. Call set_fpscr. * config/sh/lib1funcs.asm: Add `.align 2' directives before SHmedia code. (FMOVD_WORKS): Define on SH5 with FPU. (set_fpscr): Define on SH5. Remove separate _fpscr_values setting. * config/sh/t-sh64 (LIB1ASMFUNCS): Add _set_fpscr instead of _fpscr_values. 2000-12-28 Hans-Peter Nilsson <hpn@cygnus.com> * config/sh/lib1funcs.asm (ct_main_table): Align contents to even address. (ia_main_table): Ditto. 2000-12-27 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.h (MAX_WCHAR_TYPE_SIZE): Don't define. * config/sh/sh64.h (WCHAR_TYPE, WCHAR_TYPE_SIZE): Reinstate the definitions from sh.h. * config/sh/sh.h (PTRDIFF_TYPE): Define as conditional on TARGET_SH5. (SUBTARGET_CPP_SPEC): Arrange for __PTRDIFF_TYPE__ to be defined. * config/sh/elf.h (PTRDIFF_TYPE): Likewise. * config/sh/sh64.h (SUBTARGET_CPP_SPEC): Likewise. 2000-12-26 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (movdi_media split): Don't add REG_LABEL notes. Increment LABEL_NUSES. From-SVN: r49630
Diffstat (limited to 'gcc/config/sh/lib1funcs.asm')
-rw-r--r--gcc/config/sh/lib1funcs.asm938
1 files changed, 934 insertions, 4 deletions
diff --git a/gcc/config/sh/lib1funcs.asm b/gcc/config/sh/lib1funcs.asm
index 2170758..53ca874 100644
--- a/gcc/config/sh/lib1funcs.asm
+++ b/gcc/config/sh/lib1funcs.asm
@@ -51,6 +51,11 @@ Boston, MA 02111-1307, USA. */
#define GLOBAL(X) ___##X
#endif
+#if defined __SH5__ && ! defined __SH4_NOFPU__
+#define FMOVD_WORKS
+#endif
+
+#if ! __SH5__
#ifdef L_ashiftrt
.global GLOBAL(ashiftrt_r4_0)
.global GLOBAL(ashiftrt_r4_1)
@@ -866,6 +871,7 @@ hiset: sts macl,r0 ! r0 = bb*dd
#endif
+#endif /* ! __SH5__ */
#ifdef L_sdivsi3_i4
.title "SH DIVIDE"
!! 4 byte integer Divide code for the Hitachi SH
@@ -882,9 +888,13 @@ GLOBAL(sdivsi3_i4):
rts
ftrc dr0,fpul
-#elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__)
+#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)
GLOBAL(sdivsi3_i4):
sts.l fpscr,@-r15
@@ -900,6 +910,7 @@ GLOBAL(sdivsi3_i4):
rts
lds.l @r15+,fpscr
+#endif /* ! __SH5__ || __SH5__ == 32 */
#endif /* ! __SH4__ */
#endif
@@ -916,6 +927,71 @@ GLOBAL(sdivsi3_i4):
!! args in r4 and r5, result in r0 clobber r1,r2,r3
.global GLOBAL(sdivsi3)
+#if __SHMEDIA__
+#if __SH5__ == 32
+ .section .text..SHmedia32,"ax"
+#else
+ .text
+#endif
+ .align 2
+/* The assembly code that follows is a hand-optimized version of the C
+ code that follows. Note that the registers that are modified are
+ exactly those listed as clobbered in the patterns divsi3_i1 and
+ divsi3_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;
+ do
+ if (r18 >= r19)
+ r0 |= r1, r18 -= r19;
+ while (r19 >>= 1, r1 >>= 1);
+
+ return r2 * (int)r0;
+}
+*/
+GLOBAL(sdivsi3):
+ pt/l LOCAL(sdivsi3_dontadd), tr2
+ pt/l LOCAL(sdivsi3_loop), tr1
+ ptabs/l r18, tr0
+ movi 0, r0
+ movi 1, r1
+ shari.l r4, 31, r2
+ shari.l r5, 31, r3
+ cmveq r2, r1, r2
+ cmveq r3, r1, r3
+ muls.l r4, r2, r18
+ muls.l r5, r3, r19
+ muls.l r2, r3, r2
+ shlli r19, 31, r19
+ shlli r1, 31, r1
+LOCAL(sdivsi3_loop):
+ bgtu r19, r18, tr2
+ or r0, r1, r0
+ sub r18, r19, r18
+LOCAL(sdivsi3_dontadd):
+ shlri r1, 1, r1
+ shlri r19, 1, r19
+ bnei r1, 0, tr1
+ muls.l r0, r2, r0
+ add.l r0, r63, r0
+ blink tr0, r63
+#else
GLOBAL(sdivsi3):
mov r4,r1
mov r5,r0
@@ -1000,6 +1076,7 @@ GLOBAL(sdivsi3):
div0: rts
mov #0,r0
+#endif /* ! __SHMEDIA__ */
#endif /* ! __SH4__ */
#endif
#ifdef L_udivsi3_i4
@@ -1050,9 +1127,13 @@ trivial:
L1:
.double 2147483648
-#elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__)
+#elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__)
!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
+#if ! __SH5__ || __SH5__ == 32
+#if __SH5__
+ .mode SHcompact
+#endif
.global GLOBAL(udivsi3_i4)
GLOBAL(udivsi3_i4):
mov #1,r1
@@ -1102,6 +1183,7 @@ L1:
#endif
.double 2147483648
+#endif /* ! __SH5__ || __SH5__ == 32 */
#endif /* ! __SH4__ */
#endif
@@ -1118,6 +1200,57 @@ L1:
!! args in r4 and r5, result in r0, clobbers r4, pr, and t bit
.global GLOBAL(udivsi3)
+#if __SHMEDIA__
+#if __SH5__ == 32
+ .section .text..SHmedia32,"ax"
+#else
+ .text
+#endif
+ .align 2
+/* The assembly code that follows is a hand-optimized version of the C
+ code that follows. Note that the registers that are modified are
+ exactly those listed as clobbered in the patterns udivsi3_i1 and
+ udivsi3_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;
+ do
+ if (r4 >= r19)
+ r0 |= r18, r4 -= r19;
+ while (r19 >>= 1, r18 >>= 1);
+
+ return r0;
+}
+*/
+GLOBAL(udivsi3):
+ pt/l LOCAL(udivsi3_dontadd), tr2
+ pt/l LOCAL(udivsi3_loop), tr1
+ ptabs/l r18, tr0
+ movi 0, r0
+ movi 1, r18
+ addz.l r5, r63, r19
+ addz.l r4, r63, r4
+ shlli r19, 31, r19
+ shlli r18, 31, r18
+LOCAL(udivsi3_loop):
+ bgtu r19, r4, tr2
+ or r0, r18, r0
+ sub r4, r19, r4
+LOCAL(udivsi3_dontadd):
+ shlri r18, 1, r18
+ shlri r19, 1, r19
+ bnei r18, 0, tr1
+ blink tr0, r63
+#else
GLOBAL(udivsi3):
longway:
mov #0,r0
@@ -1166,10 +1299,14 @@ vshortway:
ret: rts
mov r4,r0
+#endif /* ! __SHMEDIA__ */
#endif /* __SH4__ */
#endif
#ifdef L_set_fpscr
-#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
+#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || __SH5__ == 32
+#ifdef __SH5__
+ .mode SHcompact
+#endif
.global GLOBAL(set_fpscr)
GLOBAL(set_fpscr):
lds r4,fpscr
@@ -1211,7 +1348,17 @@ LOCAL(set_fpscr_L1):
#endif /* SH3E / SH4 */
#endif /* L_set_fpscr */
#ifdef L_ic_invalidate
-#if defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
+#if __SH5__ == 32
+ .mode SHmedia
+ .section .text..SHmedia32,"ax"
+ .align 2
+ .global GLOBAL(ic_invalidate)
+GLOBAL(ic_invalidate):
+ icbi r0, 0
+ ptabs r18, tr0
+ synci
+ blink tr0, r63
+#elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
.global GLOBAL(ic_invalidate)
GLOBAL(ic_invalidate):
ocbwb @r4
@@ -1237,3 +1384,786 @@ GLOBAL(ic_invalidate):
.endr
#endif /* SH4 */
#endif /* L_ic_invalidate */
+
+#if defined (__SH5__) && __SH5__ == 32
+#ifdef L_shcompact_call_trampoline
+ .section .rodata
+ .align 1
+LOCAL(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 the
+ stack, from a memory address contained in them or from an FP
+ register, according to a cookie passed in r1. Its execution
+ time is linear on the number of registers that actually have
+ to 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 return
+ value is expected, the actual function will be tail-called,
+ otherwise the return address will be stored in r10 (that the
+ caller should expect to be clobbered) and the return value
+ will be expanded into r2/r3 upon return. */
+
+ .global 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, r0
+ pt/l LOCAL(ct_loop), tr1
+ addz.l r1, r63, r1
+ shori ((datalabel LOCAL(ct_main_table) - 31 * 2)) & 65535, r0
+LOCAL(ct_loop):
+ nsb r1, r28
+ shlli r28, 1, r29
+ ldx.w r0, r29, r30
+LOCAL(ct_main_label):
+ ptrel/l r30, tr2
+ blink tr2, r63
+LOCAL(ct_r2_fp): /* Copy r2 from an FP register. */
+ /* It must be dr0, so just do it. */
+ fmov.dq dr0, r2
+ movi 7, r30
+ shlli r30, 29, r31
+ andc r1, r31, r1
+ blink tr1, r63
+LOCAL(ct_r3_fp): /* Copy r3 from an FP register. */
+ /* It is either dr0 or dr2. */
+ movi 7, r30
+ shlri r1, 26, r32
+ shlli r30, 26, r31
+ andc r1, r31, r1
+ fmov.dq dr0, r3
+ beqi/l r32, 4, tr1
+ fmov.dq dr2, r3
+ blink tr1, r63
+LOCAL(ct_r4_fp): /* Copy r4 from an FP register. */
+ shlri r1, 23 - 3, r34
+ andi r34, 3 << 3, r33
+ addi r33, LOCAL(ct_r4_fp_copy) - datalabel LOCAL(ct_r4_fp_base), r32
+LOCAL(ct_r4_fp_base):
+ ptrel/l r32, tr2
+ movi 7, r30
+ shlli r30, 23, r31
+ andc r1, r31, r1
+ blink tr2, r63
+LOCAL(ct_r4_fp_copy):
+ fmov.dq dr0, r4
+ blink tr1, r63
+ fmov.dq dr2, r4
+ blink tr1, r63
+ fmov.dq dr4, r4
+ blink tr1, r63
+LOCAL(ct_r5_fp): /* Copy r5 from an FP register. */
+ shlri r1, 20 - 3, r34
+ andi r34, 3 << 3, r33
+ addi r33, LOCAL(ct_r5_fp_copy) - datalabel LOCAL(ct_r5_fp_base), r32
+LOCAL(ct_r5_fp_base):
+ ptrel/l r32, tr2
+ movi 7, r30
+ shlli r30, 20, r31
+ andc r1, r31, r1
+ blink tr2, r63
+LOCAL(ct_r5_fp_copy):
+ fmov.dq dr0, r5
+ blink tr1, r63
+ fmov.dq dr2, r5
+ blink tr1, r63
+ fmov.dq dr4, r5
+ blink tr1, r63
+ fmov.dq dr6, r5
+ blink tr1, r63
+LOCAL(ct_r6_fph): /* Copy r6 from a high FP register. */
+ /* It must be dr8. */
+ fmov.dq dr8, r6
+ movi 15, r30
+ shlli r30, 16, r31
+ andc r1, r31, r1
+ blink tr1, r63
+LOCAL(ct_r6_fpl): /* Copy r6 from a low FP register. */
+ shlri r1, 16 - 3, r34
+ andi r34, 3 << 3, r33
+ addi r33, LOCAL(ct_r6_fp_copy) - datalabel LOCAL(ct_r6_fp_base), r32
+LOCAL(ct_r6_fp_base):
+ ptrel/l r32, tr2
+ movi 7, r30
+ shlli r30, 16, r31
+ andc r1, r31, r1
+ blink tr2, r63
+LOCAL(ct_r6_fp_copy):
+ fmov.dq dr0, r6
+ blink tr1, r63
+ fmov.dq dr2, r6
+ blink tr1, r63
+ fmov.dq dr4, r6
+ blink tr1, r63
+ fmov.dq dr6, r6
+ blink tr1, r63
+LOCAL(ct_r7_fph): /* Copy r7 from a high FP register. */
+ /* It is either dr8 or dr10. */
+ movi 15 << 12, r31
+ shlri r1, 12, r32
+ andc r1, r31, r1
+ fmov.dq dr8, r7
+ beqi/l r32, 8, tr1
+ fmov.dq dr10, r7
+ blink tr1, r63
+LOCAL(ct_r7_fpl): /* Copy r7 from a low FP register. */
+ shlri r1, 12 - 3, r34
+ andi r34, 3 << 3, r33
+ addi r33, LOCAL(ct_r7_fp_copy) - datalabel LOCAL(ct_r7_fp_base), r32
+LOCAL(ct_r7_fp_base):
+ ptrel/l r32, tr2
+ movi 7 << 12, r31
+ andc r1, r31, r1
+ blink tr2, r63
+LOCAL(ct_r7_fp_copy):
+ fmov.dq dr0, r7
+ blink tr1, r63
+ fmov.dq dr2, r7
+ blink tr1, r63
+ fmov.dq dr4, r7
+ blink tr1, r63
+ fmov.dq dr6, r7
+ blink tr1, r63
+LOCAL(ct_r8_fph): /* Copy r8 from a high FP register. */
+ /* It is either dr8 or dr10. */
+ movi 15 << 8, r31
+ andi r1, 1 << 8, r32
+ andc r1, r31, r1
+ fmov.dq dr8, r8
+ beq/l r32, r63, tr1
+ fmov.dq dr10, r8
+ blink tr1, r63
+LOCAL(ct_r8_fpl): /* Copy r8 from a low FP register. */
+ shlri r1, 8 - 3, r34
+ andi r34, 3 << 3, r33
+ addi r33, LOCAL(ct_r8_fp_copy) - datalabel LOCAL(ct_r8_fp_base), r32
+LOCAL(ct_r8_fp_base):
+ ptrel/l r32, tr2
+ movi 7 << 8, r31
+ andc r1, r31, r1
+ blink tr2, r63
+LOCAL(ct_r8_fp_copy):
+ fmov.dq dr0, r8
+ blink tr1, r63
+ fmov.dq dr2, r8
+ blink tr1, r63
+ fmov.dq dr4, r8
+ blink tr1, r63
+ fmov.dq dr6, r8
+ blink tr1, r63
+LOCAL(ct_r9_fph): /* Copy r9 from a high FP register. */
+ /* It is either dr8 or dr10. */
+ movi 15 << 4, r31
+ andi r1, 1 << 4, r32
+ andc r1, r31, r1
+ fmov.dq dr8, r9
+ beq/l r32, r63, tr1
+ fmov.dq dr10, r9
+ blink tr1, r63
+LOCAL(ct_r9_fpl): /* Copy r9 from a low FP register. */
+ shlri r1, 4 - 3, r34
+ andi r34, 3 << 3, r33
+ addi r33, LOCAL(ct_r9_fp_copy) - datalabel LOCAL(ct_r9_fp_base), r32
+LOCAL(ct_r9_fp_base):
+ ptrel/l r32, tr2
+ movi 7 << 4, r31
+ andc r1, r31, r1
+ blink tr2, r63
+LOCAL(ct_r9_fp_copy):
+ fmov.dq dr0, r9
+ blink tr1, r63
+ fmov.dq dr2, r9
+ blink tr1, r63
+ fmov.dq dr4, r9
+ blink tr1, r63
+ fmov.dq dr6, r9
+ blink tr1, r63
+LOCAL(ct_r2_ld): /* Copy r2 from a memory address. */
+ pt/l LOCAL(ct_r2_load), tr2
+ movi 3, r30
+ shlli r30, 29, r31
+ and r1, r31, r32
+ andc r1, r31, r1
+ beq/l r31, r32, tr2
+ addi.l r2, 8, r3
+ ldx.q r2, r63, r2
+ /* Fall through. */
+LOCAL(ct_r3_ld): /* Copy r3 from a memory address. */
+ pt/l LOCAL(ct_r3_load), tr2
+ movi 3, r30
+ shlli r30, 26, r31
+ and r1, r31, r32
+ andc r1, r31, r1
+ beq/l r31, r32, tr2
+ addi.l r3, 8, r4
+ ldx.q r3, r63, r3
+LOCAL(ct_r4_ld): /* Copy r4 from a memory address. */
+ pt/l LOCAL(ct_r4_load), tr2
+ movi 3, r30
+ shlli r30, 23, r31
+ and r1, r31, r32
+ andc r1, r31, r1
+ beq/l r31, r32, tr2
+ addi.l r4, 8, r5
+ ldx.q r4, r63, r4
+LOCAL(ct_r5_ld): /* Copy r5 from a memory address. */
+ pt/l LOCAL(ct_r5_load), tr2
+ movi 3, r30
+ shlli r30, 20, r31
+ and r1, r31, r32
+ andc r1, r31, r1
+ beq/l r31, r32, tr2
+ addi.l r5, 8, r6
+ ldx.q r5, r63, r5
+LOCAL(ct_r6_ld): /* Copy r6 from a memory address. */
+ pt/l LOCAL(ct_r6_load), tr2
+ movi 3 << 16, r31
+ and r1, r31, r32
+ andc r1, r31, r1
+ beq/l r31, r32, tr2
+ addi.l r6, 8, r7
+ ldx.q r6, r63, r6
+LOCAL(ct_r7_ld): /* Copy r7 from a memory address. */
+ pt/l LOCAL(ct_r7_load), tr2
+ movi 3 << 12, r31
+ and r1, r31, r32
+ andc r1, r31, r1
+ beq/l r31, r32, tr2
+ addi.l r7, 8, r8
+ ldx.q r7, r63, r7
+LOCAL(ct_r8_ld): /* Copy r8 from a memory address. */
+ pt/l LOCAL(ct_r8_load), tr2
+ movi 3 << 8, r31
+ and r1, r31, r32
+ andc r1, r31, r1
+ beq/l r31, r32, tr2
+ addi.l r8, 8, r9
+ ldx.q r8, r63, r8
+LOCAL(ct_r9_ld): /* Copy r9 from a memory address. */
+ pt/l LOCAL(ct_check_tramp), tr2
+ ldx.q r9, r63, r9
+ blink tr2, r63
+LOCAL(ct_r2_load):
+ ldx.q r2, r63, r2
+ blink tr1, r63
+LOCAL(ct_r3_load):
+ ldx.q r3, r63, r3
+ blink tr1, r63
+LOCAL(ct_r4_load):
+ ldx.q r4, r63, r4
+ blink tr1, r63
+LOCAL(ct_r5_load):
+ ldx.q r5, r63, r5
+ blink tr1, r63
+LOCAL(ct_r6_load):
+ ldx.q r6, r63, r6
+ blink tr1, r63
+LOCAL(ct_r7_load):
+ ldx.q r7, r63, r7
+ blink tr1, r63
+LOCAL(ct_r8_load):
+ ldx.q r8, r63, r8
+ blink tr1, r63
+LOCAL(ct_r2_pop): /* Pop r2 from the stack. */
+ movi 1, r30
+ ldx.q r15, r63, r2
+ shlli r30, 29, r31
+ addi.l r15, 8, r15
+ andc r1, r31, r1
+ blink tr1, r63
+LOCAL(ct_r3_pop): /* Pop r3 from the stack. */
+ movi 1, r30
+ ldx.q r15, r63, r3
+ shlli r30, 26, r31
+ addi.l r15, 8, r15
+ andc r1, r31, r1
+ blink tr1, r63
+LOCAL(ct_r4_pop): /* Pop r4 from the stack. */
+ movi 1, r30
+ ldx.q r15, r63, r4
+ shlli r30, 23, r31
+ addi.l r15, 8, r15
+ andc r1, r31, r1
+ blink tr1, r63
+LOCAL(ct_r5_pop): /* Pop r5 from the stack. */
+ movi 1, r30
+ ldx.q r15, r63, r5
+ shlli r30, 20, r31
+ addi.l r15, 8, r15
+ andc r1, r31, r1
+ blink tr1, r63
+LOCAL(ct_r6_pop): /* Pop r6 from the stack. */
+ movi 1, r30
+ ldx.q r15, r63, r6
+ shlli r30, 16, r31
+ addi.l r15, 8, r15
+ andc r1, r31, r1
+ blink tr1, r63
+LOCAL(ct_r7_pop): /* Pop r7 from the stack. */
+ ldx.q r15, r63, r7
+ movi 1 << 12, r31
+ addi.l r15, 8, r15
+ andc r1, r31, r1
+ blink tr1, r63
+LOCAL(ct_r8_pop): /* Pop r8 from the stack. */
+ ldx.q r15, r63, r8
+ movi 1 << 8, r31
+ addi.l r15, 8, r15
+ andc r1, r31, r1
+ blink tr1, r63
+LOCAL(ct_pop_seq): /* Pop a sequence of registers off the stack. */
+ andi r1, 7 << 1, r30
+ movi (LOCAL(ct_end_of_pop_seq) >> 16) & 65535, r32
+ shlli r30, 2, r31
+ shori LOCAL(ct_end_of_pop_seq) & 65535, r32
+ sub.l r32, r31, r33
+ ptabs/l r33, tr2
+ blink tr2, r63
+LOCAL(ct_start_of_pop_seq): /* Beginning of pop sequence. */
+ ldx.q r15, r63, r3
+ addi.l r15, 8, r15
+ ldx.q r15, r63, r4
+ addi.l r15, 8, r15
+ ldx.q r15, r63, r5
+ addi.l r15, 8, r15
+ ldx.q r15, r63, r6
+ addi.l r15, 8, r15
+ ldx.q r15, r63, r7
+ addi.l r15, 8, r15
+ ldx.q r15, r63, r8
+ addi.l r15, 8, r15
+LOCAL(ct_r9_pop): /* Pop r9 from the stack. */
+ ldx.q r15, r63, r9
+ addi.l r15, 8, r15
+LOCAL(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), tr2
+ andi r1, 1, r1
+ bne/u r1, r63, tr2
+LOCAL(ct_call_func): /* Just branch to the function. */
+ blink tr0, r63
+LOCAL(ct_ret_wide): /* Call the function, so that we can unpack its
+ 64-bit return value. */
+ add.l r18, r63, r10
+ blink tr0, r18
+ ptabs r10, tr0
+#if __LITTLE_ENDIAN__
+ shari r2, 32, r3
+ add.l r2, r63, r2
+#else
+ add.l r2, r63, r3
+ shari r2, 32, r2
+#endif
+ blink tr0, r63
+#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 returning
+ 64-bit non-floating-point values, to pack the 32-bit values in
+ r2 and r3 into r2. */
+
+ .mode SHmedia
+ .section .text..SHmedia32, "ax"
+ .align 2
+ .global GLOBAL(GCC_shcompact_return_trampoline)
+GLOBAL(GCC_shcompact_return_trampoline):
+ ptabs/l r18, tr0
+#if __LITTLE_ENDIAN__
+ addz.l r2, r63, r2
+ shlli r3, 32, r3
+#else
+ addz.l r3, r63, r3
+ shlli r2, 32, r2
+#endif
+ or r3, r2, r2
+ blink tr0, r63
+#endif /* L_shcompact_return_trampoline */
+
+#ifdef L_shcompact_incoming_args
+ .section .rodata
+ .align 1
+LOCAL(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 in
+ the stack, starting at @(r1), where the cookie is supposed to
+ have been stored, and loads the address in which each register
+ was stored into itself. Its execution time is linear on the
+ number of registers that actually have to be copied, and it is
+ optimized for structures larger than 64 bits, as opposed to
+ invidivual `long long' arguments. See sh.h for details on the
+ actual bit pattern. */
+
+ .global 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, r35
+ pt/l LOCAL(ia_loop), tr1
+ add.l r17, r63, r17
+ shori ((datalabel LOCAL(ia_main_table) - 31 * 2)) & 65535, r35
+LOCAL(ia_loop):
+ nsb r0, r28
+ shlli r28, 1, r29
+ ldx.w r35, r29, r30
+LOCAL(ia_main_label):
+ ptrel/l r30, tr2
+ blink tr2, r63
+LOCAL(ia_r2_ld): /* Store r2 and load its address. */
+ movi 3, r30
+ shlli r30, 29, r31
+ and r0, r31, r32
+ andc r0, r31, r0
+ stx.q r17, r63, r2
+ add.l r17, r63, r2
+ addi.l r17, 8, r17
+ beq/u r31, r32, tr1
+LOCAL(ia_r3_ld): /* Store r3 and load its address. */
+ movi 3, r30
+ shlli r30, 26, r31
+ and r0, r31, r32
+ andc r0, r31, r0
+ stx.q r17, r63, r3
+ add.l r17, r63, r3
+ addi.l r17, 8, r17
+ beq/u r31, r32, tr1
+LOCAL(ia_r4_ld): /* Store r4 and load its address. */
+ movi 3, r30
+ shlli r30, 23, r31
+ and r0, r31, r32
+ andc r0, r31, r0
+ stx.q r17, r63, r4
+ add.l r17, r63, r4
+ addi.l r17, 8, r17
+ beq/u r31, r32, tr1
+LOCAL(ia_r5_ld): /* Store r5 and load its address. */
+ movi 3, r30
+ shlli r30, 20, r31
+ and r0, r31, r32
+ andc r0, r31, r0
+ stx.q r17, r63, r5
+ add.l r17, r63, r5
+ addi.l r17, 8, r17
+ beq/u r31, r32, tr1
+LOCAL(ia_r6_ld): /* Store r6 and load its address. */
+ movi 3, r30
+ shlli r30, 16, r31
+ and r0, r31, r32
+ andc r0, r31, r0
+ stx.q r17, r63, r6
+ add.l r17, r63, r6
+ addi.l r17, 8, r17
+ beq/u r31, r32, tr1
+LOCAL(ia_r7_ld): /* Store r7 and load its address. */
+ movi 3 << 12, r31
+ and r0, r31, r32
+ andc r0, r31, r0
+ stx.q r17, r63, r7
+ add.l r17, r63, r7
+ addi.l r17, 8, r17
+ beq/u r31, r32, tr1
+LOCAL(ia_r8_ld): /* Store r8 and load its address. */
+ movi 3 << 8, r31
+ and r0, r31, r32
+ andc r0, r31, r0
+ stx.q r17, r63, r8
+ add.l r17, r63, r8
+ addi.l r17, 8, r17
+ beq/u r31, r32, tr1
+LOCAL(ia_r9_ld): /* Store r9 and load its address. */
+ stx.q r17, r63, r9
+ add.l r17, r63, r9
+ blink tr0, r63
+LOCAL(ia_r2_push): /* Push r2 onto the stack. */
+ movi 1, r30
+ shlli r30, 29, r31
+ andc r0, r31, r0
+ stx.q r17, r63, r2
+ addi.l r17, 8, r17
+ blink tr1, r63
+LOCAL(ia_r3_push): /* Push r3 onto the stack. */
+ movi 1, r30
+ shlli r30, 26, r31
+ andc r0, r31, r0
+ stx.q r17, r63, r3
+ addi.l r17, 8, r17
+ blink tr1, r63
+LOCAL(ia_r4_push): /* Push r4 onto the stack. */
+ movi 1, r30
+ shlli r30, 23, r31
+ andc r0, r31, r0
+ stx.q r17, r63, r4
+ addi.l r17, 8, r17
+ blink tr1, r63
+LOCAL(ia_r5_push): /* Push r5 onto the stack. */
+ movi 1, r30
+ shlli r30, 20, r31
+ andc r0, r31, r0
+ stx.q r17, r63, r5
+ addi.l r17, 8, r17
+ blink tr1, r63
+LOCAL(ia_r6_push): /* Push r6 onto the stack. */
+ movi 1, r30
+ shlli r30, 16, r31
+ andc r0, r31, r0
+ stx.q r17, r63, r6
+ addi.l r17, 8, r17
+ blink tr1, r63
+LOCAL(ia_r7_push): /* Push r7 onto the stack. */
+ movi 1 << 12, r31
+ andc r0, r31, r0
+ stx.q r17, r63, r7
+ addi.l r17, 8, r17
+ blink tr1, r63
+LOCAL(ia_r8_push): /* Push r8 onto the stack. */
+ movi 1 << 8, r31
+ andc r0, r31, r0
+ stx.q r17, r63, r8
+ addi.l r17, 8, r17
+ blink tr1, r63
+LOCAL(ia_push_seq): /* Push a sequence of registers onto the stack. */
+ andi r0, 7 << 1, r30
+ movi (LOCAL(ia_end_of_push_seq) >> 16) & 65535, r32
+ shlli r30, 2, r31
+ shori LOCAL(ia_end_of_push_seq) & 65535, r32
+ sub.l r32, r31, r33
+ ptabs/l r33, tr2
+ blink tr2, r63
+LOCAL(ia_stack_of_push_seq): /* Beginning of push sequence. */
+ stx.q r17, r63, r3
+ addi.l r17, 8, r17
+ stx.q r17, r63, r4
+ addi.l r17, 8, r17
+ stx.q r17, r63, r5
+ addi.l r17, 8, r17
+ stx.q r17, r63, r6
+ addi.l r17, 8, r17
+ stx.q r17, r63, r7
+ addi.l r17, 8, r17
+ stx.q r17, r63, r8
+ addi.l r17, 8, r17
+LOCAL(ia_r9_push): /* Push r9 onto the stack. */
+ stx.q r17, r63, r9
+LOCAL(ia_return): /* Return. */
+ blink tr0, r63
+LOCAL(ia_end_of_push_seq): /* Label used to compute the first push instruction. */
+#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)
+GLOBAL(GCC_nested_trampoline):
+ .mode SHmedia
+ ptrel/u r63, tr0
+ gettr tr0, r0
+#if __SH5__ == 64
+ ld.q r0, 24, r1
+#else
+ ld.l r0, 24, r1
+#endif
+ ptabs/l r1, tr1
+#if __SH5__ == 64
+ ld.q r0, 32, r1
+#else
+ ld.l r0, 28, r1
+#endif
+ blink tr1, r63
+#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)
+GLOBAL(GCC_push_shmedia_regs):
+ addi.l r15, -14*8, r15
+ fst.d r15, 13*8, dr62
+ fst.d r15, 12*8, dr60
+ fst.d r15, 11*8, dr58
+ fst.d r15, 10*8, dr56
+ fst.d r15, 9*8, dr54
+ fst.d r15, 8*8, dr52
+ fst.d r15, 7*8, dr50
+ fst.d r15, 6*8, dr48
+ fst.d r15, 5*8, dr46
+ fst.d r15, 4*8, dr44
+ fst.d r15, 3*8, dr42
+ fst.d r15, 2*8, dr40
+ fst.d r15, 1*8, dr38
+ fst.d r15, 0*8, dr36
+#endif
+ .global GLOBAL(GCC_push_shmedia_regs_nofpu)
+GLOBAL(GCC_push_shmedia_regs_nofpu):
+ ptabs/l r18, tr0
+ addi.l r15, -27*8, r15
+ gettr tr7, r62
+ gettr tr6, r61
+ gettr tr5, r60
+ st.q r15, 26*8, r62
+ st.q r15, 25*8, r61
+ st.q r15, 24*8, r60
+ st.q r15, 23*8, r59
+ st.q r15, 22*8, r58
+ st.q r15, 21*8, r57
+ st.q r15, 20*8, r56
+ st.q r15, 19*8, r55
+ st.q r15, 18*8, r54
+ st.q r15, 17*8, r53
+ st.q r15, 16*8, r52
+ st.q r15, 15*8, r51
+ st.q r15, 14*8, r50
+ st.q r15, 13*8, r49
+ st.q r15, 12*8, r48
+ st.q r15, 11*8, r47
+ st.q r15, 10*8, r46
+ st.q r15, 9*8, r45
+ st.q r15, 8*8, r44
+ st.q r15, 7*8, r35
+ st.q r15, 6*8, r34
+ st.q r15, 5*8, r33
+ st.q r15, 4*8, r32
+ st.q r15, 3*8, r31
+ st.q r15, 2*8, r30
+ st.q r15, 1*8, r29
+ st.q r15, 0*8, r28
+ blink tr0, r63
+
+#ifndef __SH4_NOFPU__
+ .global GLOBAL(GCC_pop_shmedia_regs)
+GLOBAL(GCC_pop_shmedia_regs):
+ pt .L0, tr1
+ movi 41*8, r0
+ fld.d r15, 40*8, dr62
+ fld.d r15, 39*8, dr60
+ fld.d r15, 38*8, dr58
+ fld.d r15, 37*8, dr56
+ fld.d r15, 36*8, dr54
+ fld.d r15, 35*8, dr52
+ fld.d r15, 34*8, dr50
+ fld.d r15, 33*8, dr48
+ fld.d r15, 32*8, dr46
+ fld.d r15, 31*8, dr44
+ fld.d r15, 30*8, dr42
+ fld.d r15, 29*8, dr40
+ fld.d r15, 28*8, dr38
+ fld.d r15, 27*8, dr36
+ blink tr1, r63
+#endif
+ .global GLOBAL(GCC_pop_shmedia_regs_nofpu)
+GLOBAL(GCC_pop_shmedia_regs_nofpu):
+ movi 27*8, r0
+.L0:
+ ptabs r18, tr0
+ ld.q r15, 26*8, r62
+ ld.q r15, 25*8, r61
+ ld.q r15, 24*8, r60
+ ptabs r62, tr7
+ ptabs r61, tr6
+ ptabs r60, tr5
+ ld.q r15, 23*8, r59
+ ld.q r15, 22*8, r58
+ ld.q r15, 21*8, r57
+ ld.q r15, 20*8, r56
+ ld.q r15, 19*8, r55
+ ld.q r15, 18*8, r54
+ ld.q r15, 17*8, r53
+ ld.q r15, 16*8, r52
+ ld.q r15, 15*8, r51
+ ld.q r15, 14*8, r50
+ ld.q r15, 13*8, r49
+ ld.q r15, 12*8, r48
+ ld.q r15, 11*8, r47
+ ld.q r15, 10*8, r46
+ ld.q r15, 9*8, r45
+ ld.q r15, 8*8, r44
+ ld.q r15, 7*8, r35
+ ld.q r15, 6*8, r34
+ ld.q r15, 5*8, r33
+ ld.q r15, 4*8, r32
+ ld.q r15, 3*8, r31
+ ld.q r15, 2*8, r30
+ ld.q r15, 1*8, r29
+ ld.q r15, 0*8, r28
+ add.l r15, r0, r15
+ blink tr0, r63
+#endif /* __SH5__ == 32 */
+#endif /* L_push_pop_shmedia_regs */