| 1 |
/* { dg-do run { target { riscv_v } } } */ |
| 2 |
|
| 3 |
|
| 4 |
#include "gather_load_64-12.c" |
| 5 |
#include <assert.h> |
| 6 |
|
| 7 |
int |
| 8 |
main (void) |
| 9 |
{ |
| 10 |
/* FIXME: The purpose of this assembly is to ensure that the vtype register is |
| 11 |
initialized befor instructions such as vmv1r.v are executed. Otherwise you |
| 12 |
will get illegal instruction errors when running with spike+pk. This is an |
| 13 |
interim solution for reduce unnecessary failures and a unified solution |
| 14 |
will come later. */ |
| 15 |
asm volatile("vsetivli x0, 0, e8, m1, ta, ma"); |
| 16 |
#define RUN_LOOP(DATA_TYPE, INDEX_TYPE) \ |
| 17 |
DATA_TYPE dest_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ |
| 18 |
DATA_TYPE src_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ |
| 19 |
INDEX_TYPE index_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \ |
| 20 |
for (int i = 0; i < 202; i++) \ |
| 21 |
{ \ |
| 22 |
src_##DATA_TYPE##_##INDEX_TYPE[i] \ |
| 23 |
= (DATA_TYPE) ((i * 19 + 735) & (sizeof (DATA_TYPE) * 7 - 1)); \ |
| 24 |
index_##DATA_TYPE##_##INDEX_TYPE[i] = (i * 7) % (55); \ |
| 25 |
} \ |
| 26 |
f_##DATA_TYPE##_##INDEX_TYPE (dest_##DATA_TYPE##_##INDEX_TYPE, \ |
| 27 |
src_##DATA_TYPE##_##INDEX_TYPE, \ |
| 28 |
index_##DATA_TYPE##_##INDEX_TYPE); \ |
| 29 |
for (int i = 0; i < 100; i++) \ |
| 30 |
{ \ |
| 31 |
assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2] \ |
| 32 |
== (src_##DATA_TYPE##_##INDEX_TYPE \ |
| 33 |
[index_##DATA_TYPE##_##INDEX_TYPE[i * 2]] \ |
| 34 |
+ 1)); \ |
| 35 |
assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1] \ |
| 36 |
== (src_##DATA_TYPE##_##INDEX_TYPE \ |
| 37 |
[index_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1]] \ |
| 38 |
+ 2)); \ |
| 39 |
} |
| 40 |
|
| 41 |
RUN_LOOP (int8_t, int8_t) |
| 42 |
RUN_LOOP (uint8_t, int8_t) |
| 43 |
RUN_LOOP (int16_t, int8_t) |
| 44 |
RUN_LOOP (uint16_t, int8_t) |
| 45 |
RUN_LOOP (int32_t, int8_t) |
| 46 |
RUN_LOOP (uint32_t, int8_t) |
| 47 |
RUN_LOOP (int64_t, int8_t) |
| 48 |
RUN_LOOP (uint64_t, int8_t) |
| 49 |
RUN_LOOP (_Float16, int8_t) |
| 50 |
RUN_LOOP (float, int8_t) |
| 51 |
RUN_LOOP (double, int8_t) |
| 52 |
RUN_LOOP (int8_t, int16_t) |
| 53 |
RUN_LOOP (uint8_t, int16_t) |
| 54 |
RUN_LOOP (int16_t, int16_t) |
| 55 |
RUN_LOOP (uint16_t, int16_t) |
| 56 |
RUN_LOOP (int32_t, int16_t) |
| 57 |
RUN_LOOP (uint32_t, int16_t) |
| 58 |
RUN_LOOP (int64_t, int16_t) |
| 59 |
RUN_LOOP (uint64_t, int16_t) |
| 60 |
RUN_LOOP (_Float16, int16_t) |
| 61 |
RUN_LOOP (float, int16_t) |
| 62 |
RUN_LOOP (double, int16_t) |
| 63 |
RUN_LOOP (int8_t, int32_t) |
| 64 |
RUN_LOOP (uint8_t, int32_t) |
| 65 |
RUN_LOOP (int16_t, int32_t) |
| 66 |
RUN_LOOP (uint16_t, int32_t) |
| 67 |
RUN_LOOP (int32_t, int32_t) |
| 68 |
RUN_LOOP (uint32_t, int32_t) |
| 69 |
RUN_LOOP (int64_t, int32_t) |
| 70 |
RUN_LOOP (uint64_t, int32_t) |
| 71 |
RUN_LOOP (_Float16, int32_t) |
| 72 |
RUN_LOOP (float, int32_t) |
| 73 |
RUN_LOOP (double, int32_t) |
| 74 |
RUN_LOOP (int8_t, int64_t) |
| 75 |
RUN_LOOP (uint8_t, int64_t) |
| 76 |
RUN_LOOP (int16_t, int64_t) |
| 77 |
RUN_LOOP (uint16_t, int64_t) |
| 78 |
RUN_LOOP (int32_t, int64_t) |
| 79 |
RUN_LOOP (uint32_t, int64_t) |
| 80 |
RUN_LOOP (int64_t, int64_t) |
| 81 |
RUN_LOOP (uint64_t, int64_t) |
| 82 |
RUN_LOOP (_Float16, int64_t) |
| 83 |
RUN_LOOP (float, int64_t) |
| 84 |
RUN_LOOP (double, int64_t) |
| 85 |
RUN_LOOP (int8_t, uint8_t) |
| 86 |
RUN_LOOP (uint8_t, uint8_t) |
| 87 |
RUN_LOOP (int16_t, uint8_t) |
| 88 |
RUN_LOOP (uint16_t, uint8_t) |
| 89 |
RUN_LOOP (int32_t, uint8_t) |
| 90 |
RUN_LOOP (uint32_t, uint8_t) |
| 91 |
RUN_LOOP (int64_t, uint8_t) |
| 92 |
RUN_LOOP (uint64_t, uint8_t) |
| 93 |
RUN_LOOP (_Float16, uint8_t) |
| 94 |
RUN_LOOP (float, uint8_t) |
| 95 |
RUN_LOOP (double, uint8_t) |
| 96 |
RUN_LOOP (int8_t, uint16_t) |
| 97 |
RUN_LOOP (uint8_t, uint16_t) |
| 98 |
RUN_LOOP (int16_t, uint16_t) |
| 99 |
RUN_LOOP (uint16_t, uint16_t) |
| 100 |
RUN_LOOP (int32_t, uint16_t) |
| 101 |
RUN_LOOP (uint32_t, uint16_t) |
| 102 |
RUN_LOOP (int64_t, uint16_t) |
| 103 |
RUN_LOOP (uint64_t, uint16_t) |
| 104 |
RUN_LOOP (_Float16, uint16_t) |
| 105 |
RUN_LOOP (float, uint16_t) |
| 106 |
RUN_LOOP (double, uint16_t) |
| 107 |
RUN_LOOP (int8_t, uint32_t) |
| 108 |
RUN_LOOP (uint8_t, uint32_t) |
| 109 |
RUN_LOOP (int16_t, uint32_t) |
| 110 |
RUN_LOOP (uint16_t, uint32_t) |
| 111 |
RUN_LOOP (int32_t, uint32_t) |
| 112 |
RUN_LOOP (uint32_t, uint32_t) |
| 113 |
RUN_LOOP (int64_t, uint32_t) |
| 114 |
RUN_LOOP (uint64_t, uint32_t) |
| 115 |
RUN_LOOP (_Float16, uint32_t) |
| 116 |
RUN_LOOP (float, uint32_t) |
| 117 |
RUN_LOOP (double, uint32_t) |
| 118 |
RUN_LOOP (int8_t, uint64_t) |
| 119 |
RUN_LOOP (uint8_t, uint64_t) |
| 120 |
RUN_LOOP (int16_t, uint64_t) |
| 121 |
RUN_LOOP (uint16_t, uint64_t) |
| 122 |
RUN_LOOP (int32_t, uint64_t) |
| 123 |
RUN_LOOP (uint32_t, uint64_t) |
| 124 |
RUN_LOOP (int64_t, uint64_t) |
| 125 |
RUN_LOOP (uint64_t, uint64_t) |
| 126 |
RUN_LOOP (_Float16, uint64_t) |
| 127 |
RUN_LOOP (float, uint64_t) |
| 128 |
RUN_LOOP (double, uint64_t) |
| 129 |
return 0; |
| 130 |
} |