public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "juzhe.zhong at rivai dot ai" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/112776] New: RISC-V Regression: Missed optimization of VSETVL PASS Date: Thu, 30 Nov 2023 10:08:57 +0000 [thread overview] Message-ID: <bug-112776-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112776 Bug ID: 112776 Summary: RISC-V Regression: Missed optimization of VSETVL PASS Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: juzhe.zhong at rivai dot ai Target Milestone: --- #include "riscv_vector.h" void foo_vec(float *r, const float *x) { int i, k; vfloat32m4_t x_vec; vfloat32m4_t x_forward_vec; vfloat32m4_t temp_vec; /** * I have to use m1 to complicat intrisic */ vfloat32m1_t dst_vec; vfloat32m1_t src_vec; float result = 0.0f; float shift_prev = 0.0f; size_t n = 64; for(size_t vl; n>0; n -=vl){ vl = __riscv_vsetvl_e32m4(n); //LMUL=4 x_vec = __riscv_vle32_v_f32m4(&x[0], vl); x_forward_vec = __riscv_vle32_v_f32m4(&x[0], vl); temp_vec = __riscv_vfmul_vv_f32m4(x_vec, x_forward_vec, vl); /** * I have to use m1 to complicat intrisic */ //vfloat32m1_t __riscv_vfmv_s_tu(vfloat32m1_t vd, float rs1, size_t vl); src_vec = __riscv_vfmv_s_tu(src_vec, 0.0f, vl); //initial src_vec //dst_vec = __riscv_vfmv_s_f_f32m1_tu(dst_vec, 0.0f, vl); //clean for vfredosum dst_vec = __riscv_vfmv_s_tu(dst_vec, 0.0f, vl); //clean for vfredosum dst_vec = __riscv_vfredosum_tu(dst_vec, temp_vec, src_vec, vl); r[0] = __riscv_vfmv_f_s_f32m1_f32(dst_vec); } } ASM: GCC-14 foo_vec: li a4,64 .L2: vsetvli a5,a4,e8,m1,ta,ma ---> vsetvli zero,a5,e32,m1,tu,ma vmv.s.x v2,zero vmv.s.x v1,zero vsetvli zero,a5,e32,m4,tu,ma vle32.v v4,0(a1) vfmul.vv v4,v4,v4 vfredosum.vs v1,v4,v2 vfmv.f.s fa5,v1 fsw fa5,0(a0) sub a4,a4,a5 bne a4,zero,.L2 ret GCC-13: foo_vec(float*, float const*): fmv.s.x fa5,zero li a4,64 .L2: vsetvli a5,a4,e32,m4,ta,ma vle32.v v28,0(a1) vfmv.s.f v25,fa5 vfmul.vv v28,v28,v28 vfmv.s.f v24,fa5 sub a4,a4,a5 vfredosum.vs v24,v28,v25 vfmv.f.s fa4,v24 fsw fa4,0(a0) bne a4,zero,.L2 ret
next reply other threads:[~2023-11-30 10:08 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-11-30 10:08 juzhe.zhong at rivai dot ai [this message] 2023-12-01 6:50 ` [Bug target/112776] " cvs-commit at gcc dot gnu.org 2023-12-01 6:52 ` juzhe.zhong at rivai dot ai
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-112776-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).