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.
= 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,
--- /dev/null
+/* 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;
+}