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 M01 1322
10 #define M11 13
11 #define M21 27271
12 #define M02 74
13 #define M12 191
14 #define M22 500
15
16 #define K00 405
17 #define K10 112
18 #define K01 4322
19 #define K11 135
20
21 #define N 16
22
foo(int * __restrict__ pInput,int * __restrict__ pOutput,int * __restrict__ pInput2,int * __restrict__ pOutput2)23 void foo (int *__restrict__ pInput, int *__restrict__ pOutput,
24 int *__restrict__ pInput2, int *__restrict__ pOutput2)
25 {
26 int i, a, b, c, d, e;
27
28 for (i = 0; i < N / 3; i++)
29 {
30 a = *pInput++;
31 b = *pInput++;
32 c = *pInput++;
33
34 d = *pInput2++;
35 e = *pInput2++;
36
37 *pOutput++ = M00 * a + M01 * b + M02 * c;
38 *pOutput++ = M10 * a + M11 * b + M12 * c;
39 *pOutput++ = M20 * a + M21 * b + M22 * c;
40
41 *pOutput2++ = K00 * d + K01 * e;
42 *pOutput2++ = K10 * d + K11 * e;
43 }
44 }
45
main(int argc,const char * argv[])46 int main (int argc, const char* argv[])
47 {
48 int input[N], output[N], i;
49 int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0};
50 int input2[N], output2[N];
51 int check_results2[N] = {4322, 135, 13776, 629, 23230, 1123, 32684, 1617, 42138, 2111, 0, 0, 0, 0, 0, 0};
52
53 check_vect ();
54
55 check_vect ();
56
57 for (i = 0; i < N; i++)
58 {
59 input[i] = i%256;
60 input2[i] = i%256;
61 output[i] = 0;
62 output2[i] = 0;
63 __asm__ volatile ("");
64 }
65
66 foo (input, output, input2, output2);
67
68 for (i = 0; i < N; i++)
69 if (output[i] != check_results[i] || output2[i] != check_results2[i])
70 abort ();
71
72 return 0;
73 }
74
75 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */
76 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_perm } } } */
77 /* { dg-final { cleanup-tree-dump "vect" } } */
78
79
80