| 1 |
/* { dg-require-effective-target vect_shift } */ |
| 2 |
/* { dg-require-effective-target vect_int } */ |
| 3 |
|
| 4 |
#include <stdarg.h> |
| 5 |
#include <stdint.h> |
| 6 |
#include "tree-vect.h" |
| 7 |
|
| 8 |
#define N 32 |
| 9 |
|
| 10 |
int32_t A[N]; |
| 11 |
int32_t B[N]; |
| 12 |
|
| 13 |
#define FN(name) \ |
| 14 |
__attribute__((noipa)) \ |
| 15 |
void name(int32_t *a) \ |
| 16 |
{ \ |
| 17 |
for (int i = 0; i < N / 2; i++) \ |
| 18 |
{ \ |
| 19 |
a[2 * i + 0] <<= i; \ |
| 20 |
a[2 * i + 1] <<= i; \ |
| 21 |
} \ |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
FN(foo_vec) |
| 26 |
|
| 27 |
#pragma GCC push_options |
| 28 |
#pragma GCC optimize ("O0") |
| 29 |
FN(foo_novec) |
| 30 |
#pragma GCC pop_options |
| 31 |
|
| 32 |
int main () |
| 33 |
{ |
| 34 |
int i; |
| 35 |
|
| 36 |
check_vect (); |
| 37 |
|
| 38 |
#pragma GCC novector |
| 39 |
for (i = 0; i < N; i++) |
| 40 |
A[i] = B[i] = -(i + 1); |
| 41 |
|
| 42 |
foo_vec(A); |
| 43 |
foo_novec(B); |
| 44 |
|
| 45 |
/* check results: */ |
| 46 |
#pragma GCC novector |
| 47 |
for (i = 0; i < N; i++) |
| 48 |
if (A[i] != B[i]) |
| 49 |
abort (); |
| 50 |
|
| 51 |
return 0; |
| 52 |
} |