aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2007-02-06 02:50:39 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2007-02-06 02:50:39 +0000
commit8fbbe90b2614078f799f65c9e3608f1eec8a48ab (patch)
treecee770a0428b5a0aa4b52b29a79ff52ec15c355c /gcc/fold-const.c
parent792eaee2cb07b64e8f255209e93cf8d95bc0f705 (diff)
downloadgcc-8fbbe90b2614078f799f65c9e3608f1eec8a48ab.zip
gcc-8fbbe90b2614078f799f65c9e3608f1eec8a48ab.tar.gz
gcc-8fbbe90b2614078f799f65c9e3608f1eec8a48ab.tar.bz2
fold-const.c (negate_expr_p): Handle CONJ_EXPR.
* fold-const.c (negate_expr_p): Handle CONJ_EXPR. (fold_negate_expr): Likewise. testsuite: * gcc.dg/builtins-20.c: Add more cases. From-SVN: r121639
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c147efa..0b37a0f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1015,6 +1015,9 @@ negate_expr_p (tree t)
return negate_expr_p (TREE_OPERAND (t, 0))
&& negate_expr_p (TREE_OPERAND (t, 1));
+ case CONJ_EXPR:
+ return negate_expr_p (TREE_OPERAND (t, 0));
+
case PLUS_EXPR:
if (HONOR_SIGN_DEPENDENT_ROUNDING (TYPE_MODE (type))
|| HONOR_SIGNED_ZEROS (TYPE_MODE (type)))
@@ -1145,6 +1148,12 @@ fold_negate_expr (tree t)
fold_negate_expr (TREE_OPERAND (t, 1)));
break;
+ case CONJ_EXPR:
+ if (negate_expr_p (t))
+ return fold_build1 (CONJ_EXPR, type,
+ fold_negate_expr (TREE_OPERAND (t, 0)));
+ break;
+
case NEGATE_EXPR:
return TREE_OPERAND (t, 0);