1 /* { dg-do assemble { target aarch64_asm_sve_ok } } */
2 /* { dg-options "-O2 -ftree-vectorize --save-temps" } */
3 
4 #include <stdint.h>
5 
6 void __attribute__ ((noinline, noclone))
clrsb_32(unsigned int * restrict dst,uint32_t * restrict src,int size)7 clrsb_32 (unsigned int *restrict dst, uint32_t *restrict src, int size)
8 {
9   for (int i = 0; i < size; ++i)
10     dst[i] = __builtin_clrsb (src[i]);
11 }
12 
13 void __attribute__ ((noinline, noclone))
clrsb_64(unsigned int * restrict dst,uint64_t * restrict src,int size)14 clrsb_64 (unsigned int *restrict dst, uint64_t *restrict src, int size)
15 {
16   for (int i = 0; i < size; ++i)
17     dst[i] = __builtin_clrsbll (src[i]);
18 }
19 
20 /* { dg-final { scan-assembler-times {\tcls\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s\n} 1 } } */
21 /* { dg-final { scan-assembler-times {\tcls\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d\n} 2 } } */
22 /* { dg-final { scan-assembler-times {\tuzp1\tz[0-9]+\.s, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
23