This is the mail archive of the
mailing list for the GCC project.
Re: Question about subregs on constants
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 27 Oct 2015 18:09:49 +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>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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