Right way to represent flag-setting arithmetic instructions in MD files

Kyrill Tkachov kyrylo.tkachov@foss.arm.com
Fri Mar 10 10:30:00 GMT 2017


<resending due to mailing list failure>

On 10/03/17 10:23, Eric Botcazou wrote:
>> My understanding was that the order of the two in this pattern here doesn't
>> matter because there is an implicit PARALLEL around them, but I found that
>> the compare-elimination pass (compare-elim.c) assumes that the COMPARE set
>> must be in the second position for it to do the transformations it wants.
> Why do you want to use the compare-elimination pass exactly if the flags are
> exposed before reload, as is the case on Aarch64 I think?  The combiner is
> supposed to do the same job instead for these targets.
>

I'm trying to improve the cases where the result of the arithmetic
operation is used in multiple places besides the comparison.
For example:
         add     w0, w0, w1
         add     w1, w0, 2
         cmp     w0, 0

Combine will not attempt to merge the first ADD and CMP because W0 is used
in the second ADD. The compare-elimination pass so far looks like a far simpler
place to implement this transformation than combine.

Thanks,
Kyrill



More information about the Gcc mailing list