public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: pan2.li@intel.com, gcc-patches@gcc.gnu.org
Cc: juzhe.zhong@rivai.ai, yanzhang.wang@intel.com,
	kito.cheng@gmail.com, rdapp.gcc@gmail.com
Subject: Re: [PATCH v1] RISC-V: Bugfix for scalar move with merged operand
Date: Sun, 17 Sep 2023 09:52:53 -0600	[thread overview]
Message-ID: <db576545-1177-4999-abba-8c4255bf1d58@gmail.com> (raw)
In-Reply-To: <20230917074234.1541088-1-pan2.li@intel.com>




On 9/17/23 01:42, Pan Li via Gcc-patches wrote:
> From: Pan Li <pan2.li@intel.com>
> 
> Given below example for VLS mode
> 
> void
> test (vl_t *u)
> {
>    vl_t t;
>    long long *p = (long long *)&t;
> 
>    p[0] = p[1] = 2;
> 
>    *u = t;
> }
> 
> The vec_set will simplify the insn to vmv.s.x when index is 0, without
> merged operand. That will result in some problems in DCE, aka:
> 
> 1:  137[DI] = a0
> 2:  138[V2DI] = 134[V2DI]                              // deleted by DCE
> 3:  139[DI] = #2                                       // deleted by DCE
> 4:  140[DI] = #2                                       // deleted by DCE
> 5:  141[V2DI] = vec_dup:V2DI (139[DI])                 // deleted by DCE
> 6:  138[V2DI] = vslideup_imm (138[V2DI], 141[V2DI], 1) // deleted by DCE
> 7:  135[V2DI] = 138[V2DI]                              // deleted by DCE
> 8:  142[V2DI] = 135[V2DI]                              // deleted by DCE
> 9:  143[DI] = #2
> 10: 142[V2DI] = vec_dup:V2DI (143[DI])
> 11: (137[DI]) = 142[V2DI]
> 
> The higher 64 bits of 142[V2DI] is unknown here and it generated
> incorrect code when store back to memory. This patch would like to
> fix this issue by adding a new SCALAR_MOVE_MERGED_OP for vec_set.
I must be missing something.  Doesn't insn 10 broadcast the immediate 
0x2 to both elements of r142?!?  What am I missing?

JEff

  reply	other threads:[~2023-09-17 15:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-17  7:42 pan2.li
2023-09-17 15:52 ` Jeff Law [this message]
2023-09-18  1:34   ` Li, Pan2
2023-09-18 10:00   ` Robin Dapp
2023-09-18 10:24     ` Li, Pan2
2023-09-18 17:44     ` Jeff Law
2023-09-18 23:03       ` Li, Pan2

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=db576545-1177-4999-abba-8c4255bf1d58@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=pan2.li@intel.com \
    --cc=rdapp.gcc@gmail.com \
    --cc=yanzhang.wang@intel.com \
    /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).