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/112401] RISC-V: So many redundant move instructions due to subreg handling on vector mode
Date: Mon, 06 Nov 2023 03:53:21 +0000	[thread overview]
Message-ID: <bug-112401-4-j5NM62sjJ6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112401-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from JuzheZhong <juzhe.zhong at rivai dot ai> ---
GCC ASM:

subreg_to_reg_1:
        li      a5,32
        vsetvli zero,a5,e32,m8,ta,ma
        vle32.v v16,0(a0)
        vmv1r.v v8,v16
        vmv1r.v v7,v17
        vmv1r.v v6,v18
        vmv1r.v v5,v19
        vmv1r.v v4,v20
        vmv1r.v v3,v21
        vmv1r.v v2,v22
        vmv1r.v v1,v23
        beq     a2,zero,.L2
        li      a5,0
        vsetivli        zero,4,e32,m1,ta,ma
.L3:
        addi    a5,a5,1
        vadd.vv v8,v8,v8
        vadd.vv v7,v7,v7
        vadd.vv v6,v6,v6
        vadd.vv v5,v5,v5
        vadd.vv v4,v4,v4
        vadd.vv v3,v3,v3
        vadd.vv v2,v2,v2
        vadd.vv v1,v1,v1
        bne     a2,a5,.L3
.L2:
        vs1r.v  v8,0(a1)
        addi    a5,a1,16
        vs1r.v  v7,0(a5)
        addi    a5,a1,32
        vs1r.v  v6,0(a5)
        addi    a5,a1,48
        vs1r.v  v5,0(a5)
        addi    a5,a1,64
        vs1r.v  v4,0(a5)
        addi    a5,a1,80
        vs1r.v  v3,0(a5)
        addi    a5,a1,96
        vs1r.v  v2,0(a5)
        addi    a1,a1,112
        vs1r.v  v1,0(a1)
        ret

LLVM ASM:

subreg_to_reg_1:                        # @subreg_to_reg_1
        li      a3, 32
        vsetvli zero, a3, e32, m8, ta, ma
        vle32.v v8, (a0)
        addi    a0, a1, 16
        beqz    a2, .LBB0_2
.LBB0_1:                                # =>This Inner Loop Header: Depth=1
        vsetivli        zero, 4, e32, m1, ta, ma
        vadd.vv v8, v8, v8
        vadd.vv v9, v9, v9
        vadd.vv v10, v10, v10
        vadd.vv v11, v11, v11
        vadd.vv v12, v12, v12
        vadd.vv v13, v13, v13
        vadd.vv v14, v14, v14
        addi    a2, a2, -1
        vadd.vv v15, v15, v15
        bnez    a2, .LBB0_1
.LBB0_2:
        vs1r.v  v8, (a1)
        vs1r.v  v9, (a0)
        addi    a1, a0, 16
        vs1r.v  v10, (a1)
        addi    a1, a0, 32
        vs1r.v  v11, (a1)
        addi    a1, a0, 48
        vs1r.v  v12, (a1)
        addi    a1, a0, 64
        vs1r.v  v13, (a1)
        addi    a1, a0, 80
        vs1r.v  v14, (a1)
        addi    a0, a0, 96
        vs1r.v  v15, (a0)
        ret

  reply	other threads:[~2023-11-06  3:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06  3:52 [Bug c/112401] New: " juzhe.zhong at rivai dot ai
2023-11-06  3:53 ` juzhe.zhong at rivai dot ai [this message]
2024-01-18  1:27 ` [Bug rtl-optimization/112401] " juzhe.zhong at rivai dot ai
2024-01-18  1:28 ` 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-112401-4-j5NM62sjJ6@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).