diff options
author | Roger Sayle <roger@eyesopen.com> | 2004-06-21 12:59:58 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2004-06-21 12:59:58 +0000 |
commit | 54d581a26ea5cc6ec540be1f108d18db0bbd365a (patch) | |
tree | fbe467313f9d7b88edaeea4235a6c64516615a03 /gcc/fold-const.c | |
parent | 19aec1956502bdf46a6c859ca0fa7e4666886bca (diff) | |
download | gcc-54d581a26ea5cc6ec540be1f108d18db0bbd365a.zip gcc-54d581a26ea5cc6ec540be1f108d18db0bbd365a.tar.gz gcc-54d581a26ea5cc6ec540be1f108d18db0bbd365a.tar.bz2 |
fold-const.c (operand_equal_p): Pass flags in recursive calls for binary and relational operations.
* fold-const.c (operand_equal_p): Pass flags in recursive calls for
binary and relational operations. Add support for TRUTH_ANDIF_EXPR,
TRUTH_ORIF_EXPR, TRUTH_AND_EXPR, TRUTH_OR_EXPR and TRUTH_XOR_EXPR.
* tree.c (commutative_tree_code): Also list UNORDERED_EXPR,
ORDERED_EXPR, UNEQ_EXPR, LTGT_EXPR, TRUTH_AND_EXPR, TRUTH_OR_EXPR
and TRUTH_XOR_EXPR.
From-SVN: r83433
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 517d550..68c9722 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2454,9 +2454,10 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags) case '<': case '2': - if (operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 0), 0) - && operand_equal_p (TREE_OPERAND (arg0, 1), TREE_OPERAND (arg1, 1), - 0)) + if (operand_equal_p (TREE_OPERAND (arg0, 0), + TREE_OPERAND (arg1, 0), flags) + && operand_equal_p (TREE_OPERAND (arg0, 1), + TREE_OPERAND (arg1, 1), flags)) return 1; /* For commutative ops, allow the other order. */ @@ -2506,6 +2507,25 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags) return operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 0), flags); + case TRUTH_ANDIF_EXPR: + case TRUTH_ORIF_EXPR: + return operand_equal_p (TREE_OPERAND (arg0, 0), + TREE_OPERAND (arg1, 0), flags) + && operand_equal_p (TREE_OPERAND (arg0, 1), + TREE_OPERAND (arg1, 1), flags); + + case TRUTH_AND_EXPR: + case TRUTH_OR_EXPR: + case TRUTH_XOR_EXPR: + return (operand_equal_p (TREE_OPERAND (arg0, 0), + TREE_OPERAND (arg1, 0), flags) + && operand_equal_p (TREE_OPERAND (arg0, 1), + TREE_OPERAND (arg1, 1), flags)) + || (operand_equal_p (TREE_OPERAND (arg0, 0), + TREE_OPERAND (arg1, 1), flags) + && operand_equal_p (TREE_OPERAND (arg0, 1), + TREE_OPERAND (arg1, 0), flags)); + case RTL_EXPR: return rtx_equal_p (RTL_EXPR_RTL (arg0), RTL_EXPR_RTL (arg1)); |