Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / vect / slp-perm-8.c
blobd211ef943b394e568f0bc3d906afeb1d713f4660
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 200
8 void foo (unsigned char *__restrict__ pInput, unsigned char *__restrict__ pOutput)
10 unsigned char i, a, b, c;
12 for (i = 0; i < N / 3; i++)
14 a = *pInput++;
15 b = *pInput++;
16 c = *pInput++;
18 *pOutput++ = a + b + c + 3;
19 *pOutput++ = a + b + c + 12;
20 *pOutput++ = a + b + c + 1;
24 int main (int argc, const char* argv[])
26 unsigned char input[N], output[N], i;
27 unsigned char check_results[N];
29 check_vect ();
31 for (i = 0; i < N; i++)
33 input[i] = i;
34 output[i] = 0;
35 if (input[i] > 256)
36 abort ();
39 for (i = 0; i < N / 3; i++)
41 check_results[3*i] = 9 * i + 6;
42 check_results[3*i+1] = 9 * i + 15;
43 check_results[3*i+2] = 9 * i + 4;
46 foo (input, output);
48 for (i = 0; i < N - (N % 3); i++)
49 if (output[i] != check_results[i])
50 abort ();
52 return 0;
55 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_perm_byte } } } */
56 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm_byte } } } */
57 /* { dg-final { cleanup-tree-dump "vect" } } */