This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Zero/Sign extension elimination using value ranges
- From: Richard Henderson <rth at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Kugan <kugan dot vivekanandarajah at linaro dot org>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Richard Biener <richard dot guenther at gmail dot com>, Eric Botcazou <ebotcazou at adacore dot com>
- Date: Thu, 22 May 2014 14:23:10 -0700
- Subject: Re: Zero/Sign extension elimination using value ranges
- Authentication-results: sourceware.org; auth=none
- References: <537ABD93 dot 2040703 at linaro dot org> <20140520065257 dot GK10386 at tucnak dot redhat dot com> <537C153B dot 2010706 at linaro dot org> <20140521070516 dot GQ10386 at tucnak dot redhat dot com> <537DCB09 dot 4090100 at linaro dot org> <20140522101233 dot GA10386 at tucnak dot redhat dot com>
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~