]>
Commit | Line | Data |
---|---|---|
a0515226 | 1 | /* { dg-require-effective-target vect_int } */ |
2 | ||
3 | #include <stdarg.h> | |
a0515226 | 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 N 16 | |
17 | ||
18 | void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput) | |
19 | { | |
20 | unsigned int i, a, b, c; | |
21 | ||
22 | for (i = 0; i < N / 3; i++) | |
23 | { | |
24 | a = *pInput++; | |
25 | b = *pInput++; | |
26 | c = *pInput++; | |
27 | ||
28 | *pOutput++ = M00 * a + M01 * b + M02 * c; | |
29 | *pOutput++ = M10 * a + M11 * b + M12 * c; | |
30 | *pOutput++ = M20 * a + M21 * b + M22 * c; | |
31 | } | |
32 | } | |
33 | ||
34 | int main (int argc, const char* argv[]) | |
35 | { | |
36 | unsigned int input[N], output[N], i; | |
37 | unsigned int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0}; | |
38 | ||
775abe9d | 39 | check_vect (); |
40 | ||
a0515226 | 41 | for (i = 0; i < N; i++) |
42 | { | |
43 | input[i] = i%256; | |
a0515226 | 44 | output[i] = 0; |
2259c4d5 | 45 | __asm__ volatile (""); |
a0515226 | 46 | } |
47 | ||
48 | foo (input, output); | |
49 | ||
50 | for (i = 0; i < N; i++) | |
2259c4d5 | 51 | { |
52 | if (output[i] != check_results[i]) | |
53 | abort (); | |
54 | __asm__ volatile (""); | |
55 | } | |
a0515226 | 56 | |
57 | return 0; | |
58 | } | |
59 | ||
60 | /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ | |
44c01906 | 61 | /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm && {! vect_load_lanes } } } } } */ |
62 | /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */ | |
880ed4be | 63 | /* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm && vect_load_lanes } } } } */ |
44c01906 | 64 | /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */ |
65 | /* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */ | |
a0515226 | 66 |