1 /* { dg-do compile { target { le } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p8vector_ok } */
4 /* { dg-options "-mdejagnu-cpu=power8 -O2" } */
5
6 /* Verify fix for problem where vec_xl and vec_xst are not recognized
7 for the vector char and vector short cases on P8 only.
8 This test duplicates p8-vec-xl-xst.c , except that it allows gimple-folding,
9 which changes the expected codegen. */
10
11 #include <altivec.h>
12
13 vector unsigned char
foo(unsigned char * address)14 foo (unsigned char * address)
15 {
16 return __builtin_vec_xl (0, address);
17 }
18
19 void
bar(vector unsigned char x,unsigned char * address)20 bar (vector unsigned char x, unsigned char * address)
21 {
22 __builtin_vec_xst (x, 0, address);
23 }
24
25 vector unsigned short
foot(unsigned short * address)26 foot (unsigned short * address)
27 {
28 return __builtin_vec_xl (0, address);
29 }
30
31 void
bart(vector unsigned short x,unsigned short * address)32 bart (vector unsigned short x, unsigned short * address)
33 {
34 __builtin_vec_xst (x, 0, address);
35 }
36
37 vector unsigned char
fool(unsigned char * address)38 fool (unsigned char * address)
39 {
40 return vec_xl (0, address);
41 }
42
43 void
barl(vector unsigned char x,unsigned char * address)44 barl (vector unsigned char x, unsigned char * address)
45 {
46 vec_xst (x, 0, address);
47 }
48
49 vector unsigned short
footle(unsigned short * address)50 footle (unsigned short * address)
51 {
52 return vec_xl (0, address);
53 }
54
55 void
bartle(vector unsigned short x,unsigned short * address)56 bartle (vector unsigned short x, unsigned short * address)
57 {
58 vec_xst (x, 0, address);
59 }
60
61 /* { dg-final { scan-assembler-times {\mlxvd2x\M} 4 } } */
62 /* { dg-final { scan-assembler-times {\mstxvd2x\M} 4 } } */
63