>> +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. The problem with SRP_POINTER 0, SRP_SIGNED 1, SRP_UNSIGNED 2, SRP_SIGNED_AND_UNSIGNED 3 (as I understand) is that, it will be incompatible with TYPE_UNSIGNED (tree) and defines of POINTER_EXTEND_UNSIGNED values. We will have to then translate while setting to SRP_* values . Also SUBREG_PROMOTED_SIGNED_P is now checked in some cases for != 0 (meaning SRP_POINTER or SRP_UNSIGNED) and in some cases > 0 (meaning SRP_UNSIGNED). Since our aim is to perform single bit checks, why don’t we just use this representation internally (i.e. _rtx->unchanging = 1 if SRP_SIGNED and _rtx->volatil = 1 if SRP_UNSIGNED). As for SUBREG_PROMOTED_SIGNED_P, we still have to return -1 or 1 depending on SRP_POINTER or SRP_UNSIGNED. 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; /* Sets promoted mode for SUBREG_PROMOTED_VAR_P(), */ #define SUBREG_PROMOTED_SET(RTX, VAL) \ do { \ rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SET", \ (RTX), SUBREG); \ switch ((VAL)) \ { \ case SRP_POINTER: \ _rtx->volatil = 0; \ _rtx->unchanging = 0; \ break; \ case SRP_SIGNED: \ _rtx->volatil = 0; \ _rtx->unchanging = 1; \ break; \ case SRP_UNSIGNED: \ _rtx->volatil = 1; \ _rtx->unchanging = 0; \ break; \ case SRP_SIGNED_AND_UNSIGNED: \ _rtx->volatil = 1; \ _rtx->unchanging = 1; \ break; \ } \ } while (0) /* Gets promoted mode for SUBREG_PROMOTED_VAR_P(). */ #define SUBREG_PROMOTED_GET(RTX) \ (2 * (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_GET", (RTX), SUBREG)->volatil)\ + (RTX)->unchanging - 1) /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted for SIGNED type. */ #define SUBREG_PROMOTED_SIGNED_P(RTX) \ (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGNED_P", (RTX), SUBREG)->unchanging == 1) /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted for UNSIGNED type. In case of SRP_POINTER, SUBREG_PROMOTED_UNSIGNED_P returns -1 as this is in most cases handled like unsigned extension, except for generating instructions where special code is emitted for (ptr_extend insns) on some architectures. */ #define SUBREG_PROMOTED_UNSIGNED_P(RTX) \ ((((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil)\ + (RTX)->unchanging) == 0) ? -1 : ((RTX)->volatil == 1)) Am I missing anything here? Please let me know. I am attaching the patch based on this with your other review comments addressed. Thanks, Kugan gcc/ 2014-06-25 Kugan Vivekanandarajah * calls.c (precompute_arguments): Use new SUBREG_PROMOTED_SET instead of SUBREG_PROMOTED_UNSIGNED_SET (expand_call): Likewise. * expr.c (convert_move): Use new SUBREG_CHECK_PROMOTED_SIGN instead of SUBREG_PROMOTED_UNSIGNED_P. (convert_modes): Likewise. (store_expr): Likewise. (expand_expr_real_1): Use new SUBREG_PROMOTED_SET instead of SUBREG_PROMOTED_UNSIGNED_SET. * function.c (assign_param_setup_reg): Use new SUBREG_PROMOTED_SET instead of SUBREG_PROMOTED_UNSIGNED_SET. * ifcvt.c (noce_emit_cmove): Updated to use SUBREG_PROMOTED_UNSIGNED_P and SUBREG_PROMOTED_SIGNED_P. * internal-fn.c (ubsan_expand_si_overflow_mul_check): Use SUBREG_PROMOTED_SET instead of SUBREG_PROMOTED_UNSIGNED_SET. * optabs.c (widen_operand): Use new SUBREG_CHECK_PROMOTED_SIGN instead of SUBREG_PROMOTED_UNSIGNED_P. * rtl.h (SUBREG_PROMOTED_UNSIGNED_SET): Remove. (SUBREG_PROMOTED_SET): New define. (SUBREG_PROMOTED_GET): Likewise. (SUBREG_PROMOTED_SIGNED_P): Likewise. (SUBREG_CHECK_PROMOTED_SIGN): Likewise. (SUBREG_PROMOTED_UNSIGNED_P): Updated. * rtlanal.c (simplify_unary_operation_1): Use new SUBREG_PROMOTED_SET instead of SUBREG_PROMOTED_UNSIGNED_SET. * simplify-rtx.c (simplify_unary_operation_1): Use new SUBREG_PROMOTED_SIGNED_P instead of !SUBREG_PROMOTED_UNSIGNED_P. (simplify_subreg): Use new SUBREG_PROMOTED_SET instead of SUBREG_PROMOTED_UNSIGNED_SET.