This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix gen_lowpart_if_possible (PR middle-end/85414)


> The following testcase FAILs, because cse_local sees
> (zero_extend:TI (subreg/s/v:DI (reg:TI ...) 0))
> inside of REG_EQUAL note, and simplify-rtx.c attempts to optimize it.
>     case ZERO_EXTEND:
>       /* Check for a zero extension of a subreg of a promoted
>          variable, where the promotion is zero-extended, and the
>          target mode is the same as the variable's promotion.  */
>       if (GET_CODE (op) == SUBREG
>           && SUBREG_PROMOTED_VAR_P (op)
>           && SUBREG_PROMOTED_UNSIGNED_P (op)
>           && !paradoxical_subreg_p (mode, GET_MODE (SUBREG_REG (op))))
>         {
>           temp = rtl_hooks.gen_lowpart_no_emit (mode, op);
>           if (temp)
>             return temp;
>         }

This code is strange though, here's the equivalent one in convert_modes:

  if (GET_CODE (x) == SUBREG
      && SUBREG_PROMOTED_VAR_P (x)
      && is_a <scalar_int_mode> (mode, &int_mode)
      && (GET_MODE_PRECISION (subreg_promoted_mode (x))
	  >= GET_MODE_PRECISION (int_mode))
      && SUBREG_CHECK_PROMOTED_SIGN (x, unsignedp))
    x = gen_lowpart (int_mode, SUBREG_REG (x));

so can't we just pass SUBREG_REG (op) here?  Same for SIGN_EXTEND above.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]