https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69176

--- Comment #12 from Wilco <wdijkstr at arm dot com> ---
(In reply to Wilco from comment #11)

> With your patch expand always emits add instructions with complex immediates
> which then can't be optimized.

OK, so I can change your patch do the right thing with 2 minor changes:

* expand add<mode>3 should use aarch64_plus_immediate
* the peepholes should have aarch64_move_imm (INTVAL (operands[2]), <MODE>mode)
as the condition (we want to expand into add+add rather than mov+movk+add...).

With this the codesize of the example reduces by an extra 8% :-)

The only remaining question I had whether it would be possible to use peephole
expansions rather than the late splits. If they are evaluated in order then if
the first doesn't match or if there is no temporary, the 2nd one will split
into 2 adds.

Reply via email to