+2006-12-14 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/30198
+ * fold-const.c (fold_unary): Fold REALPART_EXPR of cexpi to cos.
+ Fold IMAGPART_EXPR of cexpi to sin.
+
2006-12-14 Dorit Nuzman <dorit@il.ibm.com>
Trevor Smigiel <trevor_smigiel@playstation.sony.com>
tem = fold_build1 (REALPART_EXPR, itype, TREE_OPERAND (arg0, 0));
return fold_convert (type, tem);
}
+ if (TREE_CODE (arg0) == CALL_EXPR)
+ {
+ tree fn = get_callee_fndecl (arg0);
+ if (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);
+ return build_function_call_expr (fn, TREE_OPERAND (arg0, 1));
+
+ default:;
+ }
+ }
return NULL_TREE;
case IMAGPART_EXPR:
tem = fold_build1 (IMAGPART_EXPR, itype, TREE_OPERAND (arg0, 0));
return fold_convert (type, negate_expr (tem));
}
+ if (TREE_CODE (arg0) == CALL_EXPR)
+ {
+ tree fn = get_callee_fndecl (arg0);
+ if (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);
+ return build_function_call_expr (fn, TREE_OPERAND (arg0, 1));
+
+ default:;
+ }
+ }
return NULL_TREE;
default:
+2006-12-14 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/30198
+ * gcc.dg/builtins-60.c: New testcase.
+
2006-12-14 Dorit Nuzman <dorit@il.ibm.com>
* lib/target-supports.exp (vect_no_align): Remove spu.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-gimple" } */
+
+double test1 (double x)
+{
+ return __real __builtin_cexpi (x);
+}
+
+double test2 (double x)
+{
+ return __imag __builtin_cexpi (x);
+}
+
+/* { dg-final { scan-tree-dump "cos" "gimple" } } */
+/* { dg-final { scan-tree-dump "sin" "gimple" } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */