| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
#define M00 100 |
| 7 |
#define M10 216 |
| 8 |
#define M01 1322 |
| 9 |
#define M11 13 |
| 10 |
#define M02 74 |
| 11 |
#define M12 191 |
| 12 |
|
| 13 |
#define N 16 |
| 14 |
|
| 15 |
void __attribute__((noinline)) |
| 16 |
foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput) |
| 17 |
{ |
| 18 |
unsigned int i, a, b; |
| 19 |
|
| 20 |
for (i = 0; i < N / 2; i++) |
| 21 |
{ |
| 22 |
a = *pInput++; |
| 23 |
b = *pInput++; |
| 24 |
|
| 25 |
*pOutput++ = M00 * a + M01 * b; |
| 26 |
*pOutput++ = M10 * a + M11 * b; |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
int main (int argc, const char* argv[]) |
| 31 |
{ |
| 32 |
unsigned int input[N], output[N], i; |
| 33 |
unsigned int check_results[N] = {1322, 13, 4166, 471, 7010, 929, 9854, 1387, 12698, 1845, 15542, 2303, 18386, 2761, 21230, 3219}; |
| 34 |
|
| 35 |
check_vect (); |
| 36 |
|
| 37 |
for (i = 0; i < N; i++) |
| 38 |
{ |
| 39 |
input[i] = i%256; |
| 40 |
output[i] = 0; |
| 41 |
__asm__ volatile (""); |
| 42 |
} |
| 43 |
|
| 44 |
foo (input, output); |
| 45 |
|
| 46 |
#pragma GCC novector |
| 47 |
for (i = 0; i < N; i++) |
| 48 |
{ |
| 49 |
if (output[i] != check_results[i]) |
| 50 |
abort (); |
| 51 |
__asm__ volatile (""); |
| 52 |
} |
| 53 |
|
| 54 |
return 0; |
| 55 |
} |
| 56 |
|
| 57 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ |
| 58 |
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm || vect_load_lanes } } } } */ |
| 59 |
/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */ |
| 60 |
/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */ |