Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/swaps-p8-22.c

raw
1 /* { dg-do compile { target { *-*-aix* || { *-*-linux* && lp64 } } } } */
2 /* { dg-options "-O2 -mdejagnu-cpu=power8 -mvsx -maltivec -mcmodel=large" } */
3 /* { dg-require-effective-target powerpc_vsx } */
4
5 /* The expansion for vector character multiply introduces a vperm operation.
6 This tests that changing the vperm mask allows us to remove all swaps
7 from the generated code. It is a duplicate of swaps-p8-21.c, except
8 that it applies the large code model, which requires an extra indirection
9 in the load of the constant mask. */
10
11 #include <altivec.h>
12
13 void abort ();
14
15 vector unsigned char r;
16 vector unsigned char v =
17 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
18 vector unsigned char i =
19 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
20
21 int main ()
22 {
23 int j;
24 r = v * i;
25 return 0;
26 }
27
28 /* { dg-final { scan-assembler-times "vperm" 1 } } */
29 /* { dg-final { scan-assembler-not "xxpermdi" } } */