diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 57a1578caa31..3622483545c5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-12-19 Dominik Vogt + + * combine.c (change_zero_ext): Skip generation of redundant AND. + 2016-12-19 Krister Walfridsson * config/netbsd.h (LINK_EH_SPEC): Define. diff --git a/gcc/combine.c b/gcc/combine.c index 473ffc4a1321..e74ff4c20a1f 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -11289,8 +11289,13 @@ change_zero_ext (rtx pat) else continue; - wide_int mask = wi::mask (size, false, GET_MODE_PRECISION (mode)); - x = gen_rtx_AND (mode, x, immed_wide_int_const (mask, mode)); + if (!(GET_CODE (x) == LSHIFTRT + && CONST_INT_P (XEXP (x, 1)) + && size + INTVAL (XEXP (x, 1)) == GET_MODE_PRECISION (mode))) + { + wide_int mask = wi::mask (size, false, GET_MODE_PRECISION (mode)); + x = gen_rtx_AND (mode, x, immed_wide_int_const (mask, mode)); + } SUBST (**iter, x); changed = true;