| 1 |
/* { dg-do run { target { powerpc*-*-linux* } } } */ |
| 2 |
/* { dg-options "-O2 -ftree-vectorize" } */ |
| 3 |
|
| 4 |
/* Verify it can run successfully, especially on Power10 and later. */ |
| 5 |
|
| 6 |
#define _GNU_SOURCE |
| 7 |
#include <fenv.h> |
| 8 |
|
| 9 |
__attribute__ ((noipa)) void |
| 10 |
div (double *d, double *s, int n) |
| 11 |
{ |
| 12 |
for (; n; n--, d++, s++) |
| 13 |
*d = *d / *s; |
| 14 |
} |
| 15 |
|
| 16 |
int main() |
| 17 |
{ |
| 18 |
double d[] = {1,2,3,4,5,6,7,8,9,10,11}; |
| 19 |
double s[] = {11,10,9,8,7,6,5,4,3,2,1}; |
| 20 |
|
| 21 |
feenableexcept(FE_DIVBYZERO|FE_INVALID); |
| 22 |
div(d, s, 11); |
| 23 |
|
| 24 |
int i; |
| 25 |
for (i = 0; i < 11; i++) |
| 26 |
__builtin_printf(" %f", d[i]); |
| 27 |
|
| 28 |
__builtin_printf("\n"); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |