On Tue, Jun 24, 2014 at 09:51:51PM +1000, Kugan wrote: > Changes the the SUBREG flags to be able to set promoted for sign > (SRP_SIGNED), unsigned (SRP_UNSIGNED), sign and unsigned > (SPR_SIGNED_AND_UNSIGNED) in SUBREG_PROMOTED_VAR_P.
> 2014-06-24 Kugan Vivekanandarajah <kug...@linaro.org> > > * gcc/calls.c (precompute_arguments): Use new SUBREG_PROMOTED_SET > instead of SUBREG_PROMOTED_UNSIGNED_SET > (expand_call) : Likewise. gcc/ prefix doesn't belong to gcc/ChangeLog entries (everywhere). > * gcc/expr.c (convert_move) : Use new SUBREG_CHECK_PROMOTED_SIGN No space before : (everywhere). > @@ -3365,7 +3364,8 @@ expand_call (tree exp, rtx target, int ignore) > > target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset); > SUBREG_PROMOTED_VAR_P (target) = 1; > - SUBREG_PROMOTED_UNSIGNED_SET (target, unsignedp); > + SUBREG_PROMOTED_SET (target, unsignedp); > + > } > Please avoid adding useless blank lines. > --- a/gcc/expr.c > +++ b/gcc/expr.c > @@ -329,7 +329,7 @@ convert_move (rtx to, rtx from, int unsignedp) > if (GET_CODE (from) == SUBREG && SUBREG_PROMOTED_VAR_P (from) > && (GET_MODE_PRECISION (GET_MODE (SUBREG_REG (from))) > >= GET_MODE_PRECISION (to_mode)) > - && SUBREG_PROMOTED_UNSIGNED_P (from) == unsignedp) > + && (SUBREG_CHECK_PROMOTED_SIGN (from, unsignedp))) Please remove the extra ()s, the macro should have ()s around the definition to make this unnecessary (many times). > @@ -5202,8 +5202,7 @@ store_expr (tree exp, rtx target, int call_param_p, > bool nontemporal) > && GET_MODE_PRECISION (GET_MODE (target)) > == TYPE_PRECISION (TREE_TYPE (exp))) > { > - if (TYPE_UNSIGNED (TREE_TYPE (exp)) > - != SUBREG_PROMOTED_UNSIGNED_P (target)) > + if (!(SUBREG_CHECK_PROMOTED_SIGN (target, TYPE_UNSIGNED (TREE_TYPE > (exp))))) Too long line. > -#define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL) > \ > -do { \ > - rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_SET", \ > - (RTX), SUBREG); \ > - if ((VAL) < 0) \ > - _rtx->volatil = 1; > \ > - else { \ > - _rtx->volatil = 0; > \ > - _rtx->unchanging = (VAL); > \ > - } \ > -} while (0) > - > /* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case > this gives the necessary extensions: > - 0 - signed > - 1 - normal unsigned > + 0 - signed (SPR_SIGNED) > + 1 - normal unsigned (SPR_UNSIGNED) > + 2 - value is both sign and unsign extended for mode > + (SPR_SIGNED_AND_UNSIGNED). > -1 - pointer unsigned, which most often can be handled like unsigned > extension, except for generating instructions where we need to > - emit special code (ptr_extend insns) on some architectures. */ > + emit special code (ptr_extend insns) on some architectures > + (SPR_POINTER). */ > + > +const unsigned int SRP_POINTER = -1; > +const unsigned int SRP_SIGNED = 0; > +const unsigned int SRP_UNSIGNED = 1; > +const unsigned int SRP_SIGNED_AND_UNSIGNED = 2; But most importantly, I thought Richard Henderson suggested to use SRP_POINTER 0, SRP_SIGNED 1, SRP_UNSIGNED 2, SRP_SIGNED_AND_UNSIGNED 3, that way when checking e.g. SUBREG_PROMOTED_SIGNED_P or SUBREG_PROMOTED_UNSIGNED_P you can check just the single bit. Where something tested for SUBREG_PROMOTED_UNSIGNED_P () == -1 just use SUBREG_PROMOTED_GET. Jakub