aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Endo <olegendo@gcc.gnu.org>2013-03-06 00:41:25 +0000
committerOleg Endo <olegendo@gcc.gnu.org>2013-03-06 00:41:25 +0000
commit8f6d1c8601131f3ebdab1629ff923fa03ceb7ea5 (patch)
tree35b525cb1796949ce2d7f1ab6707d25bbbf5116e
parent018fa87af9dc9e72fe62716403bc76fa87ed18ef (diff)
downloadgcc-8f6d1c8601131f3ebdab1629ff923fa03ceb7ea5.zip
gcc-8f6d1c8601131f3ebdab1629ff923fa03ceb7ea5.tar.gz
gcc-8f6d1c8601131f3ebdab1629ff923fa03ceb7ea5.tar.bz2
re PR target/56529 ([SH] Calls to __sdivsi3_i4i and __udivsi3_i4i are generated on SH2)
PR target/56529 * config/sh/sh.c (sh_option_override): Check for TARGET_DYNSHIFT instead of TARGET_SH2 for call-table case. Do not set sh_div_strategy to SH_DIV_CALL_TABLE for TARGET_SH2. * config.gcc (sh_multilibs): Add m2 and m2a to sh*-*-linux* multilib list. * doc/invoke.texi (SH options): Document mdiv= call-div1, call-fp, call-table options. PR target/56529 * config/sh/lib1funcs.S (udivsi3_i4i, sdivsi3_i4i): Add __SH2A__ to inclusion list. From-SVN: r196484
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config.gcc2
-rw-r--r--gcc/config/sh/sh.c4
-rw-r--r--gcc/doc/invoke.texi34
-rw-r--r--libgcc/ChangeLog6
-rw-r--r--libgcc/config/sh/lib1funcs.S4
6 files changed, 53 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a0c6c3e..f8c5f95 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2013-03-06 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/56529
+ * config/sh/sh.c (sh_option_override): Check for TARGET_DYNSHIFT
+ instead of TARGET_SH2 for call-table case. Do not set sh_div_strategy
+ to SH_DIV_CALL_TABLE for TARGET_SH2.
+ * config.gcc (sh_multilibs): Add m2 and m2a to sh*-*-linux* multilib
+ list.
+ * doc/invoke.texi (SH options): Document mdiv= call-div1, call-fp,
+ call-table options.
+
2013-03-05 Sterling Augustine <saugustine@google.com>
Cary Coutant <ccoutant@google.com>
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 9255d11..64302a7 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2371,7 +2371,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;;
sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
- sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;;
+ sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;;
sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;;
*) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
esac
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index be49e46..dcbd932 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -820,7 +820,7 @@ sh_option_override (void)
|| (TARGET_HARD_SH4 && TARGET_SH2E)
|| (TARGET_SHCOMPACT && TARGET_FPU_ANY)))
sh_div_strategy = SH_DIV_CALL_FP;
- else if (! strcmp (sh_div_str, "call-table") && TARGET_SH2)
+ else if (! strcmp (sh_div_str, "call-table") && TARGET_DYNSHIFT)
sh_div_strategy = SH_DIV_CALL_TABLE;
else
/* Pick one that makes most sense for the target in general.
@@ -840,8 +840,6 @@ sh_option_override (void)
sh_div_strategy = SH_DIV_CALL_FP;
/* SH1 .. SH3 cores often go into small-footprint systems, so
default to the smallest implementation available. */
- else if (TARGET_SH2) /* ??? EXPERIMENTAL */
- sh_div_strategy = SH_DIV_CALL_TABLE;
else
sh_div_strategy = SH_DIV_CALL_DIV1;
}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a2a4066..11c34d8 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -18749,8 +18749,8 @@ Set the cost to assume for a multiply insn.
@item -mdiv=@var{strategy}
@opindex mdiv=@var{strategy}
-Set the division strategy to use for SHmedia code. @var{strategy} must be
-one of:
+Set the division strategy to be used for integer division operations.
+For SHmedia @var{strategy} can be one of:
@table @samp
@@ -18808,6 +18808,36 @@ a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely.
@end table
+For targets other than SHmedia @var{strategy} can be one of:
+
+@table @samp
+
+@item call-div1
+Calls a library function that uses the single-step division instruction
+@code{div1} to perform the operation. Division by zero calculates an
+unspecified result and does not trap. This is the default except for SH4,
+SH2A and SHcompact.
+
+@item call-fp
+Calls a library function that performs the operation in double precision
+floating point. Division by zero causes a floating-point exception. This is
+the default for SHcompact with FPU. Specifying this for targets that do not
+have a double precision FPU will default to @code{call-div1}.
+
+@item call-table
+Calls a library function that uses a lookup table for small divisors and
+the @code{div1} instruction with case distinction for larger divisors. Division
+by zero calculates an unspecified result and does not trap. This is the default
+for SH4. Specifying this for targets that do not have dynamic shift
+instructions will default to @code{call-div1}.
+
+@end table
+
+When a division strategy has not been specified the default strategy will be
+selected based on the current target. For SH2A the default strategy is to
+use the @code{divs} and @code{divu} instructions instead of library function
+calls.
+
@item -maccumulate-outgoing-args
@opindex maccumulate-outgoing-args
Reserve space once for outgoing arguments in the function prologue rather
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index b0c7aaf..8482f1f 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-06 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/56529
+ * config/sh/lib1funcs.S (udivsi3_i4i, sdivsi3_i4i): Add __SH2A__ to
+ inclusion list.
+
2013-03-04 Edgar E. Iglesias <edgar.iglesias@gmail.com>
* config/microblaze/crti.S: Setup stack protection at entry
diff --git a/libgcc/config/sh/lib1funcs.S b/libgcc/config/sh/lib1funcs.S
index 86a500f..5625719 100644
--- a/libgcc/config/sh/lib1funcs.S
+++ b/libgcc/config/sh/lib1funcs.S
@@ -3288,8 +3288,8 @@ GLOBAL(div_table):
.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. */
+#elif defined (__SH2A__) || defined (__SH3__) || defined (__SH3E__) || defined (__SH4__) || defined (__SH4_SINGLE__) || defined (__SH4_SINGLE_ONLY__) || defined (__SH4_NOFPU__)
+/* This code uses 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, and