This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mysterious decision in combine


On Mon, Mar 21, 2016 at 02:31:51PM +0100, Dominik Vogt wrote:
> On Thu, Mar 17, 2016 at 01:22:04PM -0700, Richard Henderson wrote:
> > On 03/16/2016 11:35 PM, Dominik Vogt wrote:
> Now combine tries to combine
> 
>   (parallel [
>         (set (reg:SI 64)
>             (and:SI (mem:SI (reg:DI 2 %r2 [ a ]) [1 *a_2(D)+0 S4 A32])
>                 (const_int -65521 [0xffffffffffff000f])))
>         (clobber (reg:CC 33 %cc))
>     ])
> 
> and
> 
>   (set (reg:DI 65)
>         (zero_extend:DI (reg:SI 64)))
> 
> Why does it drop the "parallel" and "clobber" in the combination;
> is there a way to force combine to keep that?

Nope, and it really shouldn't.  Combine tries to keep the clobbers that
were on the insn that is combined into (your zero_extend), but not the
clobbers from all the insns it is integrating.  If the resulting insn
does not match without clobbers, but would match with clobbers (any
clobbers, not just those that were on the original insns) it adds those.

[ The "preferably keep clobbers" makes sure that an "add" stays an "add"
and isn't turned into a "lea".  Many other transforms however do just that
anyway; it would be a nice cleanup if combine could just drop the clobbers
as well. ]

>   Trying 6 -> 7:
>   Failed to match this instruction:
>   (set (reg:DI 65)
>       (and:DI (subreg:DI (mem:SI (reg:DI 2 %r2 [ a ]) [1 *a_2(D)+0 S4 A32]) 0)
>           (const_int 4294901775 [0xffff000f])))
> 
> (Because all "and" instructions on s390 clobber the CC, this
> pattern does not match anything without the clobber.)

As Richard says, the pattern wouldn't match with clobbers included either;
if it did, combine would handle this just as you want.


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]