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