[PATCH][combine] PR rtl-optimization/68651 Try changing rtx from (r + r) to (r << 1) to aid recognition

Bernd Schmidt bschmidt@redhat.com
Wed Dec 16 12:18:00 GMT 2015


On 12/15/2015 05:21 PM, Kyrill Tkachov wrote:
> Then for the shift pattern in the MD file we'd have to dynamically
> select the scheduling type depending on whether or not the shift
> amount is 1 and the costs line up?

Yes. This isn't unusual, take a look at i386.md where you have a lot of 
switches on attr type to decide which string to print.

> The price we pay when trying these substitutions is an iteration over
>  the rtx with FOR_EACH_SUBRTX_PTR. recog gets called only if that
> iteration actually performed a substitution of x + x into x << 1. Is
> that too high a price to pay? (I'm not familiar with the performance
>  characteristics of the FOR_EACH_SUBRTX machinery)

It depends on how many of these transforms we are going to try; it also 
feels very hackish, trying to work around the core design of the 
combiner. IMO it would be better for machine descriptions to work with 
the pass rather than against it.

If you can somehow arrange for the (plus x x) to be turned into a shift 
while substituting that might be yet another approach to try.


Bernd



More information about the Gcc-patches mailing list