> I guess it can be done. Currently the expander goes:
>
> --cut here--
> /* Check if optab_handler exists for divmod_optab for given mode. */
> if (optab_handler (tab, mode) != CODE_FOR_nothing)
> {
> quotient = gen_reg_rtx (mode);
> remainder = gen_reg_rtx (mode);
> expand_twoval_binop (tab, op0, op1, quotient, remainder, unsignedp);
> }
>
> /* Generate call to divmod libfunc if it exists. */
> else if ((libfunc = optab_libfunc (tab, mode)) != NULL_RTX)
> targetm.expand_divmod_libfunc (libfunc, mode, op0, op1,
> "ient, &remainder);
>
> else
> gcc_unreachable ();
> --cut here--
>
> so, by declaring divmod libfunc, the target also has to provide target hook.
Right, that's why I also suggested a default associated target hook.
--
Eric Botcazou