* [PATCH] arm: Fix ICE on glibc compilation after my DIVMOD optimization [PR97322]
@ 2020-10-08 9:19 Jakub Jelinek
2020-10-08 9:23 ` Ramana Radhakrishnan
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2020-10-08 9:19 UTC (permalink / raw)
To: Richard Earnshaw, Ramana Radhakrishnan, Kyrylo Tkachov; +Cc: gcc-patches
Hi!
The arm target hook for divmod wasn't prepared to handle constants passed to
the function.
Fixed thusly, bootstrapped/regtested on armv7hl-linux-gnueabi, ok for trunk?
2020-10-08 Jakub Jelinek <jakub@redhat.com>
PR target/97322
* config/arm/arm.c (arm_expand_divmod_libfunc): Pass mode instead of
GET_MODE (op0) or GET_MODE (op1) to emit_library_call_value.
* gcc.dg/pr97322.c: New test.
--- gcc/config/arm/arm.c.jj 2020-10-07 10:47:46.892985596 +0200
+++ gcc/config/arm/arm.c 2020-10-07 20:19:25.524367665 +0200
@@ -33275,9 +33275,7 @@ arm_expand_divmod_libfunc (rtx libfunc,
= smallest_int_mode_for_size (2 * GET_MODE_BITSIZE (mode));
rtx libval = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
- libval_mode,
- op0, GET_MODE (op0),
- op1, GET_MODE (op1));
+ libval_mode, op0, mode, op1, mode);
rtx quotient = simplify_gen_subreg (mode, libval, libval_mode, 0);
rtx remainder = simplify_gen_subreg (mode, libval, libval_mode,
--- gcc/testsuite/gcc.dg/pr97322.c.jj 2020-10-07 20:19:54.071961807 +0200
+++ gcc/testsuite/gcc.dg/pr97322.c 2020-10-07 20:19:16.897490309 +0200
@@ -0,0 +1,17 @@
+/* PR target/97322 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (unsigned long long x, unsigned long long *y)
+{
+ y[0] = x / 10;
+ y[1] = x % 10;
+}
+
+void
+bar (unsigned int x, unsigned int *y)
+{
+ y[0] = x / 10;
+ y[1] = x % 10;
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] arm: Fix ICE on glibc compilation after my DIVMOD optimization [PR97322]
2020-10-08 9:19 [PATCH] arm: Fix ICE on glibc compilation after my DIVMOD optimization [PR97322] Jakub Jelinek
@ 2020-10-08 9:23 ` Ramana Radhakrishnan
0 siblings, 0 replies; 2+ messages in thread
From: Ramana Radhakrishnan @ 2020-10-08 9:23 UTC (permalink / raw)
To: Jakub Jelinek
Cc: Richard Earnshaw, Ramana Radhakrishnan, Kyrylo Tkachov, gcc-patches
On Thu, Oct 8, 2020 at 10:22 AM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi!
>
> The arm target hook for divmod wasn't prepared to handle constants passed to
> the function.
>
> Fixed thusly, bootstrapped/regtested on armv7hl-linux-gnueabi, ok for trunk?
>
> 2020-10-08 Jakub Jelinek <jakub@redhat.com>
>
> PR target/97322
> * config/arm/arm.c (arm_expand_divmod_libfunc): Pass mode instead of
> GET_MODE (op0) or GET_MODE (op1) to emit_library_call_value.
>
> * gcc.dg/pr97322.c: New test.
Ok.
Ramana
>
> --- gcc/config/arm/arm.c.jj 2020-10-07 10:47:46.892985596 +0200
> +++ gcc/config/arm/arm.c 2020-10-07 20:19:25.524367665 +0200
> @@ -33275,9 +33275,7 @@ arm_expand_divmod_libfunc (rtx libfunc,
> = smallest_int_mode_for_size (2 * GET_MODE_BITSIZE (mode));
>
> rtx libval = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
> - libval_mode,
> - op0, GET_MODE (op0),
> - op1, GET_MODE (op1));
> + libval_mode, op0, mode, op1, mode);
>
> rtx quotient = simplify_gen_subreg (mode, libval, libval_mode, 0);
> rtx remainder = simplify_gen_subreg (mode, libval, libval_mode,
> --- gcc/testsuite/gcc.dg/pr97322.c.jj 2020-10-07 20:19:54.071961807 +0200
> +++ gcc/testsuite/gcc.dg/pr97322.c 2020-10-07 20:19:16.897490309 +0200
> @@ -0,0 +1,17 @@
> +/* PR target/97322 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2" } */
> +
> +void
> +foo (unsigned long long x, unsigned long long *y)
> +{
> + y[0] = x / 10;
> + y[1] = x % 10;
> +}
> +
> +void
> +bar (unsigned int x, unsigned int *y)
> +{
> + y[0] = x / 10;
> + y[1] = x % 10;
> +}
>
> Jakub
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-08 9:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08 9:19 [PATCH] arm: Fix ICE on glibc compilation after my DIVMOD optimization [PR97322] Jakub Jelinek
2020-10-08 9:23 ` Ramana Radhakrishnan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).