1 /* { dg-do compile { target le } } */
2 /* { dg-require-effective-target powerpc_p8vector_ok } */
3 /* { dg-options "-mdejagnu-cpu=power8 -O3" } */
4 /* { dg-final { scan-assembler "lxvd2x" } } */
5 /* { dg-final { scan-assembler "stxvd2x" } } */
6 /* { dg-final { scan-assembler-not "xxpermdi" } } */
7 
8 void abort ();
9 
10 #define N 256
11 signed char ca[N] __attribute__((aligned(16)));
12 signed char cb[N] __attribute__((aligned(16)));
13 signed char cc[N] __attribute__((aligned(16)));
14 
foo()15 __attribute__((noinline)) void foo ()
16 {
17   int i;
18   for (i = 0; i < N; i++) {
19     ca[i] = cb[i] - cc[i];
20   }
21 }
22 
init()23 __attribute__((noinline)) void init ()
24 {
25   int i;
26   for (i = 0; i < N; ++i) {
27     cb[i] = i - 128;
28     cc[i] = i/2 - 64;
29   }
30 }
31 
main()32 int main ()
33 {
34   int i;
35   init ();
36   foo ();
37   for (i = 0; i < N; ++i)
38     if (ca[i] != i - i/2 - 64)
39       abort ();
40   return 0;
41 }
42