diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2015-08-31 15:58:03 +0200 |
---|---|---|
committer | Marc Glisse <glisse@gcc.gnu.org> | 2015-08-31 13:58:03 +0000 |
commit | 77c028c5229627905a5ae17726868561bdd65da8 (patch) | |
tree | c26fa5f5145de35b67986eba639c14373a7fd516 /gcc/fold-const.c | |
parent | eaef98f3afdda197bc052c4a341d7a3529a77106 (diff) | |
download | gcc-77c028c5229627905a5ae17726868561bdd65da8.zip gcc-77c028c5229627905a5ae17726868561bdd65da8.tar.gz gcc-77c028c5229627905a5ae17726868561bdd65da8.tar.bz2 |
Move some complex simplifications to match.pd
2015-08-31 Marc Glisse <marc.glisse@inria.fr>
gcc/
* match.pd (SIN, COS, TAN, COSH): Reorder for consistency.
(CEXPI): New operator list.
(real (conj (x)), imag (conj (x)), real (x +- y), real (cexpi (x)),
imag (cexpi (x)), conj (conj (x)), conj (complex (x, y))):
Converted from ...
* fold-const.c (fold_unary_loc, fold_binary_loc): ... here. Remove.
gcc/testsuite/
* gcc.dg/tree-ssa/complex-7.c: New file.
From-SVN: r227343
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c826e67..a5d58a8 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7732,21 +7732,6 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) } return NULL_TREE; - case CONJ_EXPR: - if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE) - return fold_convert_loc (loc, type, arg0); - if (TREE_CODE (arg0) == COMPLEX_EXPR) - { - tree itype = TREE_TYPE (type); - tree rpart = fold_convert_loc (loc, itype, TREE_OPERAND (arg0, 0)); - tree ipart = fold_convert_loc (loc, itype, TREE_OPERAND (arg0, 1)); - return fold_build2_loc (loc, COMPLEX_EXPR, type, rpart, - negate_expr (ipart)); - } - if (TREE_CODE (arg0) == CONJ_EXPR) - return fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0)); - return NULL_TREE; - case BIT_NOT_EXPR: /* Convert ~(X ^ Y) to ~X ^ Y or X ^ ~Y if ~X or ~Y simplify. */ if (TREE_CODE (arg0) == BIT_XOR_EXPR @@ -7776,81 +7761,6 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) return NULL_TREE; return fold_convert_loc (loc, type, tem); - case REALPART_EXPR: - if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE) - return fold_convert_loc (loc, type, arg0); - if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR) - { - tree itype = TREE_TYPE (TREE_TYPE (arg0)); - tem = fold_build2_loc (loc, TREE_CODE (arg0), itype, - fold_build1_loc (loc, REALPART_EXPR, itype, - TREE_OPERAND (arg0, 0)), - fold_build1_loc (loc, REALPART_EXPR, itype, - TREE_OPERAND (arg0, 1))); - return fold_convert_loc (loc, type, tem); - } - if (TREE_CODE (arg0) == CONJ_EXPR) - { - tree itype = TREE_TYPE (TREE_TYPE (arg0)); - tem = fold_build1_loc (loc, REALPART_EXPR, itype, - TREE_OPERAND (arg0, 0)); - return fold_convert_loc (loc, type, tem); - } - if (TREE_CODE (arg0) == CALL_EXPR) - { - tree fn = get_callee_fndecl (arg0); - if (fn && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL) - switch (DECL_FUNCTION_CODE (fn)) - { - CASE_FLT_FN (BUILT_IN_CEXPI): - fn = mathfn_built_in (type, BUILT_IN_COS); - if (fn) - return build_call_expr_loc (loc, fn, 1, CALL_EXPR_ARG (arg0, 0)); - break; - - default: - break; - } - } - return NULL_TREE; - - case IMAGPART_EXPR: - if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE) - return build_zero_cst (type); - if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR) - { - tree itype = TREE_TYPE (TREE_TYPE (arg0)); - tem = fold_build2_loc (loc, TREE_CODE (arg0), itype, - fold_build1_loc (loc, IMAGPART_EXPR, itype, - TREE_OPERAND (arg0, 0)), - fold_build1_loc (loc, IMAGPART_EXPR, itype, - TREE_OPERAND (arg0, 1))); - return fold_convert_loc (loc, type, tem); - } - if (TREE_CODE (arg0) == CONJ_EXPR) - { - tree itype = TREE_TYPE (TREE_TYPE (arg0)); - tem = fold_build1_loc (loc, IMAGPART_EXPR, itype, TREE_OPERAND (arg0, 0)); - return fold_convert_loc (loc, type, negate_expr (tem)); - } - if (TREE_CODE (arg0) == CALL_EXPR) - { - tree fn = get_callee_fndecl (arg0); - if (fn && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL) - switch (DECL_FUNCTION_CODE (fn)) - { - CASE_FLT_FN (BUILT_IN_CEXPI): - fn = mathfn_built_in (type, BUILT_IN_SIN); - if (fn) - return build_call_expr_loc (loc, fn, 1, CALL_EXPR_ARG (arg0, 0)); - break; - - default: - break; - } - } - return NULL_TREE; - case INDIRECT_REF: /* Fold *&X to X if X is an lvalue. */ if (TREE_CODE (op0) == ADDR_EXPR) |