OSDN Git Service

gcc/testsuite
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / slp-perm-4.c
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 M40 437
11
12 #define M01 1322
13 #define M11 13
14 #define M21 27271
15 #define M31 2280
16 #define M41 284
17
18 #define M02 74
19 #define M12 191
20 #define M22 500
21 #define M32 111
22 #define M42 1114
23
24 #define M03 134
25 #define M13 117
26 #define M23 11
27 #define M33 771
28 #define M43 71
29
30 #define M04 334
31 #define M14 147
32 #define M24 115
33 #define M34 7716
34 #define M44 16
35
36 #define N 16
37
38 void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput)
39 {
40   unsigned int i, a, b, c, d, e;
41
42   for (i = 0; i < N / 5; i++)
43     {
44        a = *pInput++;
45        b = *pInput++;
46        c = *pInput++;
47        d = *pInput++;
48        e = *pInput++;
49
50        *pOutput++ = M00 * a + M01 * b + M02 * c + M03 * d + M04 * e;
51        *pOutput++ = M10 * a + M11 * b + M12 * c + M13 * d + M14 * e;
52        *pOutput++ = M20 * a + M21 * b + M22 * c + M23 * d + M24 * e;
53        *pOutput++ = M30 * a + M31 * b + M32 * c + M33 * d + M34 * e;
54        *pOutput++ = M40 * a + M41 * b + M42 * c + M43 * d + M44 * e;
55     }
56 }
57
58 int main (int argc, const char* argv[])
59 {
60   unsigned int input[N], output[N], i;
61   unsigned int check_results[N] = {3208, 1334, 28764, 35679, 2789, 13028, 4754, 168364, 91254, 12399, 22848, 8174, 307964, 146829, 22009, 0};
62
63   check_vect ();
64
65   for (i = 0; i < N; i++)
66     {
67       input[i] = i%256;
68       if (input[i] > 200)
69         abort();
70       output[i] = 0;
71       __asm__ volatile ("");
72     }
73
74   foo (input, output);
75
76   for (i = 0; i < N; i++)
77     if (output[i] != check_results[i])
78       abort ();
79
80   return 0;
81 }
82
83 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect"  } } */
84 /* { dg-final { scan-tree-dump "permutation requires at least three vectors" "vect" { target vect_perm} } } */
85 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect"  } } */
86 /* { dg-final { cleanup-tree-dump "vect" } } */
87