1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p9vector_ok } */
4 /* { dg-options "-mdejagnu-cpu=power9 -O2" } */
5 
6 #include <altivec.h>
7 
8 vector signed char
count_trailing_zeros_v16qi_1s(vector signed char a)9 count_trailing_zeros_v16qi_1s (vector signed char a)
10 {
11   return vec_vctz (a);
12 }
13 
14 vector signed char
count_trailing_zeros_v16qi_2s(vector signed char a)15 count_trailing_zeros_v16qi_2s (vector signed char a)
16 {
17   return vec_vctzb (a);
18 }
19 
20 vector unsigned char
count_trailing_zeros_v16qi_1u(vector unsigned char a)21 count_trailing_zeros_v16qi_1u (vector unsigned char a)
22 {
23   return vec_vctz (a);
24 }
25 
26 vector unsigned char
count_trailing_zeros_v16qi_2u(vector unsigned char a)27 count_trailing_zeros_v16qi_2u (vector unsigned char a)
28 {
29   return vec_vctzb (a);
30 }
31 
32 vector short
count_trailing_zeros_v8hi_1s(vector short a)33 count_trailing_zeros_v8hi_1s (vector short a)
34 {
35   return vec_vctz (a);
36 }
37 
38 vector short
count_trailing_zeros_v8hi_2s(vector short a)39 count_trailing_zeros_v8hi_2s (vector short a)
40 {
41   return vec_vctzh (a);
42 }
43 
44 vector unsigned short
count_trailing_zeros_v8hi_1u(vector unsigned short a)45 count_trailing_zeros_v8hi_1u (vector unsigned short a)
46 {
47   return vec_vctz (a);
48 }
49 
50 vector unsigned short
count_trailing_zeros_v8hi_2u(vector unsigned short a)51 count_trailing_zeros_v8hi_2u (vector unsigned short a)
52 {
53   return vec_vctzh (a);
54 }
55 
56 vector int
count_trailing_zeros_v4si_1s(vector int a)57 count_trailing_zeros_v4si_1s (vector int a)
58 {
59   return vec_vctz (a);
60 }
61 
62 vector int
count_trailing_zeros_v4si_2s(vector int a)63 count_trailing_zeros_v4si_2s (vector int a)
64 {
65   return vec_vctzw (a);
66 }
67 
68 vector unsigned int
count_trailing_zeros_v4si_1u(vector unsigned int a)69 count_trailing_zeros_v4si_1u (vector unsigned int a)
70 {
71   return vec_vctz (a);
72 }
73 
74 vector unsigned int
count_trailing_zeros_v4si_2u(vector unsigned int a)75 count_trailing_zeros_v4si_2u (vector unsigned int a)
76 {
77   return vec_vctzw (a);
78 }
79 
80 vector long long
count_trailing_zeros_v2di_1s(vector long long a)81 count_trailing_zeros_v2di_1s (vector long long a)
82 {
83   return vec_vctz (a);
84 }
85 
86 vector long long
count_trailing_zeros_v2di_2s(vector long long a)87 count_trailing_zeros_v2di_2s (vector long long a)
88 {
89   return vec_vctzd (a);
90 }
91 
92 vector unsigned long long
count_trailing_zeros_v2di_1u(vector unsigned long long a)93 count_trailing_zeros_v2di_1u (vector unsigned long long a)
94 {
95   return vec_vctz (a);
96 }
97 
98 vector unsigned long long
count_trailing_zeros_v2di_2u(vector unsigned long long a)99 count_trailing_zeros_v2di_2u (vector unsigned long long a)
100 {
101   return vec_vctzd (a);
102 }
103 
104 /* { dg-final { scan-assembler "vctzb" } } */
105 /* { dg-final { scan-assembler "vctzd" } } */
106 /* { dg-final { scan-assembler "vctzh" } } */
107 /* { dg-final { scan-assembler "vctzw" } } */
108 /* { dg-final { scan-assembler-not "cnttzd" } } */
109 /* { dg-final { scan-assembler-not "cnttzw" } } */
110