On 05/22/2014 03:12 AM, Jakub Jelinek wrote:
> No way. SUBREG_PROMOTED_UNSIGNED_P right now resides in two separate bits,
> volatil and unchanging. Right now volatile != 0, unchanging ignored
> is -1, volatile == 0, then the value is unchanging.
> What I meant is change this representation, e.g. to
> x->volatil * 2 + x->unchanging - 1
> so you can represent the values -1, 0, 1, 2 in there.
> Of course, adjust SUBREG_PROMOTED_UNSIGNED_SET correspondingly too.
> As SUBREG_PROMOTED_UNSIGNED_P is only valid if SUBREG_PROMOTED_VAR_P,
> I'd hope that you don't need to care about what 0, 0 in those bits
> means, because everything should actually SUBREG_PROMOTED_UNSIGNED_SET
> around setting SUBREG_PROMOTED_VAR_P to non-zero.
It would be helpful to redo these, now that we don't simply have a tri-state
value.
const unsigned int SRP_POINTER = 0;
const unsigned int SRP_SIGNED = 1;
const unsigned int SRP_UNSIGNED = 2;
#define SUBREG_PROMOTED_SET(RTX, VAL) \
do { \
rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SET", \
(RTX), SUBREG); \
unsigned int _val = (VAL); \
_rtx->volatil = _val; \
_rtx->unchanging = _val >> 1; \
} while (0)
#define SUBREG_PROMOTED_GET(RTX) \
({ const rtx _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_GET", \
(RTX), SUBREG); \
_rtx->volail + _rtx->unchanging * 2; \
})
The bits are arranged such that e.g.
SUBREG_PROMOTED_GET (x) & SRP_UNSIGNED
is meaningful. For conciseness, we'd probably want
SUBREG_PROMOTED_POINTER_P
SUBREG_PROMOTED_UNSIGNED_P
SUBREG_PROMOTED_SIGNED_P
as boolean macros. I dunno if "both" (whatever you want to call that) is used
enough to warrant its own macro. I can more often see this being used when
examining a given ZERO_/SIGN_EXTEND rtx, so "both" probably won't come up.
r~