| 1 |
/* { dg-do run { target *-*-*gnu* } } */ |
| 2 |
/* { dg-additional-options "-fno-tree-sink -fno-math-errno -ftree-vectorize -D_GNU_SOURCE" } */ |
| 3 |
/* { dg-require-effective-target fenv_exceptions } */ |
| 4 |
|
| 5 |
#include <fenv.h> |
| 6 |
|
| 7 |
double a[2]; |
| 8 |
void __attribute__((noipa)) foo () |
| 9 |
{ |
| 10 |
double x = a[0]; |
| 11 |
double y = a[1]; |
| 12 |
double norm = __builtin_sqrt (x*x + y*y); |
| 13 |
if (norm > 1.) |
| 14 |
{ |
| 15 |
x = x / norm; |
| 16 |
y = y / norm; |
| 17 |
} |
| 18 |
a[0] = x; |
| 19 |
a[1] = y; |
| 20 |
} |
| 21 |
|
| 22 |
int main() |
| 23 |
{ |
| 24 |
feenableexcept (FE_INVALID); |
| 25 |
a[0] = 0.; |
| 26 |
a[1] = 0.; |
| 27 |
foo (); |
| 28 |
if (a[0] != 0. || a[1] != 0.) |
| 29 |
__builtin_abort (); |
| 30 |
return 0; |
| 31 |
} |