public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pan2.li at intel dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/114639] [riscv] ICE in create_pre_exit, at mode-switching.cc:451
Date: Sun, 28 Apr 2024 06:51:13 +0000	[thread overview]
Message-ID: <bug-114639-4-CyuOyxAOvt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114639-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #19 from Li Pan <pan2.li at intel dot com> ---
Thanks Juzhe.  Here is another example

---------------------------------
#include <riscv_vector.h>

extern size_t get_new_vl ();

size_t
__attribute__((noinline))
get_vl (size_t *c)
{
  size_t vl = c[0] + c[1];

  return vl;
}

vbool64_t
test_fail_2 (vuint64m1_t a, unsigned long b, size_t *c)
{
  return __riscv_vmsne_vx_u64m1_b64 (a, b, get_vl (c));
}
-------------------------------------------------------

test_fail_2:                                                                   
                                                                               
                                       [30/37834]
        addi    sp,sp,-16
        sd      ra,8(sp)
        sd      s0,0(sp)
        csrr    t0,vlenb
        sub     sp,sp,t0
        vs1r.v  v1,0(sp)
        sub     sp,sp,t0
        vs1r.v  v2,0(sp)
        sub     sp,sp,t0
        vs1r.v  v3,0(sp)
        sub     sp,sp,t0
        vs1r.v  v4,0(sp)
        sub     sp,sp,t0
        vs1r.v  v5,0(sp)
        sub     sp,sp,t0
        vs1r.v  v6,0(sp)
        sub     sp,sp,t0
        vs1r.v  v7,0(sp)
        sub     sp,sp,t0
        vs1r.v  v24,0(sp)
        sub     sp,sp,t0
        vs1r.v  v25,0(sp)
        sub     sp,sp,t0
        vs1r.v  v26,0(sp)
        sub     sp,sp,t0
        vs1r.v  v27,0(sp)
        sub     sp,sp,t0
        vs1r.v  v28,0(sp)
        sub     sp,sp,t0                                                       
                                                                               
                                                         vs1r.v  v29,0(sp)     
                                                                               
                                                                               
                          sub     sp,sp,t0
        vs1r.v  v30,0(sp)
        sub     sp,sp,t0
        vs1r.v  v31,0(sp)
        csrr    t0,vlenb
        sub     sp,sp,t0
        vs1r.v  v8,0(sp)
        mv      s0,a0
        mv      a0,a1
        call    get_vl
        vl1re64.v       v8,0(sp)
        vsetvli zero,a0,e64,m1,ta,ma
        vmsne.vx        v0,v8,s0
        csrr    t0,vlenb
        add     sp,sp,t0
        csrr    t0,vlenb
        vl1re64.v       v31,0(sp)
        add     sp,sp,t0
        vl1re64.v       v30,0(sp)
        add     sp,sp,t0
        vl1re64.v       v29,0(sp)
        add     sp,sp,t0
        vl1re64.v       v28,0(sp)
        ...

As I understand, these callee saved vector registers are not required if the
function body doesn't pollute these registers.  Only the polluted registers
need to go in/out stack.

However, it is somehow one optimization here, we can consider to improve this
in GCC-15 if my understanding is correct.

      parent reply	other threads:[~2024-04-28  6:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08 12:29 [Bug target/114639] New: " schwab@linux-m68k.org
2024-04-08 14:08 ` [Bug target/114639] " kito at gcc dot gnu.org
2024-04-08 18:13 ` pinskia at gcc dot gnu.org
2024-04-09  1:26 ` pan2.li at intel dot com
2024-04-09  1:28 ` kito at gcc dot gnu.org
2024-04-09  1:33 ` pan2.li at intel dot com
2024-04-09  1:37 ` juzhe.zhong at rivai dot ai
2024-04-09  3:45 ` pan2.li at intel dot com
2024-04-09  7:22 ` pan2.li at intel dot com
2024-04-09  8:05 ` ubizjak at gmail dot com
2024-04-09  8:32 ` pan2.li at intel dot com
2024-04-09 11:55 ` pan2.li at intel dot com
2024-04-09 15:30 ` pan2.li at intel dot com
2024-04-10  3:20 ` pan2.li at intel dot com
2024-04-11  3:02 ` cvs-commit at gcc dot gnu.org
2024-04-16  8:47 ` schwab@linux-m68k.org
2024-04-22 22:53 ` juzhe.zhong at rivai dot ai
2024-04-28  6:02 ` pan2.li at intel dot com
2024-04-28  6:22 ` juzhe.zhong at rivai dot ai
2024-04-28  6:51 ` pan2.li at intel dot com [this message]

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-114639-4-CyuOyxAOvt@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).