https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128245
--- Comment #2 from Hao Du (杜浩) <hd701108 at gmail dot com> --- Created attachment 66375 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66375&action=edit C testcase (preprocessed, trunk 20261201) Here is a C testcase that triggers it (preprocessed version attached): #include <riscv_vector.h> void f (int32_t *out, const int32_t *in, const vbool64_t *mask_in) { vbool64_t mask = *mask_in; /* maskedoff operand: the mask register reinterpreted as data */ vint32mf2_t mo = __riscv_vlmul_trunc_v_i32m1_i32mf2 ( __riscv_vreinterpret_v_u32m1_i32m1 ( __riscv_vreinterpret_v_u8m1_u32m1 (__riscv_vreinterpret_v_b64_u8m1 (mask)))); vint32mf2_t v = __riscv_vle32_v_i32mf2_tumu (mask, mo, in, 13); *(vint32mf2_t *) out = v; } With -O2 -march=rv64gcv -mabi=lp64d, trunk (gcc 17.0.0 20261201 (experimental) (crosstool-NG UNKNOWN) , Compiler Explorer) emits vle32.v v0,0(a1),v0.t so the masked load has v0 as both destination and mask. GCC 14.2.0, 15.2.0 and 16.2.0 emit the same instruction. Hao Du (杜浩, GitHub snozzz, [email protected]) Tong Liu (刘通, GitHub I3eg1nner, [email protected])
