| 1 |
/* { dg-do run { target { riscv_v } } } */ |
| 2 |
|
| 3 |
|
| 4 |
#include "mask_scatter_store_64-6.c" |
| 5 |
#include <assert.h> |
| 6 |
|
| 7 |
int |
| 8 |
main (void) |
| 9 |
{ |
| 10 |
#define RUN_LOOP(DATA_TYPE, BITS) \ |
| 11 |
DATA_TYPE dest_##DATA_TYPE[128]; \ |
| 12 |
DATA_TYPE dest2_##DATA_TYPE[128]; \ |
| 13 |
DATA_TYPE src_##DATA_TYPE[128]; \ |
| 14 |
INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ |
| 15 |
INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \ |
| 16 |
for (int i = 0; i < 128; i++) \ |
| 17 |
{ \ |
| 18 |
dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ |
| 19 |
dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ |
| 20 |
src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ |
| 21 |
indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ |
| 22 |
cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \ |
| 23 |
} \ |
| 24 |
f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ |
| 25 |
indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \ |
| 26 |
for (int i = 0; i < 128; i++) \ |
| 27 |
{ \ |
| 28 |
if (cond_##DATA_TYPE##_##BITS[i]) \ |
| 29 |
assert (dest_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]] \ |
| 30 |
== (src_##DATA_TYPE[i] + 1)); \ |
| 31 |
else \ |
| 32 |
assert (dest_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]] \ |
| 33 |
== dest2_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]]); \ |
| 34 |
} |
| 35 |
|
| 36 |
RUN_LOOP (int8_t, 16) |
| 37 |
RUN_LOOP (uint8_t, 16) |
| 38 |
RUN_LOOP (int16_t, 16) |
| 39 |
RUN_LOOP (uint16_t, 16) |
| 40 |
RUN_LOOP (_Float16, 16) |
| 41 |
RUN_LOOP (int32_t, 16) |
| 42 |
RUN_LOOP (uint32_t, 16) |
| 43 |
RUN_LOOP (float, 16) |
| 44 |
RUN_LOOP (int64_t, 16) |
| 45 |
RUN_LOOP (uint64_t, 16) |
| 46 |
RUN_LOOP (double, 16) |
| 47 |
return 0; |
| 48 |
} |