https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111320
Bug ID: 111320 Summary: RISC-V: Failed combine extend + vfwredosum Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: lehua.ding at rivai dot ai Target Milestone: --- vfwcvt.f.f.v and vfredosum.vs should be combined to vfwredosum.vs C Code: #include <riscv_vector.h> double foo1 (float* restrict a, float* restrict b, int n) { double sum = 0; for (int i = 0; i < n; i += 1) sum += a[i]; return sum; } Assembly Code: foo1: fmv.d.x fa0,zero ble a2,zero,.L4 .L3: vsetvli a5,a2,e64,m1,ta,ma vle32.v v3,0(a0) vfmv.s.f v2,fa0 slli a3,a5,2 vsetvli a4,zero,e32,mf2,ta,ma sub a2,a2,a5 vfwcvt.f.f.v v1,v3 add a0,a0,a3 vsetvli zero,a5,e64,m1,ta,ma vfredosum.vs v1,v1,v2 vfmv.f.s fa0,v1 bne a2,zero,.L3 ret .L4: ret https://godbolt.org/z/dPesPnMWG