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: Better info for combine results in worse code generated


On Mon, Jun 01, 2015 at 11:33:18AM +0930, Alan Modra wrote:
> Unifying andsi_mask with anddi_mask, and the fact that constraints for
> const_int see VOIDmode rather than the operand mode is why we get
> rldicr rather than rlwinm.  Easily fixed by separating the si/di
> patterns, and with a little more work I may even be able to keep them
> together.

Maybe just swapping T to be before S will do what you want, already?

> In and<mode>3 expander I think you want the following since
> and64_2_operand covers the extra double-rotate cases, not all DImode.
> 
> -  if ((<MODE>mode == DImode && !and64_2_operand (operands[2], <MODE>mode))
> -      || (<MODE>mode != DImode && !and_operand (operands[2], <MODE>mode)))
> +  if (!and_operand (operands[2], <MODE>mode)
> +      && (<MODE>mode != DImode || !and64_2_operand (operands[2], <MODE>mode)))

and64_2_operand includes all of and_operand.  I agree it is a mess.

> In and<mode>3_imm_mask_dot and and<mode>3_imm_mask_dot2.  Typo?
> -   && any_mask_operand (operands[2], <MODE>mode)"
> +   && !any_mask_operand (operands[2], <MODE>mode)"

Thinko; that whole line should just be removed.  We prefer e.g. "rlwinm"
over "andi.", but "andi." over "rlwinm.".  I'll do a patch.

> Seems to
> me we should omit !logical_const_operand from those insn predicates.

I tried to have no patterns overlap (where it matters at all); this helps
preserve your sanity if you try to move patterns around in the .md files
(first match wins).

> > I don't think it is a good idea to optimise code based on assumptions
> > of what SImode SETs will do to the dest seen as DImode, without making
> > those assumptions explicit in the RTL.
> 
> I agree.

Ah, good to hear.

> Do you intend to

I don't have firm, short-term plans to remove ancient design, no.

> get rid of WORD_REGISTER_OPERATIONS,

rs6000 should not define it.  What e.g. does it mean for mullw?  Or,
worse, mulhw?  Pretty much anything with "w" in its name is problematic.

[ What does this macro mean for rotates or right shifts at all?  The docs
don't say. ]

> POINTERS_EXTEND_UNSIGNED,

Not related to this.

> PUSH_ROUNDING,

I would love to see this disappear.  But, not related, for rs6000
anyway.

> SHORT_IMMEDIATES_SIGN_EXTEND,

Not sure about this one.

> and LOAD_EXTEND_OP?  ;-)

With this macro you can just "opt out" for the hard cases.


In any case: I am working on a patch that unifies all rotate-and-mask
patterns, fixes the rtx_cost for those, and gets rid of 2rld completely.
If you really want to disallow most SImode ANDs, it won't be hard to
add that, much easier than with the current code.


Segher


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