aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/fold-const.c11
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index af4fae5..603f6a4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2004-03-23 Roger Sayle <roger@eyesopen.com>
+
+ * fold-const.c (tree_expr_nonnegative_p): A&B is nonnegative when
+ A is nonnegative or B is nonnegative. Similarly A|B is nonnegative
+ when both A and B are nonnegative.
+ (tree_expr_nonzero_p): A|B is nonzero when A is nonzero or B is
+ nonzero.
+
2004-03-23 Kazu Hirata <kazu@cs.umass.edu>
* fold-const.c (fold): Remove cases for INTEGER_CST, REAL_CST,
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 948a46c..417d1a4 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -8717,6 +8717,13 @@ tree_expr_nonnegative_p (tree t)
return tree_expr_nonnegative_p (TREE_OPERAND (t, 0))
&& tree_expr_nonnegative_p (TREE_OPERAND (t, 1));
+ case BIT_AND_EXPR:
+ return tree_expr_nonnegative_p (TREE_OPERAND (t, 1))
+ || tree_expr_nonnegative_p (TREE_OPERAND (t, 0));
+ case BIT_IOR_EXPR:
+ return tree_expr_nonnegative_p (TREE_OPERAND (t, 0))
+ && tree_expr_nonnegative_p (TREE_OPERAND (t, 1));
+
case NOP_EXPR:
{
tree inner_type = TREE_TYPE (TREE_OPERAND (t, 0));
@@ -8955,6 +8962,10 @@ tree_expr_nonzero_p (tree t)
case NON_LVALUE_EXPR:
return tree_expr_nonzero_p (TREE_OPERAND (t, 0));
+ case BIT_IOR_EXPR:
+ return tree_expr_nonzero_p (TREE_OPERAND (t, 1))
+ || tree_expr_nonzero_p (TREE_OPERAND (t, 0));
+
default:
break;
}