| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target arm_v8_1m_mve_ok } */ |
| 3 |
/* { dg-add-options arm_v8_1m_mve } */ |
| 4 |
/* { dg-additional-options "-O3" } */ |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
#define FUNC(SIGN, TYPE, BITS, NAME) \ |
| 9 |
void test_ ## NAME ##_ ## SIGN ## BITS (TYPE##BITS##_t * __restrict__ dest, \ |
| 10 |
TYPE##BITS##_t *a) { \ |
| 11 |
int i; \ |
| 12 |
for (i=0; i < (128 / BITS); i++) { \ |
| 13 |
dest[i] = (TYPE##BITS##_t)__builtin_clz(a[i]); \ |
| 14 |
} \ |
| 15 |
} |
| 16 |
|
| 17 |
FUNC(s, int, 32, clz) |
| 18 |
FUNC(u, uint, 32, clz) |
| 19 |
FUNC(s, int, 16, clz) |
| 20 |
FUNC(u, uint, 16, clz) |
| 21 |
FUNC(s, int, 8, clz) |
| 22 |
FUNC(u, uint, 8, clz) |
| 23 |
|
| 24 |
/* 16 and 8-bit versions are not vectorized because they need pack/unpack |
| 25 |
patterns since __builtin_clz uses 32-bit parameter and return value. */ |
| 26 |
/* { dg-final { scan-assembler-times {vclz\.i32\tq[0-9]+, q[0-9]+} 2 } } */ |
| 27 |
/* { dg-final { scan-assembler-times {vclz\.i16\tq[0-9]+, q[0-9]+} 2 { xfail *-*-* } } } */ |
| 28 |
/* { dg-final { scan-assembler-times {vclz\.i8\tq[0-9]+, q[0-9]+} 2 { xfail *-*-* } } } */ |