| 1 |
/* { dg-do run { target { riscv_v } } } */ |
| 2 |
/* For some reason we exceed |
| 3 |
the default code model's +-2 GiB limits. We should investigate why and |
| 4 |
add a proper description here. For now just make sure the test case |
| 5 |
compiles properly. */ |
| 6 |
/* { dg-additional-options "-mcmodel=medany" } */ |
| 7 |
|
| 8 |
#include "gather_load_64-8.c" |
| 9 |
#include <assert.h> |
| 10 |
|
| 11 |
int |
| 12 |
main (void) |
| 13 |
{ |
| 14 |
#define RUN_LOOP(DATA_TYPE, BITS) \ |
| 15 |
DATA_TYPE dest_##DATA_TYPE[128]; \ |
| 16 |
DATA_TYPE dest2_##DATA_TYPE[128]; \ |
| 17 |
DATA_TYPE src_##DATA_TYPE[128]; \ |
| 18 |
INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \ |
| 19 |
for (int i = 0; i < 128; i++) \ |
| 20 |
{ \ |
| 21 |
dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ |
| 22 |
dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \ |
| 23 |
src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \ |
| 24 |
indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \ |
| 25 |
} \ |
| 26 |
f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \ |
| 27 |
indices_##DATA_TYPE##_##BITS); \ |
| 28 |
for (int i = 0; i < 128; i++) \ |
| 29 |
assert (dest_##DATA_TYPE[i] \ |
| 30 |
== (dest2_##DATA_TYPE[i] \ |
| 31 |
+ src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]])); |
| 32 |
|
| 33 |
RUN_LOOP (int8_t, 32) |
| 34 |
RUN_LOOP (uint8_t, 32) |
| 35 |
RUN_LOOP (int16_t, 32) |
| 36 |
RUN_LOOP (uint16_t, 32) |
| 37 |
RUN_LOOP (_Float16, 32) |
| 38 |
RUN_LOOP (int32_t, 32) |
| 39 |
RUN_LOOP (uint32_t, 32) |
| 40 |
RUN_LOOP (float, 32) |
| 41 |
RUN_LOOP (int64_t, 32) |
| 42 |
RUN_LOOP (uint64_t, 32) |
| 43 |
RUN_LOOP (double, 32) |
| 44 |
return 0; |
| 45 |
} |