* gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-perm-8.c
blobf804dcc8163c34bf9ebdebf020b00263bd31a455
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 200
8 void __attribute__((noinline))
9 foo (unsigned char *__restrict__ pInput, unsigned char *__restrict__ pOutput)
11 unsigned char i, a, b, c;
13 for (i = 0; i < N / 3; i++)
15 a = *pInput++;
16 b = *pInput++;
17 c = *pInput++;
19 *pOutput++ = a + b + c + 3;
20 *pOutput++ = a + b + c + 12;
21 *pOutput++ = a + b + c + 1;
25 int main (int argc, const char* argv[])
27 unsigned char input[N], output[N], i;
28 unsigned char check_results[N];
30 check_vect ();
32 for (i = 0; i < N; i++)
34 input[i] = i;
35 output[i] = 0;
36 __asm__ volatile ("");
39 for (i = 0; i < N / 3; i++)
41 check_results[3*i] = 9 * i + 6;
42 check_results[3*i+1] = 9 * i + 15;
43 check_results[3*i+2] = 9 * i + 4;
44 __asm__ volatile ("" : : : "memory");
47 foo (input, output);
49 for (i = 0; i < N - (N % 3); i++)
50 if (output[i] != check_results[i])
51 abort ();
53 return 0;
56 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_byte } } } } */
57 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm_byte && {! vect_load_lanes } } } } } */
58 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */
59 /* { dg-final { scan-tree-dump "note: Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm_byte && vect_load_lanes } } } } */
60 /* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
61 /* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */