| 1 |
/* { dg-do run { target { riscv_v } } } */ |
| 2 |
/* { dg-additional-options "-std=c99 -fno-vect-cost-model -mrvv-vector-bits=zvl -ffast-math" } */ |
| 3 |
|
| 4 |
#include "ctz-template.h" |
| 5 |
|
| 6 |
#include <assert.h> |
| 7 |
#include <stdio.h> |
| 8 |
|
| 9 |
#define SZ 126 |
| 10 |
|
| 11 |
#define RUN(TYPE) \ |
| 12 |
TYPE dst##TYPE[SZ]; \ |
| 13 |
TYPE a##TYPE[SZ]; \ |
| 14 |
for (int i = 0; i < SZ; i++) \ |
| 15 |
{ \ |
| 16 |
dst##TYPE[i] = 0; \ |
| 17 |
a##TYPE[i] = i + 1; \ |
| 18 |
} \ |
| 19 |
vctz_##TYPE (dst##TYPE, a##TYPE, SZ); \ |
| 20 |
for (int i = 0; i < SZ; i++) \ |
| 21 |
assert (dst##TYPE[i] == __builtin_ctz (a##TYPE[i]));\ |
| 22 |
|
| 23 |
#define RUN_ALL() \ |
| 24 |
RUN (uint8_t) \ |
| 25 |
RUN (int8_t) \ |
| 26 |
RUN (int16_t) \ |
| 27 |
RUN (uint16_t) \ |
| 28 |
RUN (int32_t) \ |
| 29 |
RUN (uint32_t) \ |
| 30 |
//RUN (int64_t) \ |
| 31 |
//RUN (uint64_t) |
| 32 |
|
| 33 |
int main () |
| 34 |
{ |
| 35 |
RUN_ALL() |
| 36 |
} |