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 tree-optimization/113441] [14 Regression] Fail to fold the last element with multiple loop
Date: Wed, 17 Jan 2024 12:45:03 +0000	[thread overview]
Message-ID: <bug-113441-4-t7cQhLZun1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113441-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from JuzheZhong <juzhe.zhong at rivai dot ai> ---
GCC trunk RVV also process 11 elements in vector:

https://godbolt.org/z/q9bb8Gj4G

```
vsetivli        zero,11,e32,m1,ta,ma

```
vector codes

```
        lh      s8,0(t4)
        lh      t4,0(t1)
        ld      t1,16(sp)
        add     a3,a4,t1
        lh      a7,0(a7)
        add     t3,a4,s9
        slli    t3,t3,1
        slli    a3,a3,1
        add     t3,a2,t3
        add     a3,a2,a3
        add     a1,a5,t5
        mulw    t0,s6,s8
        lh      t5,0(t3)
        lh      t3,0(a3)
        add     a3,a5,t1
        add     a0,a5,s9
        slli    a0,a0,1
        add     a0,a2,a0
        lh      a0,0(a0)
        slli    a1,a1,1
        add     a1,a2,a1
        mulw    t1,s5,a7
        lh      a1,0(a1)
        slli    a3,a3,1
        add     a3,a2,a3
        lh      a3,0(a3)
        add     a4,s7,a4
        slli    a4,a4,1
        add     a4,t6,a4
        add     a5,s7,a5
        slli    a5,a5,1
        mulw    s8,s5,s8
        subw    t0,t0,t1
        add     a5,t6,a5
        addiw   a6,a6,24
        mulw    a7,s6,a7
        mulw    t1,s4,t5
        addw    a7,a7,s8
        mulw    t5,s3,t5
        mulw    s8,s3,a0
        mulw    a0,s4,a0
        subw    t1,t1,s8
        addw    t1,t0,t1
        addw    a0,a0,t5
        addw    a0,a7,a0
        mulw    t0,s2,t4
        mulw    a7,s1,a1
        mulw    t4,s1,t4
        subw    t0,t0,a7
        addw    t0,t0,t1
        mulw    a1,s2,a1
        addw    a1,a1,t4
        mulw    a7,s0,t3
        addw    a1,a1,a0
        mulw    a0,t2,a3
        subw    a7,a7,a0
        addw    a7,a7,t0
        sraiw   a7,a7,15
        sh      a7,0(a4)
        mulw    t3,t2,t3
        mulw    a4,s0,a3
        addw    a4,a4,t3
        addw    a4,a4,a1
        sraiw   a4,a4,15
        sh      a4,0(a5)
        bne     a6,s11,.L4
        ld      a0,56(sp)
        addiw   a5,a0,1
        slli    a0,a5,48
        ld      t4,72(sp)
        ld      t1,64(sp)
        srli    a0,a0,48
        ld      a5,80(sp)
        ld      a7,48(sp)
        addw    t1,t4,t1
        addw    s11,t4,a6
        bne     a0,a5,.L6

Same issue as ARM SVE, I think the tail scalar operations can be folded into
vector operations.

  reply	other threads:[~2024-01-17 12:45 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 12:38 [Bug c/113441] New: " juzhe.zhong at rivai dot ai
2024-01-17 12:45 ` juzhe.zhong at rivai dot ai [this message]
2024-01-17 13:22 ` [Bug tree-optimization/113441] [13/14 " rguenth at gcc dot gnu.org
2024-01-17 14:07 ` juzhe.zhong at rivai dot ai
2024-01-17 14:35 ` rguenth at gcc dot gnu.org
2024-01-22 12:38 ` juzhe.zhong at rivai dot ai
2024-01-22 12:41 ` tnfchris at gcc dot gnu.org
2024-01-22 12:42 ` juzhe.zhong at rivai dot ai
2024-01-22 13:19 ` juzhe.zhong at rivai dot ai
2024-01-22 13:52 ` [Bug tree-optimization/113441] [14 " rguenth at gcc dot gnu.org
2024-01-22 16:16 ` tnfchris at gcc dot gnu.org
2024-01-22 22:16 ` juzhe.zhong at rivai dot ai
2024-01-23  6:42 ` rguenth at gcc dot gnu.org
2024-01-23  8:15 ` juzhe.zhong at rivai dot ai
2024-01-23  8:17 ` rguenther at suse dot de
2024-01-23  8:25 ` juzhe.zhong at rivai dot ai
2024-01-23 10:29 ` rguenther at suse dot de
2024-01-23 10:30 ` tnfchris at gcc dot gnu.org
2024-01-23 12:32 ` tnfchris at gcc dot gnu.org
2024-01-23 12:50 ` rguenth at gcc dot gnu.org
2024-01-23 12:52 ` rguenth at gcc dot gnu.org
2024-01-23 12:56 ` rguenth at gcc dot gnu.org
2024-01-23 13:02 ` rguenth at gcc dot gnu.org
2024-01-23 13:05 ` tnfchris at gcc dot gnu.org
2024-01-23 13:12 ` tnfchris at gcc dot gnu.org
2024-01-23 13:21 ` juzhe.zhong at rivai dot ai
2024-01-23 13:28 ` tnfchris at gcc dot gnu.org
2024-02-22 16:18 ` [Bug tree-optimization/113441] [14 Regression] Fail to fold the last element with multiple loop since g:2efe3a7de0107618397264017fb045f237764cc7 tnfchris at gcc dot gnu.org
2024-02-26  8:10 ` tnfchris at gcc dot gnu.org
2024-02-26  8:17 ` rguenther at suse dot de
2024-02-27  8:01 ` tnfchris at gcc dot gnu.org
2024-02-27  8:08 ` rguenth at gcc dot gnu.org
2024-02-29 22:18 ` rsandifo at gcc dot gnu.org
2024-03-01  9:44 ` rguenth at gcc dot gnu.org
2024-03-01  9:53 ` rsandifo at gcc dot gnu.org
2024-03-01 10:44 ` rguenther at suse dot de
2024-03-04 12:07 ` rsandifo at gcc dot gnu.org
2024-03-04 13:26 ` rsandifo at gcc dot gnu.org
2024-03-04 14:28 ` rguenth at gcc dot gnu.org
2024-03-04 14:48 ` rsandifo at gcc dot gnu.org
2024-03-04 15:01 ` rsandifo at gcc dot gnu.org
2024-03-04 15:10 ` rguenth at gcc dot gnu.org
2024-03-04 16:16 ` rsandifo at gcc dot gnu.org
2024-03-04 22:52 ` rsandifo at gcc dot gnu.org
2024-03-05  8:21 ` rguenther at suse dot de
2024-03-05 10:44 ` rguenth at gcc dot gnu.org
2024-03-07 20:50 ` law at gcc dot gnu.org
2024-05-07  7:43 ` [Bug tree-optimization/113441] [14/15 " rguenth 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-113441-4-t7cQhLZun1@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).