> -----Original Message-----
> From: Eric Botcazou [mailto:[email protected]]
> Sent: 17 January 2014 16:23
> To: Paulo Matos
> Cc: [email protected]
> Subject: Re: Avoiding paradoxical subregs
>
> > I can use canonicalize_comparison like s390 to remove the subreg, however
> > the question then becomes about how to avoid this in general. We cannot
> > allow a zero_extend to become a paradoxical subreg and then have the subreg
> > discarded. Most of our instructions are vector instructions which will
> > change the remainder of the register.
> >
> > I have defined WORD_REGISTER_OPERATIONS and CANNOT_CHANGE_MODE_CLASS(from,
> > to, class) and set it to true if GET_MODE_SIZE (from) < GET_MODE_SIZE (to)
> > but it didn't help.
> >
> > Any suggestions for a generic solution?
>
> What kind of generic solution? Eliminating paradoxical subregs altogether?
> That's very likely not doable if you define WORD_REGISTER_OPERATIONS anyway.
> You need to pinpoint where things start to go wrong, for example in combine.
>
I am not implying that this is a GCC bug, unless you think
WORD_REGISTER_OPERATIONS should have avoided the creation of such paradoxical
subreg. What I was looking after was for a generic solution on my backend that
either eliminates the use of paradoxical subregs or forces reload the transform
(subreg:m (reg:n K)), where subreg is paradoxical, into a zero_extend.
I mentioned a generic one because the only solution I have is for comparison
instructions only:
canonicalize_comparison (int *, rtx *op0, rtx *,
bool op0_preserve_value)
{
if (op0_preserve_value)
return;
/* Remove paradoxical subregs. */
if (GET_CODE (*op0) == SUBREG)
{
rtx inner = SUBREG_REG (*op0);
if (GET_MODE_SIZE (GET_MODE (inner)) < GET_MODE_SIZE (GET_MODE (*op0)))
*op0 = simplify_gen_unary (ZERO_EXTEND, GET_MODE (*op0), inner,
GET_MODE (inner));
}
}
Another more generic solution would be to write my own register_operand
predicate that excludes paradoxical subregs but I am not sure what kind of
pandora's box I am opening by doing that.
--
Paulo Matos