RFC [2/3] divmod transform v2 - override expand_divmod_libfunc for ARM port

Prathamesh Kulkarni prathamesh.kulkarni@linaro.org
Thu Oct 27 13:31:00 GMT 2016

On 26 October 2016 at 18:51, Kyrill Tkachov <kyrylo.tkachov@foss.arm.com> wrote:
> On 16/10/16 07:00, Prathamesh Kulkarni wrote:
>> Hi,
>> This patch overrides expand_divmod_libfunc hook for ARM port.
>> I separated the SImode tests into separate file from DImode tests
>> because certain arm configs (cortex-15) have hardware div insn for
>> SImode but not for DImode, and for that config we want SImode tests to
>> be disabled but not DImode tests. The patch therefore has two
>> target-effective checks: divmod and divmod_simode.
>> Cross-tested on arm*-*-*.
>> OK to commit ?
> Looks ok to me, the implementation of the hook is straightforward though
> I have a question.
> arm_expand_divmod_libfunc is not supposed to ever be called for SImode
> It asserts it rather than just failing the expansion in some way.
> How does the midend know not to call TARGET_EXPAND_DIVMOD_LIBFUNC in that
> case, does it
> just check if the relevant sdiv optab is not available?
Yes. The divmod transform isn't enabled if target supports hardware
div in the same
or wider mode even if divmod libfunc is available for the given mode.
> If so, this is ok for trunk assuming a bootstrap and test run on
> arm-none-linux-gnueabihf
> shows no issues. Would be good to try one for --with-cpu=cortex-a15 and one
> with a !TARGET_IDIV
> target, say --with-cpu=cortex-a9.
Bootstrap+tested on arm-linux-gnueabihf --with-cpu=cortex-a15 and
Also cross-tested on arm*-*-*.
OK to commit ?

> Sorry for the delay.
> Thanks,
> Kyrill
>> Thanks,
>> Prathamesh

More information about the Gcc-patches mailing list