From: Dominik Vogt Date: Mon, 12 Dec 2016 18:23:48 +0000 (+0000) Subject: combine: Handle mode expanding zero_extracts in change_zero_ext. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4d604062535264fd7973c29f3343d1e51951437;p=gcc.git combine: Handle mode expanding zero_extracts in change_zero_ext. Example: (zero_extract:DI (reg:SI) (const_int 24) (const_int 0)) --> (and:DI (subreg:DI (lshiftrt:SI (reg:SI) (const_int 8)) 0) (const_int 16777215)) 2016-12-12 Dominik Vogt * combine.c (change_zero_ext): Handle mode expanding zero_extracts. From-SVN: r243578 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4e99e1fac86..d0ae5c6d467 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-12-12 Dominik Vogt + + * combine.c (change_zero_ext): Handle mode expanding zero_extracts. + 2016-12-12 Uros Bizjak PR target/78738 diff --git a/gcc/combine.c b/gcc/combine.c index b4294532296..19851a2f64c 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -11237,18 +11237,24 @@ change_zero_ext (rtx pat) if (GET_CODE (x) == ZERO_EXTRACT && CONST_INT_P (XEXP (x, 1)) && CONST_INT_P (XEXP (x, 2)) - && GET_MODE (XEXP (x, 0)) == mode) + && GET_MODE (XEXP (x, 0)) != VOIDmode + && GET_MODE_PRECISION (GET_MODE (XEXP (x, 0))) + <= GET_MODE_PRECISION (mode)) { + machine_mode inner_mode = GET_MODE (XEXP (x, 0)); + size = INTVAL (XEXP (x, 1)); int start = INTVAL (XEXP (x, 2)); if (BITS_BIG_ENDIAN) - start = GET_MODE_PRECISION (mode) - size - start; + start = GET_MODE_PRECISION (inner_mode) - size - start; if (start) - x = gen_rtx_LSHIFTRT (mode, XEXP (x, 0), GEN_INT (start)); + x = gen_rtx_LSHIFTRT (inner_mode, XEXP (x, 0), GEN_INT (start)); else x = XEXP (x, 0); + if (mode != inner_mode) + x = gen_lowpart_SUBREG (mode, x); } else if (GET_CODE (x) == ZERO_EXTEND && SCALAR_INT_MODE_P (mode)