From f5fa84ecc9a63019897f584d7d3368c0e85c9258 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 1 Apr 2009 20:47:37 +0000 Subject: PR rtl-optimization/39588 * combine.c (merge_outer_ops): Do not set the constant when this is not necessary. (simplify_shift_const_1): Do not modify it either in this case. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch@145431 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/combine.c | 11 ++++++----- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.c-torture/compile/20090401-1.c | 11 +++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090401-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cf4d1c1249b..593eae7cbdb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2009-04-01 Eric Botcazou + + PR rtl-optimization/39588 + * combine.c (merge_outer_ops): Do not set the constant when this + is not necessary. + (simplify_shift_const_1): Do not modify it either in this case. + 2009-04-01 Steven Bosscher * config/ia64/ia64.c (ia64_handle_option): Inform user that Itanium1 diff --git a/gcc/combine.c b/gcc/combine.c index a9026636e3e..bbb7135aa75 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -8956,13 +8956,13 @@ merge_outer_ops (enum rtx_code *pop0, HOST_WIDE_INT *pconst0, enum rtx_code op1, && op0 == AND) op0 = UNKNOWN; + *pop0 = op0; + /* ??? Slightly redundant with the above mask, but not entirely. Moving this above means we'd have to sign-extend the mode mask for the final test. */ - const0 = trunc_int_for_mode (const0, mode); - - *pop0 = op0; - *pconst0 = const0; + if (op0 != UNKNOWN && op0 != NEG) + *pconst0 = trunc_int_for_mode (const0, mode); return 1; } @@ -9685,7 +9685,8 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode, if (outer_op != UNKNOWN) { - if (GET_MODE_BITSIZE (result_mode) < HOST_BITS_PER_WIDE_INT) + if (GET_RTX_CLASS (outer_op) != RTX_UNARY + && GET_MODE_BITSIZE (result_mode) < HOST_BITS_PER_WIDE_INT) outer_const = trunc_int_for_mode (outer_const, result_mode); if (outer_op == AND) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 46736afc0b4..b6e39c47426 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-04-01 Eric Botcazou + + * gcc.c-torture/compile/20090401-1.c: New test. + 2009-04-01 H.J. Lu Backport from mainline: diff --git a/gcc/testsuite/gcc.c-torture/compile/20090401-1.c b/gcc/testsuite/gcc.c-torture/compile/20090401-1.c new file mode 100644 index 00000000000..a0058feb2df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090401-1.c @@ -0,0 +1,11 @@ +/* PR rtl-optimization/39588 */ +/* Testcase by Olivier ROUSSEL */ + +#define lit_from_int(in) ((in<0)?(((-in)<<1)|1):(in<<1)) + +void init_clause(int *literals, int size, int *lits) +{ + int i; + for(i=0; i < size; i++) + lits[i] = lit_from_int(literals[i]); +} -- cgit v1.2.3