| 1 |
/* Disabling epilogues until we find a better way to deal with scans. */ |
| 2 |
/* { dg-additional-options "-fdump-tree-optimized-details-blocks --param vect-epilogues-nomask=0" } */ |
| 3 |
/* { dg-require-effective-target vect_int } */ |
| 4 |
|
| 5 |
#include <stdlib.h> |
| 6 |
#include <stdarg.h> |
| 7 |
#include "tree-vect.h" |
| 8 |
|
| 9 |
#if VECTOR_BITS > 256 |
| 10 |
#define NINTS (VECTOR_BITS / 32) |
| 11 |
#else |
| 12 |
#define NINTS 8 |
| 13 |
#endif |
| 14 |
|
| 15 |
#define N (NINTS + 1) |
| 16 |
|
| 17 |
struct extraction |
| 18 |
{ |
| 19 |
int a[N]; |
| 20 |
int b[N]; |
| 21 |
}; |
| 22 |
|
| 23 |
static int a[N] = {1,2,3,4,5,6,7,8,9}; |
| 24 |
static int b[N] = {17,24,7,0,2,3,4,31,82}; |
| 25 |
|
| 26 |
__attribute__ ((noinline)) |
| 27 |
int main1 (int x, int y) { |
| 28 |
int i; |
| 29 |
struct extraction *p; |
| 30 |
p = (struct extraction *) malloc (sizeof (struct extraction)); |
| 31 |
|
| 32 |
for (i = 0; i < N; i++) |
| 33 |
{ |
| 34 |
p->a[i] = a[i]; |
| 35 |
p->b[i] = b[i]; |
| 36 |
asm volatile ("" ::: "memory"); |
| 37 |
} |
| 38 |
|
| 39 |
/* Vectorizable: distance > VF. */ |
| 40 |
for (i = 0; i < N; i++) |
| 41 |
*((int *)p + x + i) = *((int *)p + x + i + NINTS); |
| 42 |
|
| 43 |
/* check results: */ |
| 44 |
if (p->a[0] != a[N - 1]) |
| 45 |
abort (); |
| 46 |
#pragma GCC novector |
| 47 |
for (i = 1; i < N; i++) |
| 48 |
if (p->a[i] != b[i - 1]) |
| 49 |
abort (); |
| 50 |
|
| 51 |
return 0; |
| 52 |
} |
| 53 |
|
| 54 |
int main (void) |
| 55 |
{ |
| 56 |
check_vect (); |
| 57 |
|
| 58 |
return main1 (0, N); |
| 59 |
} |
| 60 |
|
| 61 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |
| 62 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |