1 /* { dg-do compile { target { powerpc64le-*-* } } } */
2 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
3 /* { dg-options "-mcpu=power9 -O2" } */
4 /* { dg-require-effective-target powerpc_p9vector_ok } */
5
6 #include <altivec.h>
7
8 vector int
foo_r(int a)9 foo_r (int a)
10 {
11 return (vector int) { a, a, a, a }; /* mtvsrws */
12 }
13
14 vector int
foo_r2(int a)15 foo_r2 (int a)
16 {
17 return vec_splats (a); /* mtvsrws */
18 }
19
20 vector int
foo_p(int * a)21 foo_p (int *a)
22 {
23 return (vector int) { *a, *a, *a, *a }; /* lxvwsx */
24 }
25
26 /* { dg-final { scan-assembler-times "mtvsrws" 2 } } */
27 /* { dg-final { scan-assembler-times "lxvwsx" 1 } } */
28