Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / vect / slp-perm-2.c
blob1bc95e2e98bfdbea6fc2f1f4448aa5c9716de574
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define M00 100
7 #define M10 216
8 #define M01 1322
9 #define M11 13
10 #define M02 74
11 #define M12 191
13 #define N 16
15 void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput)
17 unsigned int i, a, b;
19 for (i = 0; i < N / 2; i++)
21 a = *pInput++;
22 b = *pInput++;
24 *pOutput++ = M00 * a + M01 * b;
25 *pOutput++ = M10 * a + M11 * b;
29 int main (int argc, const char* argv[])
31 unsigned int input[N], output[N], i;
32 unsigned int check_results[N] = {1322, 13, 4166, 471, 7010, 929, 9854, 1387, 12698, 1845, 15542, 2303, 18386, 2761, 21230, 3219};
34 check_vect ();
36 for (i = 0; i < N; i++)
38 input[i] = i%256;
39 output[i] = 0;
40 __asm__ volatile ("");
43 foo (input, output);
45 for (i = 0; i < N; i++)
47 if (output[i] != check_results[i])
48 abort ();
49 __asm__ volatile ("");
52 return 0;
55 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */
56 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm } } } */
57 /* { dg-final { cleanup-tree-dump "vect" } } */