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/108654] New: Incorrect codegen of RVV GCC
Date: Fri, 03 Feb 2023 08:20:07 +0000	[thread overview]
Message-ID: <bug-108654-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108654
           Summary: Incorrect codegen of RVV GCC
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juzhe.zhong at rivai dot ai
  Target Milestone: ---

#include "riscv_vector.h"

void foo5_3 (int32_t * restrict in, int32_t * restrict out, size_t n, int cond)
{
  vint8m1_t v = *(vint8m1_t*)in;
  *(vint8m1_t*)out = v;
  vbool8_t v3 = *(vbool8_t*)in;
  *(vbool8_t*)(out + 200) = v3;
  vbool16_t v4 = *(vbool16_t *)in;
  *(vbool16_t *)(out + 300) = v4;
}

ASM:
foo5_3:
        csrr    t0,vlenb
        slli    t1,t0,1
        csrr    a5,vlenb
        sub     sp,sp,t1
        slli    a3,a5,1
        vl1re8.v        v24,0(a0)
        add     a3,a3,sp
        vs1r.v  v24,0(a1)
        addi    a4,a1,800
        sub     a5,a3,a5
        vsetvli a3,zero,e8,m1,ta,ma
        vsm.v   v24,0(a4)
        vs1r.v  v24,0(a5)
        addi    a1,a1,1200
        csrr    t0,vlenb
        slli    t1,t0,1
        vsetvli a5,zero,e8,mf2,ta,ma
        vsm.v   v24,0(a1)
        add     sp,sp,t1
        jr      ra

There are 2 issues here:
First, 2 vlm.v mask loads are missing which is incorrect code-gen.
Second, the code quality is bad which is the duplicate bug filed here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108185

             reply	other threads:[~2023-02-03  8:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03  8:20 juzhe.zhong at rivai dot ai [this message]
2023-03-07 13:45 ` [Bug target/108654] " cvs-commit at gcc dot gnu.org
2023-03-23  8:40 ` cvs-commit at gcc dot gnu.org
2023-03-25  2:31 ` juzhe.zhong at rivai dot ai
2023-03-25  2:32 ` 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-108654-4@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).