mirror of git://gcc.gnu.org/git/gcc.git
match.pd: Implement simple complex operations cancelling.
2014-11-12 Richard Biener <rguenther@suse.de> * match.pd: Implement simple complex operations cancelling. * fold-const.c (fold_unary_loc): Remove them here. * gcc.dg/tree-ssa/ssa-fre-32.c: Disable forwprop. From-SVN: r217421
This commit is contained in:
parent
2079956a87
commit
eaeba53a03
|
|
@ -1,3 +1,8 @@
|
||||||
|
2014-11-12 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
* match.pd: Implement simple complex operations cancelling.
|
||||||
|
* fold-const.c (fold_unary_loc): Remove them here.
|
||||||
|
|
||||||
2014-11-12 Joseph Myers <joseph@codesourcery.com>
|
2014-11-12 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* cppbuiltin.c (define_builtin_macros_for_compilation_flags):
|
* cppbuiltin.c (define_builtin_macros_for_compilation_flags):
|
||||||
|
|
|
||||||
|
|
@ -7988,9 +7988,6 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
|
||||||
case REALPART_EXPR:
|
case REALPART_EXPR:
|
||||||
if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE)
|
if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE)
|
||||||
return fold_convert_loc (loc, type, arg0);
|
return fold_convert_loc (loc, type, arg0);
|
||||||
if (TREE_CODE (arg0) == COMPLEX_EXPR)
|
|
||||||
return omit_one_operand_loc (loc, type, TREE_OPERAND (arg0, 0),
|
|
||||||
TREE_OPERAND (arg0, 1));
|
|
||||||
if (TREE_CODE (arg0) == COMPLEX_CST)
|
if (TREE_CODE (arg0) == COMPLEX_CST)
|
||||||
return fold_convert_loc (loc, type, TREE_REALPART (arg0));
|
return fold_convert_loc (loc, type, TREE_REALPART (arg0));
|
||||||
if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
|
if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
|
||||||
|
|
@ -8031,9 +8028,6 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
|
||||||
case IMAGPART_EXPR:
|
case IMAGPART_EXPR:
|
||||||
if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE)
|
if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE)
|
||||||
return build_zero_cst (type);
|
return build_zero_cst (type);
|
||||||
if (TREE_CODE (arg0) == COMPLEX_EXPR)
|
|
||||||
return omit_one_operand_loc (loc, type, TREE_OPERAND (arg0, 1),
|
|
||||||
TREE_OPERAND (arg0, 0));
|
|
||||||
if (TREE_CODE (arg0) == COMPLEX_CST)
|
if (TREE_CODE (arg0) == COMPLEX_CST)
|
||||||
return fold_convert_loc (loc, type, TREE_IMAGPART (arg0));
|
return fold_convert_loc (loc, type, TREE_IMAGPART (arg0));
|
||||||
if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
|
if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
|
||||||
|
|
@ -13350,13 +13344,6 @@ fold_binary_loc (location_t loc,
|
||||||
|| (TREE_CODE (arg0) == INTEGER_CST
|
|| (TREE_CODE (arg0) == INTEGER_CST
|
||||||
&& TREE_CODE (arg1) == INTEGER_CST))
|
&& TREE_CODE (arg1) == INTEGER_CST))
|
||||||
return build_complex (type, arg0, arg1);
|
return build_complex (type, arg0, arg1);
|
||||||
if (TREE_CODE (arg0) == REALPART_EXPR
|
|
||||||
&& TREE_CODE (arg1) == IMAGPART_EXPR
|
|
||||||
&& TREE_TYPE (TREE_OPERAND (arg0, 0)) == type
|
|
||||||
&& operand_equal_p (TREE_OPERAND (arg0, 0),
|
|
||||||
TREE_OPERAND (arg1, 0), 0))
|
|
||||||
return omit_one_operand_loc (loc, type, TREE_OPERAND (arg0, 0),
|
|
||||||
TREE_OPERAND (arg1, 0));
|
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
|
|
||||||
case ASSERT_EXPR:
|
case ASSERT_EXPR:
|
||||||
|
|
|
||||||
12
gcc/match.pd
12
gcc/match.pd
|
|
@ -558,3 +558,15 @@ along with GCC; see the file COPYING3. If not see
|
||||||
/* Look through a sign-changing conversion. */
|
/* Look through a sign-changing conversion. */
|
||||||
(if (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (type))
|
(if (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (type))
|
||||||
(convert @0)))
|
(convert @0)))
|
||||||
|
|
||||||
|
|
||||||
|
/* COMPLEX_EXPR and REALPART/IMAGPART_EXPR cancellations. */
|
||||||
|
(simplify
|
||||||
|
(complex (realpart @0) (imagpart @0))
|
||||||
|
@0)
|
||||||
|
(simplify
|
||||||
|
(realpart (complex @0 @1))
|
||||||
|
@0)
|
||||||
|
(simplify
|
||||||
|
(imagpart (complex @0 @1))
|
||||||
|
@1)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
2014-11-12 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
* gcc.dg/tree-ssa/ssa-fre-32.c: Disable forwprop.
|
||||||
|
|
||||||
2014-11-12 Joseph Myers <joseph@codesourcery.com>
|
2014-11-12 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* gcc.dg/no-math-errno-1.c, gcc.dg/no-math-errno-2.c,
|
* gcc.dg/no-math-errno-1.c, gcc.dg/no-math-errno-2.c,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* { dg-do compile } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "-O -fdump-tree-fre1-details" } */
|
/* { dg-options "-O -fno-tree-forwprop -fdump-tree-fre1-details" } */
|
||||||
|
|
||||||
_Complex float m;
|
_Complex float m;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue