diff options
author | Peter Bergner <bergner@vnet.ibm.com> | 2007-07-23 11:43:24 -0500 |
---|---|---|
committer | Peter Bergner <bergner@gcc.gnu.org> | 2007-07-23 11:43:24 -0500 |
commit | 7e0b4eaea174caaaae3a50074623b58d1cdfe410 (patch) | |
tree | ff49113424954fc128f22d29310fdf6c0c984bbc /gcc/simplify-rtx.c | |
parent | de2b3a07713724618330b6bde404a32d0af811c0 (diff) | |
download | gcc-7e0b4eaea174caaaae3a50074623b58d1cdfe410.zip gcc-7e0b4eaea174caaaae3a50074623b58d1cdfe410.tar.gz gcc-7e0b4eaea174caaaae3a50074623b58d1cdfe410.tar.bz2 |
PR middle-end/PR28690
PR middle-end/PR28690
* optabs.c (expand_binop): (emit_cmp_and_jump_insns): Allow EQ compares.
* rtlanal.c (commutative_operand_precedence): Prefer both REG_POINTER
and MEM_POINTER operands over REG and MEM operands.
(swap_commutative_operands_p): Change return value to bool.
* rtl.h: Update the corresponding prototype.
* tree-ssa-address.c (gen_addr_rtx): Use simplify_gen_binary
instead of gen_rtx_PLUS.
* simplify-rtx.c (simplify_plus_minus_op_data_cmp): Change return
value to bool. Change function arguments to rtx's and update code
to match.
(simplify_plus_minus): Update the simplify_plus_minus_op_data_cmp
calls to match the new declaration.
* simplify-rtx.c (simplify_associative_operation): Don't
reorder simplify_binary_operation arguments.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r126852
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 9b27bbd..40fedde 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -52,7 +52,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA static rtx neg_const_int (enum machine_mode, rtx); static bool plus_minus_operand_p (rtx); -static int simplify_plus_minus_op_data_cmp (const void *, const void *); +static bool simplify_plus_minus_op_data_cmp (rtx, rtx); static rtx simplify_plus_minus (enum rtx_code, enum machine_mode, rtx, rtx); static rtx simplify_immed_subreg (enum machine_mode, rtx, enum machine_mode, unsigned int); @@ -1499,16 +1499,12 @@ simplify_associative_operation (enum rtx_code code, enum machine_mode mode, } /* Attempt to simplify "(a op b) op c" as "a op (b op c)". */ - tem = swap_commutative_operands_p (XEXP (op0, 1), op1) - ? simplify_binary_operation (code, mode, op1, XEXP (op0, 1)) - : simplify_binary_operation (code, mode, XEXP (op0, 1), op1); + tem = simplify_binary_operation (code, mode, XEXP (op0, 1), op1); if (tem != 0) return simplify_gen_binary (code, mode, XEXP (op0, 0), tem); /* Attempt to simplify "(a op b) op c" as "(a op c) op b". */ - tem = swap_commutative_operands_p (XEXP (op0, 0), op1) - ? simplify_binary_operation (code, mode, op1, XEXP (op0, 0)) - : simplify_binary_operation (code, mode, XEXP (op0, 0), op1); + tem = simplify_binary_operation (code, mode, XEXP (op0, 0), op1); if (tem != 0) return simplify_gen_binary (code, mode, tem, XEXP (op0, 1)); } @@ -3313,23 +3309,21 @@ struct simplify_plus_minus_op_data short neg; }; -static int -simplify_plus_minus_op_data_cmp (const void *p1, const void *p2) +static bool +simplify_plus_minus_op_data_cmp (rtx x, rtx y) { - const struct simplify_plus_minus_op_data *d1 = p1; - const struct simplify_plus_minus_op_data *d2 = p2; int result; - result = (commutative_operand_precedence (d2->op) - - commutative_operand_precedence (d1->op)); + result = (commutative_operand_precedence (y) + - commutative_operand_precedence (x)); if (result) - return result; + return result > 0; /* Group together equal REGs to do more simplification. */ - if (REG_P (d1->op) && REG_P (d2->op)) - return REGNO (d1->op) - REGNO (d2->op); + if (REG_P (x) && REG_P (y)) + return REGNO (x) > REGNO (y); else - return 0; + return false; } static rtx @@ -3473,14 +3467,14 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, { struct simplify_plus_minus_op_data save; j = i - 1; - if (simplify_plus_minus_op_data_cmp (&ops[j], &ops[i]) < 0) + if (!simplify_plus_minus_op_data_cmp (ops[j].op, ops[i].op)) continue; canonicalized = 1; save = ops[i]; do ops[j + 1] = ops[j]; - while (j-- && simplify_plus_minus_op_data_cmp (&ops[j], &save) > 0); + while (j-- && simplify_plus_minus_op_data_cmp (ops[j].op, save.op)); ops[j + 1] = save; } |