1 /* { dg-do compile } */
2 /* { dg-options "-O -ffast-math -fdump-tree-optimized" } */
3 /* { dg-require-effective-target c99_runtime } */
4 
test1(double x)5 double test1 (double x)
6 {
7   return __real __builtin_cexp(x * (__extension__ 1.0iF));
8 }
9 
test2(double x)10 double test2(double x)
11 {
12   return __imag __builtin_cexp((__extension__ 1.0iF) * x);
13 }
14 
test3(double x)15 double test3(double x)
16 {
17   _Complex c = __builtin_cexp(x * (__extension__ 1.0iF));
18   return __imag c + __real c;
19 }
20 
test4(double x,double y)21 double test4(double x, double y)
22 {
23   _Complex c = __builtin_cexp(x);
24   x = __builtin_exp (x);
25   return x - __real c;
26 }
27 
28 /* { dg-final { scan-tree-dump "cexpi" "optimized" } } */
29 /* { dg-final { scan-tree-dump "sin" "optimized" } } */
30 /* { dg-final { scan-tree-dump "cos" "optimized" } } */
31 /* { dg-final { scan-tree-dump "return 0.0" "optimized" } } */
32 /* { dg-final { cleanup-tree-dump "optimized" } } */
33