1 /* { dg-do compile } */
2 /* { dg-require-effective-target power10_ok } */
3 /* { dg-options "-Wno-psabi -mdejagnu-cpu=power10 -O2" } */
4
5 typedef unsigned char vec_t __attribute__((vector_size(16)));
6
7 void
foo(__vector_pair * dst,vec_t * src)8 foo (__vector_pair *dst, vec_t *src)
9 {
10 __vector_pair pair;
11 __builtin_mma_assemble_pair (&pair, src[0], src[4]);
12 *dst = pair;
13 }
14
15 void
foo2(__vector_pair * dst,vec_t * src)16 foo2 (__vector_pair *dst, vec_t *src)
17 {
18 __vector_pair pair;
19 __builtin_vsx_assemble_pair (&pair, src[0], src[4]);
20 *dst = pair;
21 }
22
23 void
foo3(__vector_pair * dst,vec_t * src)24 foo3 (__vector_pair *dst, vec_t *src)
25 {
26 __vector_pair pair;
27 __builtin_vsx_build_pair (&pair, src[4], src[0]);
28 *dst = pair;
29 }
30
31 void
bar(vec_t * dst,__vector_pair * src)32 bar (vec_t *dst, __vector_pair *src)
33 {
34 vec_t res[2];
35 __builtin_mma_disassemble_pair (res, src);
36 dst[0] = res[0];
37 dst[4] = res[1];
38 }
39
40 void
bar2(vec_t * dst,__vector_pair * src)41 bar2 (vec_t *dst, __vector_pair *src)
42 {
43 vec_t res[2];
44 __builtin_vsx_disassemble_pair (res, src);
45 dst[0] = res[0];
46 dst[4] = res[1];
47 }
48
49 #if !__has_builtin (__builtin_vsx_assemble_pair)
50 # error "__has_builtin (__builtin_vsx_assemble_pair) failed"
51 #endif
52
53 #if !__has_builtin (__builtin_vsx_disassemble_pair)
54 # error "__has_builtin (__builtin_vsx_disassemble_pair) failed"
55 #endif
56
57 #if !__has_builtin (__builtin_mma_assemble_pair)
58 # error "__has_builtin (__builtin_mma_assemble_pair) failed"
59 #endif
60
61 #if !__has_builtin (__builtin_mma_disassemble_pair)
62 # error "__has_builtin (__builtin_mma_disassemble_pair) failed"
63 #endif
64
65 #if !__has_builtin (__builtin_vsx_build_pair)
66 # error "__has_builtin (__builtin_vsx_build_pair) failed"
67 #endif
68
69 /* { dg-final { scan-assembler-times {\mlxv\M} 6 } } */
70 /* { dg-final { scan-assembler-times {\mlxvp\M} 2 } } */
71 /* { dg-final { scan-assembler-times {\mstxv\M} 4 } } */
72 /* { dg-final { scan-assembler-times {\mstxvp\M} 3 } } */
73
74