| 1 |
/* Disabling epilogues until we find a better way to deal with scans. */ |
| 2 |
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */ |
| 3 |
/* { dg-require-effective-target vect_int } */ |
| 4 |
/* { dg-additional-options "-fno-tree-scev-cprop" } */ |
| 5 |
|
| 6 |
#include "tree-vect.h" |
| 7 |
|
| 8 |
/* Statement in SLP vectorization used outside the loop. |
| 9 |
NOTE: SCEV disabled to ensure the live operation is not removed before |
| 10 |
vectorization. */ |
| 11 |
#define LIVELOOP(RET) \ |
| 12 |
__attribute__ ((noinline)) int \ |
| 13 |
liveloop##RET (int n, int *x, int *y) \ |
| 14 |
{ \ |
| 15 |
int n0, n1, n2, n3, j; \ |
| 16 |
for (j = 0; j < n; ++j) \ |
| 17 |
{ \ |
| 18 |
n0 = x[(j*4)]; \ |
| 19 |
n1 = x[(j*4)+1]; \ |
| 20 |
n2 = x[(j*4)+2]; \ |
| 21 |
n3 = x[(j*4)+3]; \ |
| 22 |
y[(j*4)] = n0 + 1; \ |
| 23 |
y[(j*4)+1] = n1 + 2; \ |
| 24 |
y[(j*4)+2] = n2 + 3; \ |
| 25 |
y[(j*4)+3] = n3 + 4; \ |
| 26 |
} \ |
| 27 |
return n##RET; \ |
| 28 |
} |
| 29 |
|
| 30 |
LIVELOOP (0) |
| 31 |
LIVELOOP (1) |
| 32 |
LIVELOOP (2) |
| 33 |
LIVELOOP (3) |
| 34 |
typedef int (*FP)(int n, int *x, int *y); |
| 35 |
const FP llf[]= {&liveloop0, &liveloop1, &liveloop2, &liveloop3}; |
| 36 |
|
| 37 |
#define MAX 113 |
| 38 |
|
| 39 |
int |
| 40 |
main (void) |
| 41 |
{ |
| 42 |
int a[MAX*4]; |
| 43 |
int b[MAX*4]; |
| 44 |
int i; |
| 45 |
|
| 46 |
check_vect (); |
| 47 |
|
| 48 |
for (i=0; i<MAX*4; i++) |
| 49 |
{ |
| 50 |
__asm__ volatile (""); |
| 51 |
a[i] = i; |
| 52 |
} |
| 53 |
|
| 54 |
#pragma GCC novector |
| 55 |
for (i=0; i<4; i++) |
| 56 |
{ |
| 57 |
__asm__ volatile (""); |
| 58 |
|
| 59 |
int ret = llf[i] (MAX, a, b); |
| 60 |
|
| 61 |
if (ret != (MAX * 4) - 4 + i) |
| 62 |
abort (); |
| 63 |
|
| 64 |
#pragma GCC novector |
| 65 |
for (i=0; i<MAX*4; i++) |
| 66 |
{ |
| 67 |
__asm__ volatile (""); |
| 68 |
if (b[i] != i + (i%4) + 1) |
| 69 |
abort (); |
| 70 |
} |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */ |
| 75 |
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */ |
| 76 |
/* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 4 "vect" } } */ |