fold-const.c (tree_expr_nonnegative_p): Handle BIT_XOR_EXPR like BIT_IOR_EXPR...

* fold-const.c (tree_expr_nonnegative_p): Handle BIT_XOR_EXPR like
	BIT_IOR_EXPR; A^B is nonnegative when A and B are nonnegative.

	* gcc.dg/compare8.c: Add an additional test for XOR.

From-SVN: r79979
This commit is contained in:
Roger Sayle 2004-03-26 01:20:46 +00:00 committed by Roger Sayle
parent 0066ef9ce4
commit 22e63bd346
4 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2004-03-25 Roger Sayle <roger@eyesopen.com>
* fold-const.c (tree_expr_nonnegative_p): Handle BIT_XOR_EXPR like
BIT_IOR_EXPR; A^B is nonnegative when A and B are nonnegative.
2004-03-25 Richard Henderson <rth@redhat.com>
PR 11527

View File

@ -8722,6 +8722,7 @@ tree_expr_nonnegative_p (tree t)
return tree_expr_nonnegative_p (TREE_OPERAND (t, 1))
|| tree_expr_nonnegative_p (TREE_OPERAND (t, 0));
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
return tree_expr_nonnegative_p (TREE_OPERAND (t, 0))
&& tree_expr_nonnegative_p (TREE_OPERAND (t, 1));

View File

@ -1,3 +1,7 @@
2004-03-25 Roger Sayle <roger@eyesopen.com>
* gcc.dg/compare8.c: Add an additional test for XOR.
2004-03-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-ctype-1.c: New test.

View File

@ -13,3 +13,9 @@ g(unsigned short a1, unsigned short a2, unsigned int b)
return ((a1+a2)&5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
}
int
h(unsigned short a1, unsigned short a2, unsigned int b)
{
return ((a1+a2)^5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
}