This is the mail archive of the
mailing list for the GCC project.
Re: Question about subregs on constants
- From: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 30 Oct 2015 16:32:56 +0100
- Subject: Re: Question about subregs on constants
- Authentication-results: sourceware.org; auth=none
- References: <562FAA97 dot 6040205 at linux dot vnet dot ibm dot com> <20151027170949 dot GJ478 at tucnak dot redhat dot com>
On 10/27/2015 06:09 PM, Jakub Jelinek wrote:
> On Tue, Oct 27, 2015 at 05:47:19PM +0100, Andreas Krebbel wrote:
>> what does speak against folding SUBREGs on constants in fold_rtx?
>> CSE does refuse to propagate constants into subreg expressions probably because fold_rtx does not
>> handle it - and in fact a subreg on a constant does not seem to be defined. I'm wondering why this
>> is the case? What's the problem with simplifying subregs on constants?
>> If there is a good reason not to fold things like:
>> (subreg:DI (const_int 1 [0x1]) 0)
> This is invalid RTL, so it shouldn't be generated at all.
> The problem is that CONST_INT has VOIDmode, and a valid SUBREG needs both
> inner and outer mode to figure out which bits it is talking about.
> Therefore, wherever you end up with replacing SUBREG_REG with CONST_INT or
> other modeless RTL, there is a bug; instead of that the code should be using
> something like simplify_replace_rtx or simplify_replace_fn_rtx, where the
> result is immediately simplified at the point where the original inner mode is
> still known.