This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] combine.c if_then_else_cond() subreg modes
- To: DJ Delorie <dj at redhat dot com>
- Subject: Re: [patch] combine.c if_then_else_cond() subreg modes
- From: Jeffrey A Law <law at redhat dot com>
- Date: Tue, 09 Jan 2001 21:11:44 -0700
- cc: gcc-patches at gcc dot gnu dot org
- Reply-To: law at redhat dot com
In message <200101060215.VAA19089@greed.delorie.com>you write:
>
> In emit-rtl.c, the comment for operand_subword says:
>
> MODE is the mode of OP in case it is a CONST_INT.
Right.
> But, in if_then_else_cond, when passed (subreg:SI (reg:DI 42) 1), we
> pass SImode as the "mode". However, shouldn't we pass the mode of the
> inner register (DImode)? Because, if_then_else_cond, if it returns a
> const_int into true0 or false0, will return one sized for the reg's
> mode, not the subreg's mode.
I don't think so.
What we're trying to do in this code is narrow the the true/false values,
so we want to use "mode" as-is instead of the mode of the inner part of
the subreg. Why? Because "mode" will always be smaller due to this
condition:
/* If X is a normal SUBREG with both inner and outer modes integral,
we can narrow both the true and false values of the inner expression,
if there is a condition. */
else if (code == SUBREG && GET_MODE_CLASS (mode) == MODE_INT
&& GET_MODE_CLASS (GET_MODE (SUBREG_REG (x))) == MODE_INT
&& GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))
&& 0 != (cond0 = if_then_else_cond (SUBREG_REG (x),
&true0, &false0)))
Note the GET_MODE_CLASS ... test.
Presumably you're looking at this code for a reason :-) Can you give more
details about what's going wrong?
jeff