On Wed, Jul 20, 2011 at 8:04 PM, Eric Botcazou <ebotca...@adacore.com> wrote: >> Another improvement is introduction of SUBREG_PROMOTED_UNSIGNED_P >> predicate in the same area to handle paradoxical SUBREGs. When SUBREG >> satisfies this predicate, the compiler guarantees, that excess bits >> are zero (see the documentation). This is exaclty what we want in >> registers that form the address. In theory, we can allow registers of >> any integer mode here, but in practice only DImode subreg of SImode >> register is important. > > Note that SUBREG_PROMOTED_UNSIGNED_P wasn't designed for paradoxical subregs, > but for regular subregs (typically of word-sized objects). You should check > that the ones created for x32 (because of POINTERS_EXTEND_UNSIGNED I guess) > are legitimate.
Hm, the documentation says: Paradoxical subregs When M1 is strictly wider than M2, the `subreg' expression is called "paradoxical". The canonical test for this class of `subreg' is: GET_MODE_SIZE (M1) > GET_MODE_SIZE (M2) Paradoxical `subreg's can be used as both lvalues and rvalues. When used as an lvalue, the low-order bits of the source value are stored in REG and the high-order bits are discarded. When used as an rvalue, the low-order bits of the `subreg' are taken from REG while the high-order bits may or may not be defined. The high-order bits of rvalues are in the following circumstances: * `subreg's of `mem' When M2 is smaller than a word, the macro `LOAD_EXTEND_OP', can control how the high-order bits are defined. * `subreg' of `reg's The upper bits are defined when `SUBREG_PROMOTED_VAR_P' is true. `SUBREG_PROMOTED_UNSIGNED_P' describes what the upper bits hold. Such subregs usually represent local variables, register variables and parameter pseudo variables that have been promoted to a wider mode. I have looked at example in rs6000.c, the only target that uses SUBREG_PROMOTED_UNSIGNED_P. Looking at other sources, S_P_U_P is used in conjunction with SUBREG_PROMOTED_VAR. It looks to me that using the combination should be OK to determine if subreg is correct. Uros.