| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target riscv_v_ok } */ |
| 3 |
/* { dg-add-options riscv_v } */ |
| 4 |
/* { dg-additional-options "-O0" } */ |
| 5 |
|
| 6 |
#include <riscv_vector.h> |
| 7 |
#include <vector> |
| 8 |
#define a 36 |
| 9 |
|
| 10 |
uint8_t e[a], x[a]; |
| 11 |
int64_t f[a], g[a], l[a]; |
| 12 |
float j[a], k[a], m[a]; |
| 13 |
|
| 14 |
int main() { |
| 15 |
for (int i = 0; i < a; ++i) { e[i]=1; g[i] = 86; x[i] = 86; } |
| 16 |
for (size_t n = 0, avl = a; avl;) { |
| 17 |
size_t o = __riscv_vsetvl_e64m8(avl); |
| 18 |
vuint8m1_t p = __riscv_vle8_v_u8m1(&e[n], o); |
| 19 |
vbool8_t q = __riscv_vmseq_vx_u8m1_b8(p, 1, o); |
| 20 |
vuint64m8_t r = __riscv_vsll_vx_u64m8(__riscv_vid_v_u64m8(o), 3, o); |
| 21 |
vint64m8_t s = __riscv_vluxei64_v_i64m8_tum( |
| 22 |
__riscv_vlm_v_b8(std::vector<uint8_t>(o + 7).data(), o), |
| 23 |
__riscv_vmv_v_x_i64m8(0, __riscv_vsetvlmax_e16m2()), &f[n], r, o); |
| 24 |
vuint32m4_t t = __riscv_vsll_vx_u32m4(__riscv_vid_v_u32m4(o), 3, o); |
| 25 |
vint64m8_t u = __riscv_vluxei32(&g[n], t, o); |
| 26 |
vbool8_t v = __riscv_vlm_v_b8(&x[n], o); |
| 27 |
__riscv_vle32ff_v_f32m4_mu(q, __riscv_vfmv_v_f_f32m4(0, __riscv_vsetvlmax_e8m1()), &j[n], &o, o); |
| 28 |
vfloat32m1_t w = __riscv_vfmv_v_f_f32m1(0, __riscv_vsetvlmax_e32m1()); |
| 29 |
vfloat32m1_t aa = __riscv_vle32_v_f32m1_tu(w, &k[n], o); |
| 30 |
s = __riscv_vcompress_vm_i64m8_tu(s, u, v, o); |
| 31 |
vfloat32mf2_t ab = __riscv_vlmul_trunc_v_f32m1_f32mf2(aa); |
| 32 |
vuint64m8_t ac = __riscv_vsll_vx_u64m8(__riscv_vid_v_u64m8(o), 3, o); |
| 33 |
__riscv_vsuxei64_v_i64m8(&l[n], ac, s, o); |
| 34 |
__riscv_vse32_v_f32mf2(&m[n], ab, o); |
| 35 |
avl -= o; |
| 36 |
} |
| 37 |
|
| 38 |
/* Results are inconsistent between different VLENs. |
| 39 |
"n" never changes so we will always store into l[0...] with a length of |
| 40 |
"o". What differs is "s". |
| 41 |
At zvl128b and zvl256b we have more than one loop iteration and |
| 42 |
"s" will be {86, 86, -1, -1} or {86, 86, 0, 0} depending on the |
| 43 |
tail/mask policy. |
| 44 |
At zvl512b there is only one iteration and s = {86, 86, 86, ...}. |
| 45 |
I cross checked with clang and this seems correct. |
| 46 |
Therefore only check l's fifth element. |
| 47 |
The actual PR is about fault-only-first loads and the wrong code |
| 48 |
caused element 5 to be incorrect as well. */ |
| 49 |
if (l[5] != 86) |
| 50 |
__builtin_abort (); |
| 51 |
} |