Nick Clifton wrote:
I am not sure how this should be fixed however. Should the
functions in lib1funcs-02-4-200.asm be protected by another #ifdef
so that they are not built for this target ? Or maybe the rules in
t-sh need to be updated to include an architecture selection switch
? (eg -m2a-single ?)
I have a patch for it, but due to problems with our hardware, newlib, and
issues with the way the linux libgcc is built, I have not been able to
test the
patch satisfactorily.
2006-05-11 J"orn Rennecke <[EMAIL PROTECTED]>
* config/sh/linux.h (SH_DIVSI3_1_LIBFUNC): Define.
* config/sh/sh.h (SH_DIVSI3_1_LIBFUNC): Define.
(OVERRIDE_OPTIONS): Make SHCOMPACT default to SH_DIV_CALL_TABLE.
Use SH_DIVSI3_1_LIBFUNC for SH5 with SH_DIV_CALL_TABLE.
* config/sh/lib1funcs-Os-4-200.asm (udivsi3_i4i, sdivsi3_i4i): Don't
provide for __SH5__.
* config/sh/sh.md (udivsi3): Use __udivsi3 for SH5 with
SH_DIV_CALL_TABLE.
Index: config/sh/linux.h
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/sh/linux.h (revision 113499) -L
config/sh/linux.h (working copy) config/sh/.svn/text-base/linux.h.svn-base
config/sh/linux.h
--- config/sh/linux.h (revision 113499)
+++ config/sh/linux.h (working copy)
@@ -136,3 +136,5 @@ Boston, MA 02110-1301, USA. */
#define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL2
#undef SH_DIV_STR_FOR_SIZE
#define SH_DIV_STR_FOR_SIZE "call2"
+#undef SH_DIVSI3_1_LIBFUNC
+#define SH_DIVSI3_1_LIBFUNC "__sdivsi3"
Index: config/sh/sh.h
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/sh/sh.h (revision 113499) -L
config/sh/sh.h (working copy) config/sh/.svn/text-base/sh.h.svn-base
config/sh/sh.h
--- config/sh/sh.h (revision 113499)
+++ config/sh/sh.h (working copy)
@@ -454,6 +454,9 @@ do { \
#ifndef SH_DIV_STR_FOR_SIZE
#define SH_DIV_STR_FOR_SIZE "call"
#endif
+#ifndef SH_DIVSI3_1_LIBFUNC
+#define SH_DIVSI3_1_LIBFUNC "__sdivsi3_1"
+#endif
#define DRIVER_SELF_SPECS "%{m2a:%{ml:%eSH2a does not support little-endian}}"
#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
@@ -640,8 +643,11 @@ do {
\
when some of the code is compiled for size, and some for \
speed. */ \
\
- /* SH4 tends to emphasize speed. */ \
- if (TARGET_HARD_SH4) \
+ /* SH4 tends to emphasize speed. \
+ SHCOMPACT uses sdvisi3_1 / udivsi3 implemented in SHMEDIA, \
+ which are fast, clobber only T / PR of the SHCOMPACT visible \
+ registers, and are still relatively compact. */ \
+ if (TARGET_HARD_SH4 || TARGET_SHCOMPACT) \
sh_div_strategy = SH_DIV_CALL_TABLE; \
/* These have their own way of doing things. */ \
else if (TARGET_SH2A) \
@@ -662,10 +668,10 @@ do {
\
; /* User supplied - leave it alone. */ \
else if (TARGET_DIVIDE_CALL_FP) \
sh_divsi3_libfunc = "__sdivsi3_i4";
\
+ else if (TARGET_SH5) \
+ sh_divsi3_libfunc = SH_DIVSI3_1_LIBFUNC; \
else if (TARGET_DIVIDE_CALL_TABLE) \
sh_divsi3_libfunc = "__sdivsi3_i4i"; \
- else if (TARGET_SH5) \
- sh_divsi3_libfunc = "__sdivsi3_1"; \
else \
sh_divsi3_libfunc = "__sdivsi3"; \
if (TARGET_FMOVD) \
Index: config/sh/lib1funcs-Os-4-200.asm
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/sh/lib1funcs-Os-4-200.asm (revision
113499) -L config/sh/lib1funcs-Os-4-200.asm (working copy)
config/sh/.svn/text-base/lib1funcs-Os-4-200.asm.svn-base
config/sh/lib1funcs-Os-4-200.asm
--- config/sh/lib1funcs-Os-4-200.asm (revision 113499)
+++ config/sh/lib1funcs-Os-4-200.asm (working copy)
@@ -37,7 +37,7 @@ Boston, MA 02110-1301, USA. */
dividend < 2G: 48 cycles
dividend >= 2G: divisor != 1: 54 cycles
dividend >= 2G, divisor == 1: 22 cycles */
-#if defined (__SH_FPU_DOUBLE__) || defined (__SH4_SINGLE_ONLY__)
+#if (!defined(__SH5__) && defined (__SH_FPU_DOUBLE__)) || defined
(__SH4_SINGLE_ONLY__)
!! args in r4 and r5, result in r0, clobber r1
.global GLOBAL(udivsi3_i4i)
@@ -119,7 +119,7 @@ L1:
.double 4294967296
ENDFUNC(GLOBAL(udivsi3_i4i))
-#elif !defined (__sh1__) /* !__SH_FPU_DOUBLE__ */
+#elif !defined (__sh1__) && !defined (__SH5__) /* !__SH_FPU_DOUBLE__ */
#if 0
/* With 36 bytes, the following would probably be the most compact
@@ -267,7 +267,7 @@ LOCAL(negate_result):
#endif /* L_udivsi3_i4i */
#ifdef L_sdivsi3_i4i
-#if defined (__SH_FPU_DOUBLE__) || defined (__SH4_SINGLE_ONLY__)
+#if (!defined(__SH5__) && defined (__SH_FPU_DOUBLE__)) || defined
(__SH4_SINGLE_ONLY__)
/* 48 bytes, 45 cycles on sh4-200 */
!! args in r4 and r5, result in r0, clobber r1
Index: config/sh/sh.md
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/sh/sh.md (revision 113499) -L
config/sh/sh.md (working copy) config/sh/.svn/text-base/sh.md.svn-base
config/sh/sh.md
--- config/sh/sh.md (revision 113499)
+++ config/sh/sh.md (working copy)
@@ -1829,7 +1829,10 @@ (define_expand "udivsi3"
/* Emit the move of the address to a pseudo outside of the libcall. */
if (TARGET_DIVIDE_CALL_TABLE)
{
- function_symbol (operands[3], \"__udivsi3_i4i\", SFUNC_GOT);
+ if (TARGET_SH5)
+ function_symbol (operands[3], \"__udivsi3\", SFUNC_GOT);
+ else
+ function_symbol (operands[3], \"__udivsi3_i4i\", SFUNC_GOT);
last = gen_udivsi3_i4_int (operands[0], operands[3]);
}
else if (TARGET_DIVIDE_CALL_FP)