This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix gen_lowpart_if_possible (PR middle-end/85414)
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Jeff Law <law at redhat dot com>
- Date: Tue, 17 Apr 2018 09:32:31 +0200
- Subject: Re: [PATCH] Fix gen_lowpart_if_possible (PR middle-end/85414)
- References: <20180416190157.GS8577@tucnak>
> 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