https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115725
--- Comment #10 from JuzheZhong <juzhe.zhong at rivai dot ai> --- (In reply to Robin Dapp from comment #9) > We already merge with operand[0], just the TU is missing as far as I can > tell. > > I'm seeing the following output with my patch: > > vsetivli zero,8,e16,mf4,tu,ma > vle16.v v1,0(a1) > vmv.s.x v1,a2 > vse16.v v1,0(a0) > > That should still be ok because vmv.s.x always only updates the first > element regardless of vl and the rest of the vsets can be fused? > I'm currently on another problem but will get back to this. I see. your codegen is correct and perfect. I believe it is VSETVL PASS doing the fusion, fuse all "vsetvl" according their demand field into a single "vsetvli" and put them since beginning.