> Yes, convert_modes does this, on the other side e.g. convert_move a few > hundred lines above it doesn't: > if (GET_CODE (from) == SUBREG > && SUBREG_PROMOTED_VAR_P (from) > && is_a <scalar_int_mode> (to_mode, &to_int_mode) > && (GET_MODE_PRECISION (subreg_promoted_mode (from)) > > >= GET_MODE_PRECISION (to_int_mode)) > > && SUBREG_CHECK_PROMOTED_SIGN (from, unsignedp)) > from = gen_lowpart (to_int_mode, from), from_mode = to_int_mode;
Right, they were originally alike, but someone you know very well changed it: 2013-12-17 Jakub Jelinek <ja...@redhat.com> * expr.c (convert_modes): For SUBREG_PROMOTED_VAR_P use SUBREG_REG (x) instead of x as last gen_lowpart argument. > 2018-04-17 Jakub Jelinek <ja...@redhat.com> > > PR middle-end/85414 > * simplify-rtx.c (simplify_unary_operation_1) <case SIGN_EXTEND, > case ZERO_EXTEND>: Pass SUBREG_REG (op) rather than op to > gen_lowpart_no_emit. > * rtlhooks.c (gen_lowpart_if_possible): Don't call gen_lowpart_SUBREG > on a SUBREG. > > * gcc.dg/pr85414.c: New test. I'd say, either we change both convert_move and simplify-rtx.c for GCC 8 or we change none of them. You're the RM so it's more of your call than mine. -- Eric Botcazou