1 /* { dg-require-effective-target vect_int } */
7 #define N (VECTOR_BITS * 6 / 16)
12 void __attribute__((noinline
))
13 foo (unsigned char *__restrict__ pInput
, unsigned char *__restrict__ pOutput
)
15 unsigned char a
, b
, c
;
18 for (i
= 0; i
< N
/ 3; i
++)
24 *pOutput
++ = a
+ b
+ c
+ 3;
25 *pOutput
++ = a
+ b
+ c
+ 12;
26 *pOutput
++ = a
+ b
+ c
+ 1;
30 int main (int argc
, const char* argv
[])
32 unsigned char input
[N
], output
[N
];
33 unsigned char check_results
[N
];
38 for (i
= 0; i
< N
; i
++)
42 __asm__
volatile ("");
45 for (i
= 0; i
< N
/ 3; i
++)
47 check_results
[3*i
] = 9 * i
+ 6;
48 check_results
[3*i
+1] = 9 * i
+ 15;
49 check_results
[3*i
+2] = 9 * i
+ 4;
50 __asm__
volatile ("" : : : "memory");
56 for (i
= 0; i
< N
- (N
% 3); i
++)
57 if (output
[i
] != check_results
[i
])
63 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_byte } } } } */
64 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_byte && { { ! vect_partial_vectors_usage_1 } || s390_vx } } } } } */
65 /* The epilogues are vectorized using partial vectors. */
66 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_byte && { vect_partial_vectors_usage_1 && { ! s390_vx } } } } } } */
67 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
68 /* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */