SVE Intrinsics: Change return type of redirect_call to gcall.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-perm-8.c
blob029be5485b62ffef915f3b6b28306501852733d7
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #if VECTOR_BITS > 512
7 #define N (VECTOR_BITS * 6 / 16)
8 #else
9 #define N 200
10 #endif
12 void __attribute__((noinline))
13 foo (unsigned char *__restrict__ pInput, unsigned char *__restrict__ pOutput)
15 unsigned char a, b, c;
16 unsigned int i;
18 for (i = 0; i < N / 3; i++)
20 a = *pInput++;
21 b = *pInput++;
22 c = *pInput++;
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];
34 unsigned int i;
36 check_vect ();
38 for (i = 0; i < N; i++)
40 input[i] = i;
41 output[i] = 0;
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");
53 foo (input, output);
55 #pragma GCC novector
56 for (i = 0; i < N - (N % 3); i++)
57 if (output[i] != check_results[i])
58 abort ();
60 return 0;
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_load_lanes } && { { ! 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_load_lanes } && { vect_partial_vectors_usage_1 && { ! s390_vx } } } } } } } */
67 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
68 /* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_byte && vect_load_lanes } } } } */
69 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
70 /* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */