2018-03-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vec-extract-9.c
blob2adadf2195180e5b3c331210c0db85635497507b
1 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p8vector_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
5 /* { dg-options "-O2 -mcpu=power8" } */
7 #include <altivec.h>
9 short
10 add_short_0 (vector short *p)
12 return vec_extract (*p, 0) + 1;
15 short
16 add_short_1 (vector short *p)
18 return vec_extract (*p, 1) + 1;
21 short
22 add_short_2 (vector short *p)
24 return vec_extract (*p, 2) + 1;
27 short
28 add_short_3 (vector short *p)
30 return vec_extract (*p, 3) + 1;
33 short
34 add_short_4 (vector short *p)
36 return vec_extract (*p, 4) + 1;
39 short
40 add_short_5 (vector short *p)
42 return vec_extract (*p, 5) + 1;
45 short
46 add_short_6 (vector short *p)
48 return vec_extract (*p, 6) + 1;
51 short
52 add_short_7 (vector short *p)
54 return vec_extract (*p, 7) + 1;
57 short
58 add_short_n (vector short *p, int n)
60 return vec_extract (*p, n) + 1;
63 /* { dg-final { scan-assembler-not "lxvd2x" } } */
64 /* { dg-final { scan-assembler-not "lxvw4x" } } */
65 /* { dg-final { scan-assembler-not "lxvx" } } */
66 /* { dg-final { scan-assembler-not "lxv" } } */
68 /* With recent enhancements to the code generator, it is considered
69 * legal to implement vec_extract with lvx and xxpermdi. Previous
70 * versions of this test forbid both instructions. */