public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/112431] RISC-V GCC-15 feature: Support register overlap on widen RVV instructions
Date: Thu, 30 Nov 2023 12:11:43 +0000	[thread overview]
Message-ID: <bug-112431-4-RVl8vhpY8b@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112431-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112431

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pan Li <panli@gcc.gnu.org>:

https://gcc.gnu.org/g:303195e2a6b6f0e8f42e0578b61f9f37c6250beb

commit r14-6008-g303195e2a6b6f0e8f42e0578b61f9f37c6250beb
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Thu Nov 30 20:08:43 2023 +0800

    RISC-V: Support widening register overlap for vf4/vf8

    size_t
    foo (char const *buf, size_t len)
    {
      size_t sum = 0;
      size_t vl = __riscv_vsetvlmax_e8m8 ();
      size_t step = vl * 4;
      const char *it = buf, *end = buf + len;
      for (; it + step <= end;)
        {
          vint8m1_t v0 = __riscv_vle8_v_i8m1 ((void *) it, vl);
          it += vl;
          vint8m1_t v1 = __riscv_vle8_v_i8m1 ((void *) it, vl);
          it += vl;
          vint8m1_t v2 = __riscv_vle8_v_i8m1 ((void *) it, vl);
          it += vl;
          vint8m1_t v3 = __riscv_vle8_v_i8m1 ((void *) it, vl);
          it += vl;

          asm volatile("nop" ::: "memory");
          vint64m8_t vw0 = __riscv_vsext_vf8_i64m8 (v0, vl);
          vint64m8_t vw1 = __riscv_vsext_vf8_i64m8 (v1, vl);
          vint64m8_t vw2 = __riscv_vsext_vf8_i64m8 (v2, vl);
          vint64m8_t vw3 = __riscv_vsext_vf8_i64m8 (v3, vl);

          asm volatile("nop" ::: "memory");
          size_t sum0 = __riscv_vmv_x_s_i64m8_i64 (vw0);
          size_t sum1 = __riscv_vmv_x_s_i64m8_i64 (vw1);
          size_t sum2 = __riscv_vmv_x_s_i64m8_i64 (vw2);
          size_t sum3 = __riscv_vmv_x_s_i64m8_i64 (vw3);

          sum += sumation (sum0, sum1, sum2, sum3);
        }
      return sum;
    }

    Before this patch:

            add     a3,s0,s1
            add     a4,s6,s1
            add     a5,s7,s1
            vsetvli zero,s0,e64,m8,ta,ma
            vle8.v  v4,0(s1)
            vle8.v  v3,0(a3)
            mv      s1,s2
            vle8.v  v2,0(a4)
            vle8.v  v1,0(a5)
            nop
            vsext.vf8       v8,v4
            vsext.vf8       v16,v2
            vs8r.v  v8,0(sp)
            vsext.vf8       v24,v1
            vsext.vf8       v8,v3
            nop
            vmv.x.s a1,v8
            vl8re64.v       v8,0(sp)
            vmv.x.s a3,v24
            vmv.x.s a2,v16
            vmv.x.s a0,v8
            add     s2,s2,s5
            call    sumation
            add     s3,s3,a0
            bgeu    s4,s2,.L5

    After this patch:

            add     a3,s0,s1
            add     a4,s6,s1
            add     a5,s7,s1
            vsetvli zero,s0,e64,m8,ta,ma
            vle8.v  v15,0(s1)
            vle8.v  v23,0(a3)
            mv      s1,s2
            vle8.v  v31,0(a4)
            vle8.v  v7,0(a5)
            vsext.vf8       v8,v15
            vsext.vf8       v16,v23
            vsext.vf8       v24,v31
            vsext.vf8       v0,v7
            vmv.x.s a3,v0
            vmv.x.s a2,v24
            vmv.x.s a1,v16
            vmv.x.s a0,v8
            add     s2,s2,s5
            call    sumation
            add     s3,s3,a0
            bgeu    s4,s2,.L5

            PR target/112431

    gcc/ChangeLog:

            * config/riscv/vector.md: Add widening overlap of vf2/vf4.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/rvv/base/pr112431-16.c: New test.
            * gcc.target/riscv/rvv/base/pr112431-17.c: New test.
            * gcc.target/riscv/rvv/base/pr112431-18.c: New test.

  parent reply	other threads:[~2023-11-30 12:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08  0:15 [Bug c/112431] New: " juzhe.zhong at rivai dot ai
2023-11-08  0:16 ` [Bug c/112431] " juzhe.zhong at rivai dot ai
2023-11-08  0:16 ` juzhe.zhong at rivai dot ai
2023-11-08  1:56 ` kito at gcc dot gnu.org
2023-11-12 21:18 ` pinskia at gcc dot gnu.org
2023-11-29  9:37 ` [Bug target/112431] " cvs-commit at gcc dot gnu.org
2023-11-30  1:16 ` cvs-commit at gcc dot gnu.org
2023-11-30  2:40 ` cvs-commit at gcc dot gnu.org
2023-11-30 10:50 ` cvs-commit at gcc dot gnu.org
2023-11-30 12:11 ` cvs-commit at gcc dot gnu.org [this message]
2023-12-01 12:09 ` cvs-commit at gcc dot gnu.org
2023-12-01 12:09 ` cvs-commit at gcc dot gnu.org
2023-12-04 10:45 ` cvs-commit at gcc dot gnu.org
2023-12-04 11:21 ` juzhe.zhong at rivai dot ai
2023-12-04 13:36 ` cvs-commit at gcc dot gnu.org
2023-12-04 13:48 ` cvs-commit at gcc dot gnu.org
2023-12-11  7:56 ` cvs-commit at gcc dot gnu.org

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-112431-4-RVl8vhpY8b@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: link
Be 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).