[PATCH][1/3][ARM] Keep ctz expressions together until after reload

Ramana Radhakrishnan ramana.gcc@googlemail.com
Mon Jun 6 14:49:00 GMT 2016


On Thu, May 26, 2016 at 10:52 AM, Kyrill Tkachov
<kyrylo.tkachov@foss.arm.com> wrote:
> Hi all,
>
> On arm we don't have a dedicated instruction that corresponds to a CTZ rtx
> but we synthesise it
> with an RBIT instruction followed by a CLZ. This is currently done at expand
> time.
> However, I'd like to push that step until after reload and keep the CTZ rtx
> as a single whole in
> the early RTL optimisers.  This better expresses the semantics of the
> operation as a whole, since
> the RBIT operation is represented as an UNSPEC anyway and so will not see
> the benefits of combine,
> and a CTZ-specific optimisation that is implemented in patch 3/3 of this
> series won't be triggered
> if the expression is broken up into an UNSPEC and a CLZ.
>
> Therefore this patch changes the expander to expand to a CTZ rtx and split
> it after reload into
> an RBIT + CLZ to allow sched2 to schedule them apart if it deems necessary.
> This patch enables the optimisation in patch 3/3 where the appropriate test
> is added.
>
> Bootstrapped and tested on arm-none-linux-gnueabihf.
>
> Ok for trunk?
>
> Thanks,
> Kyrill
>
> 2016-05-26  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     PR middle-end/37780
>     * config/arm/arm.md (ctzsi2): Convert to define_insn_and_split.

OK.

Ramana



More information about the Gcc-patches mailing list