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/111720] RISC-V: Ugly codegen in RVV
Date: Thu, 23 Nov 2023 01:20:35 +0000	[thread overview]
Message-ID: <bug-111720-4-nQFU9qcx8w@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111720-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #30 from CVS 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:990769a343f090088f5025ad233f88824b2c6263

commit r14-5769-g990769a343f090088f5025ad233f88824b2c6263
Author: Pan Li <pan2.li@intel.com>
Date:   Mon Nov 13 11:22:37 2023 +0800

    DSE: Allow vector type for get_stored_val when read < store

    Update in v4:
    * Merge upstream and removed some independent changes.

    Update in v3:
    * Take known_le instead of known_lt for vector size.
    * Return NULL_RTX when gap is not equal 0 and not constant.

    Update in v2:
    * Move vector type support to get_stored_val.

    Original log:

    This patch would like to allow the vector mode in the
    get_stored_val in the DSE. It is valid for the read
    rtx if and only if the read bitsize is less than the
    stored bitsize.

    Given below example code with
    --param=riscv-autovec-preference=fixed-vlmax.

    vuint8m1_t test () {
      uint8_t arr[32] = {
        1, 2, 7, 1, 3, 4, 5, 3, 1, 0, 1, 2, 4, 4, 9, 9,
        1, 2, 7, 1, 3, 4, 5, 3, 1, 0, 1, 2, 4, 4, 9, 9,
      };

      return __riscv_vle8_v_u8m1(arr, 32);
    }

    Before this patch:
    test:
      lui     a5,%hi(.LANCHOR0)
      addi    sp,sp,-32
      addi    a5,a5,%lo(.LANCHOR0)
      li      a3,32
      vl2re64.v       v2,0(a5)
      vsetvli zero,a3,e8,m1,ta,ma
      vs2r.v  v2,0(sp)             <== Unnecessary store to stack
      vle8.v  v1,0(sp)             <== Ditto
      vs1r.v  v1,0(a0)
      addi    sp,sp,32
      jr      ra

    After this patch:
    test:
      lui     a5,%hi(.LANCHOR0)
      addi    a5,a5,%lo(.LANCHOR0)
      li      a4,32
      addi    sp,sp,-32
      vsetvli zero,a4,e8,m1,ta,ma
      vle8.v  v1,0(a5)
      vs1r.v  v1,0(a0)
      addi    sp,sp,32
      jr      ra

    Below tests are passed within this patch:
    * The risc-v regression test.
    * The x86 bootstrap and regression test.
    * The aarch64 regression test.

            PR target/111720

    gcc/ChangeLog:

            * dse.cc (get_stored_val): Allow vector mode if read size is
            less than or equal to stored size.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/rvv/base/pr111720-0.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-1.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-10.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-2.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-3.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-4.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-5.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-6.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-7.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-8.c: New test.
            * gcc.target/riscv/rvv/base/pr111720-9.c: New test.

    Signed-off-by: Pan Li <pan2.li@intel.com>

  parent reply	other threads:[~2023-11-23  1:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-07 22:28 [Bug c/111720] New: " juzhe.zhong at rivai dot ai
2023-10-07 22:34 ` [Bug target/111720] " juzhe.zhong at rivai dot ai
2023-10-07 22:36 ` pinskia at gcc dot gnu.org
2023-10-07 22:38 ` juzhe.zhong at rivai dot ai
2023-10-07 22:41 ` juzhe.zhong at rivai dot ai
2023-10-07 22:43 ` juzhe.zhong at rivai dot ai
2023-10-07 22:44 ` pinskia at gcc dot gnu.org
2023-10-07 22:44 ` pinskia at gcc dot gnu.org
2023-10-07 22:47 ` juzhe.zhong at rivai dot ai
2023-10-07 22:49 ` juzhe.zhong at rivai dot ai
2023-10-07 22:51 ` pinskia at gcc dot gnu.org
2023-10-07 22:55 ` juzhe.zhong at rivai dot ai
2023-10-07 23:09 ` juzhe.zhong at rivai dot ai
2023-10-17  8:26 ` juzhe.zhong at rivai dot ai
2023-10-18  3:29 ` pan2.li at intel dot com
2023-10-19  2:07 ` juzhe.zhong at rivai dot ai
2023-10-19  6:37 ` rguenth at gcc dot gnu.org
2023-10-19  7:45 ` juzhe.zhong at rivai dot ai
2023-10-19 11:16 ` rguenth at gcc dot gnu.org
2023-10-19 11:30 ` juzhe.zhong at rivai dot ai
2023-10-19 11:34 ` rguenther at suse dot de
2023-10-19 11:58 ` juzhe.zhong at rivai dot ai
2023-10-19 12:02 ` rguenther at suse dot de
2023-10-19 12:08 ` juzhe.zhong at rivai dot ai
2023-10-19 12:20 ` rguenther at suse dot de
2023-10-19 12:38 ` juzhe.zhong at rivai dot ai
2023-10-19 13:30 ` rguenther at suse dot de
2023-11-01  7:33 ` pan2.li at intel dot com
2023-11-06 10:27 ` rguenth at gcc dot gnu.org
2023-11-06 10:44 ` juzhe.zhong at rivai dot ai
2023-11-23  1:20 ` cvs-commit at gcc dot gnu.org [this message]
2023-11-23  1:29 ` pan2.li at intel dot com

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-111720-4-nQFU9qcx8w@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).