This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Truncate optimisation question
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: gcc at gcc dot gnu dot org, Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Date: Wed, 04 Dec 2013 10:46:41 +0100
- Subject: Re: Truncate optimisation question
- Authentication-results: sourceware.org; auth=none
- References: <529E1D60 dot 3030902 at arm dot com> <1682705 dot q8GGNTxCXW at polaris> <87iov5cx2i dot fsf at talisman dot default>
> Combine is asking simplify-rtx.c to truncate an addition to QImode
> and simplify-rtx.c is providing a reasonable representation of that.
> It's the representation we should use when matching against .md patterns,
> for example. The problem is that combine doesn't want to keep the
> truncation in this case, but doesn't know that yet.
I disagree, I don't find it reasonable to turn an addition in SImode into an
addition in QImode when the machine supports the former but not the latter.
I agree that it may help in some contexts, but then the transformation should
be restricted to these contexts.
> Right, but the only complaint I know of is about its effect on combine.
> And my point is that that complaint isn't about combine failing to combine
> instructions per se. It's that combine is failing to remove a redundant
> operation. With the right input, the same rtl sequence could conceivably
> be generated on a CISC target like x86_64, since it defines all the required
> patterns (SImode addition, QI->SI zero extension, SImode comparison). It
> could also occur with a sequence that starts out as a QImode addition. So
> trying to make the simplification depend on CISCness seems like papering
> over the problem.
The problem is that this changes the combinations tried by the combiner in a
way that is adverse to most RISC targets. Sure, we could change all the
affected back-ends but what's the point exactly? What do we gain here?
Look for example at comment #4 in PR rtl-optimization/58295.
> If you think the patch was wrong or if you feel the fallout is too great
> then please feel free to revert it.
I think that the fallout is too great for RISC targets, yes, so I'm trying to
find a reasonable compromise.
--
Eric Botcazou