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

--- Comment #9 from Wilco <wdijkstr at arm dot com> ---
(In reply to Andrew Pinski from comment #8)
> (In reply to Wilco from comment #7)
> > > > I think the problem is the constraints on *add<mode>3_pluslong allows 
> > > > all immediates.
> > > 
> > > I'm not sure what you mean here - there are 4 constraints that should all 
> > > be
> > > true before the instruction is matched: GPI, aarch64_pluslong_immediate, 
> > > 'i'
> > > and "!aarch64_plus_operand (operands[2], VOIDmode) && !aarch64_move_imm
> > > (INTVAL (operands[2]), <MODE>mode)".
> > 
> > It appears reload creates the instruction without doing the last check -
> > this is incorrect as it might be an instruction that is disabled (eg. not
> > supported by the selected architecture)...
> > 
> > However a trivial workaround is to always expand the pattern by changing the
> > "&& true" into "true". I'll post a patch.
> 
> plus patterns are special to reload (this is documented IIRC). So I think
> there should be only one plus pattern for DI mode.

I see, that would explain why it doesn't check the condition. Merging into a
single instruction should be possible. That still wouldn't check the condition
of course, so we'd need to split anything that isn't a single add (given this
odd reload case is so rare, it's not an issue).

There is also a secondary issue in that the large number of reloads in the
example generate quite inefficient code. With a few tweaks I got a 5% reduction
in instruction count.

Reply via email to