| 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 M20 23 |
| 9 |
#define M30 237 |
| 10 |
#define M01 1322 |
| 11 |
#define M11 13 |
| 12 |
#define M21 27271 |
| 13 |
#define M31 2280 |
| 14 |
#define M02 74 |
| 15 |
#define M12 191 |
| 16 |
#define M22 500 |
| 17 |
#define M32 111 |
| 18 |
#define M03 134 |
| 19 |
#define M13 117 |
| 20 |
#define M23 11 |
| 21 |
#define M33 771 |
| 22 |
|
| 23 |
#define N 16 |
| 24 |
|
| 25 |
void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput) |
| 26 |
{ |
| 27 |
unsigned int i, a, b, c, d; |
| 28 |
|
| 29 |
for (i = 0; i < N / 4; i++) |
| 30 |
{ |
| 31 |
a = *pInput++; |
| 32 |
b = *pInput++; |
| 33 |
c = *pInput++; |
| 34 |
d = *pInput++; |
| 35 |
|
| 36 |
*pOutput++ = M00 * a + M01 * b + M02 * c + M03 * d; |
| 37 |
*pOutput++ = M10 * a + M11 * b + M12 * c + M13 * d; |
| 38 |
*pOutput++ = M20 * a + M21 * b + M22 * c + M23 * d; |
| 39 |
*pOutput++ = M30 * a + M31 * b + M32 * c + M33 * d; |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
int main (int argc, const char* argv[]) |
| 44 |
{ |
| 45 |
unsigned int input[N], output[N], i; |
| 46 |
unsigned int check_results[N] = {1872, 746, 28304, 4815, 8392, 2894, 139524, 18411, 14912, 5042, 250744, 32007, 21432, 7190, 361964, 45603}; |
| 47 |
|
| 48 |
check_vect (); |
| 49 |
|
| 50 |
for (i = 0; i < N; i++) |
| 51 |
{ |
| 52 |
input[i] = i%256; |
| 53 |
output[i] = 0; |
| 54 |
__asm__ volatile (""); |
| 55 |
} |
| 56 |
|
| 57 |
foo (input, output); |
| 58 |
|
| 59 |
#pragma GCC novector |
| 60 |
for (i = 0; i < N; i++) |
| 61 |
{ |
| 62 |
if (output[i] != check_results[i]) |
| 63 |
abort (); |
| 64 |
__asm__ volatile (""); |
| 65 |
} |
| 66 |
|
| 67 |
return 0; |
| 68 |
} |
| 69 |
|
| 70 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ |
| 71 |
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm || vect_load_lanes } } } } */ |
| 72 |
/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */ |
| 73 |
/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */ |
| 74 |
|