diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2006-11-14 05:08:46 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2006-11-14 05:08:46 +0000 |
commit | b7e85170cf309a3a6e9f3049c61632f7c9284547 (patch) | |
tree | b7ff97c2b5e5d7442bef1008e0d8e9eba4b1c58a /gcc/fold-const.c | |
parent | 833bf445b05c6b15b8d3af23ba965c85e5d7f56a (diff) | |
download | gcc-b7e85170cf309a3a6e9f3049c61632f7c9284547.zip gcc-b7e85170cf309a3a6e9f3049c61632f7c9284547.tar.gz gcc-b7e85170cf309a3a6e9f3049c61632f7c9284547.tar.bz2 |
fold-const.c (fold_strip_sign_ops): Handle COMPOUND_EXPR and COND_EXPR.
* fold-const.c (fold_strip_sign_ops): Handle COMPOUND_EXPR and
COND_EXPR.
testsuite:
* gcc.dg/builtins-20.c: Add more cases.
From-SVN: r118802
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 fe7ec58..eb3b457 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))) |