+2011-03-16 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/48149
+ * fold-const.c (fold_binary_loc): Fold
+ COMPLEX_EXPR <REALPART_EXPR <x>, IMAGPART_EXPR <x>>.
+
2011-03-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/26134
|| (TREE_CODE (arg0) == INTEGER_CST
&& TREE_CODE (arg1) == INTEGER_CST))
return build_complex (type, arg0, arg1);
+ if (TREE_CODE (arg0) == REALPART_EXPR
+ && TREE_CODE (arg1) == IMAGPART_EXPR
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg0, 0)))
+ == TYPE_MAIN_VARIANT (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;
case ASSERT_EXPR:
+2011-03-16 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/48149
+ * gcc.dg/fold-complex-1.c: New testcase.
+
2011-03-16 Richard Guenther <rguenther@suse.de>
PR testsuite/48147
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -ffast-math -fdump-tree-original" } */
+
+_Complex float
+foo (_Complex float x)
+{
+ return __real x + 1.0iF * __imag x;
+}
+
+/* { dg-final { scan-tree-dump-times "COMPLEX_EXPR" 0 "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */