@@ -1965,4 +1965,31 @@ default_optab_supported_p (int, machine_mode,
machine_mode, optimization_type)
return true;
}
+void
+default_expand_divmod_libfunc (bool unsignedp, machine_mode mode,
+ rtx op0, rtx op1,
+ rtx *quot_p, rtx *rem_p)
functions need a comment.
ISTR it was suggested that ARM change to libgcc2.c__udivmoddi4 style? In that
case we could avoid the target hook.
+ /* If target overrides expand_divmod_libfunc hook
+ then perform divmod by generating call to the target-specifc divmod
libfunc. */
+ if (targetm.expand_divmod_libfunc != default_expand_divmod_libfunc)
+ return true;
+
+ /* Fall back to using libgcc2.c:__udivmoddi4. */
+ return (mode == DImode && unsignedp);
I don't understand this - we know optab_libfunc returns non-NULL for 'mode'
but still restrict this to DImode && unsigned? Also if
targetm.expand_divmod_libfunc
is not the default we expect the target to handle all modes?
That said - I expected the above piece to be simply a 'return true;' ;)
Usually we use some can_expand_XXX helper in optabs.c to query if the target