[gcc]
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / ctz-4.c
blob618ecedf5815e3ad4e9319bd0714e3e9519e3039
1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p9vector_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
5 /* { dg-options "-mcpu=power9 -O2" } */
7 #include <altivec.h>
9 vector signed char
10 count_trailing_zeros_v16qi_1s (vector signed char a)
12 return vec_vctz (a);
15 vector signed char
16 count_trailing_zeros_v16qi_2s (vector signed char a)
18 return vec_vctzb (a);
21 vector unsigned char
22 count_trailing_zeros_v16qi_1u (vector unsigned char a)
24 return vec_vctz (a);
27 vector unsigned char
28 count_trailing_zeros_v16qi_2u (vector unsigned char a)
30 return vec_vctzb (a);
33 vector short
34 count_trailing_zeros_v8hi_1s (vector short a)
36 return vec_vctz (a);
39 vector short
40 count_trailing_zeros_v8hi_2s (vector short a)
42 return vec_vctzh (a);
45 vector unsigned short
46 count_trailing_zeros_v8hi_1u (vector unsigned short a)
48 return vec_vctz (a);
51 vector unsigned short
52 count_trailing_zeros_v8hi_2u (vector unsigned short a)
54 return vec_vctzh (a);
57 vector int
58 count_trailing_zeros_v4si_1s (vector int a)
60 return vec_vctz (a);
63 vector int
64 count_trailing_zeros_v4si_2s (vector int a)
66 return vec_vctzw (a);
69 vector unsigned int
70 count_trailing_zeros_v4si_1u (vector unsigned int a)
72 return vec_vctz (a);
75 vector unsigned int
76 count_trailing_zeros_v4si_2u (vector unsigned int a)
78 return vec_vctzw (a);
81 vector long long
82 count_trailing_zeros_v2di_1s (vector long long a)
84 return vec_vctz (a);
87 vector long long
88 count_trailing_zeros_v2di_2s (vector long long a)
90 return vec_vctzd (a);
93 vector unsigned long long
94 count_trailing_zeros_v2di_1u (vector unsigned long long a)
96 return vec_vctz (a);
99 vector unsigned long long
100 count_trailing_zeros_v2di_2u (vector unsigned long long a)
102 return vec_vctzd (a);
105 /* { dg-final { scan-assembler "vctzb" } } */
106 /* { dg-final { scan-assembler "vctzd" } } */
107 /* { dg-final { scan-assembler "vctzh" } } */
108 /* { dg-final { scan-assembler "vctzw" } } */
109 /* { dg-final { scan-assembler-not "cnttzd" } } */
110 /* { dg-final { scan-assembler-not "cnttzw" } } */