X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fsimplify-rtx.c;h=a0c4395f113827a6769a049e18f66dfd97a96b7b;hb=7aec221bfaeacd43c0075b8de011f88862afdffd;hp=d82940598b6dbdce174511dfc992ca193c4aef26;hpb=140b44efbc2f0035cbfd23e43d97ae9ffc00c122;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index d82940598b6..a0c4395f113 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -1,7 +1,7 @@ /* RTL simplification functions for GNU compiler. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - 2011 Free Software Foundation, Inc. + 2011, 2012 Free Software Foundation, Inc. This file is part of GCC. @@ -244,7 +244,8 @@ avoid_constant_pool_reference (rtx x) /* If we're accessing the constant in a different mode than it was originally stored, attempt to fix that up via subreg simplifications. If that fails we have no choice but to return the original memory. */ - if (offset != 0 || cmode != GET_MODE (x)) + if ((offset != 0 || cmode != GET_MODE (x)) + && offset >= 0 && offset < GET_MODE_SIZE (cmode)) { rtx tem = simplify_subreg (GET_MODE (x), c, cmode, offset); if (tem && CONSTANT_P (tem)) @@ -1465,9 +1466,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode, case ZERO_EXTEND: /* When zero-extending a CONST_INT, we need to know its original mode. */ - if (op_mode == VOIDmode) - return 0; - + gcc_assert (op_mode != VOIDmode); if (op_width == HOST_BITS_PER_WIDE_INT) { /* If we were really extending the mode, @@ -1634,8 +1633,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode, break; case ZERO_EXTEND: - if (op_mode == VOIDmode) - return immed_double_const (0, 0, mode); + gcc_assert (op_mode != VOIDmode); if (op_width > HOST_BITS_PER_WIDE_INT) return 0; @@ -2242,7 +2240,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, neg_const_int (mode, op1)); /* (x - (x & y)) -> (x & ~y) */ - if (GET_CODE (op1) == AND) + if (INTEGRAL_MODE_P (mode) && GET_CODE (op1) == AND) { if (rtx_equal_p (op0, XEXP (op1, 0))) { @@ -2560,6 +2558,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, HOST_WIDE_INT mask = INTVAL (trueop1) << count; if (mask >> count == INTVAL (trueop1) + && trunc_int_for_mode (mask, mode) == mask && (mask & nonzero_bits (XEXP (op0, 0), mode)) == 0) return simplify_gen_binary (ASHIFTRT, mode, plus_constant (XEXP (op0, 0), mask),