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