diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-14 05:08:46 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-14 05:08:46 +0000 |
commit | 2c26730b9caf78019c2b713d82d895cb7fec3963 (patch) | |
tree | b7ff97c2b5e5d7442bef1008e0d8e9eba4b1c58a /gcc/fold-const.c | |
parent | db049e787a997042bf7f14ec88021db34a146c94 (diff) | |
download | gcc-2c26730b9caf78019c2b713d82d895cb7fec3963.tar.gz |
* fold-const.c (fold_strip_sign_ops): Handle COMPOUND_EXPR and
COND_EXPR.
testsuite:
* gcc.dg/builtins-20.c: Add more cases.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118802 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index fe7ec587204..eb3b45701a4 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13368,6 +13368,22 @@ fold_strip_sign_ops (tree exp) arg1 ? arg1 : TREE_OPERAND (exp, 1)); break; + case COMPOUND_EXPR: + arg0 = TREE_OPERAND (exp, 0); + arg1 = fold_strip_sign_ops (TREE_OPERAND (exp, 1)); + if (arg1) + return fold_build2 (COMPOUND_EXPR, TREE_TYPE (exp), arg0, arg1); + break; + + case COND_EXPR: + arg0 = fold_strip_sign_ops (TREE_OPERAND (exp, 1)); + arg1 = fold_strip_sign_ops (TREE_OPERAND (exp, 2)); + if (arg0 || arg1) + return fold_build3 (COND_EXPR, TREE_TYPE (exp), TREE_OPERAND (exp, 0), + arg0 ? arg0 : TREE_OPERAND (exp, 1), + arg1 ? arg1 : TREE_OPERAND (exp, 2)); + break; + case CALL_EXPR: /* Strip sign ops from the argument of "odd" math functions. */ if (negate_mathfn_p (builtin_mathfn_code (exp))) |