aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-10-08 11:56:15 +0200
committerJakub Jelinek <jakub@redhat.com>2020-10-08 11:56:15 +0200
commitf18eeb6b958acd5e1590ca4a73231486b749be9b (patch)
treea56f6045df443a81a7ef453af61e6619f02cf133
parent9489806fa258b90b02b55804e61e9eb748724ce7 (diff)
downloadgcc-f18eeb6b958acd5e1590ca4a73231486b749be9b.zip
gcc-f18eeb6b958acd5e1590ca4a73231486b749be9b.tar.gz
gcc-f18eeb6b958acd5e1590ca4a73231486b749be9b.tar.bz2
arm: Fix ICE on glibc compilation after my DIVMOD optimization [PR97322]
The arm target hook for divmod wasn't prepared to handle constants passed to the function. 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.
-rw-r--r--gcc/config/arm/arm.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr97322.c17
2 files changed, 18 insertions, 3 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 5fdc143..5d9c995 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -33275,9 +33275,7 @@ arm_expand_divmod_libfunc (rtx libfunc, machine_mode mode,
= 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,
diff --git a/gcc/testsuite/gcc.dg/pr97322.c b/gcc/testsuite/gcc.dg/pr97322.c
new file mode 100644
index 0000000..f253c0d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97322.c
@@ -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;
+}