public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Vineet Gupta <vineetg@rivosinc.com>, Jakub Jelinek <jakub@redhat.com>
Cc: gcc@gcc.gnu.org, Michael Collison <collison@rivosinc.com>
Subject: Re: query about commit 666fdc46bc8489 ("RISC-V: Fix bad insn splits with paradoxical subregs")
Date: Fri, 4 Nov 2022 17:13:20 -0600	[thread overview]
Message-ID: <2541e77f-f069-13d1-c08e-47f55677a596@gmail.com> (raw)
In-Reply-To: <23ac9d02-c687-7680-493b-8ace1558a4cb@rivosinc.com>


On 11/4/22 16:59, Vineet Gupta wrote:
> Hi Jakub,
>
> I had a question about the aforementioned commit in RV backend.
>
> (define_split
>   [(set (match_operand:GPR 0 "register_operand")
>     (and:GPR (match_operand:GPR 1 "register_operand")
>                (match_operand:GPR 2 "p2m1_shift_operand")))
> +   (clobber (match_operand:GPR 3 "register_operand"))]
>   ""
> -  [(set (match_dup 0)
> +  [(set (match_dup 3)
>        (ashift:GPR (match_dup 1) (match_dup 2)))
>
> Is there something specific to this split which warrants this or so 
> any split patterns involving shifts have this to avoid the shifting by 
> more than SUBREG_REG problem.

Not sure.  Note it was Jim Wilson's change, not Jakub's change AFAICT:


commit 666fdc46bc848984ee7d2906f2dfe10e1ee5d535
Author: Jim Wilson <jimw@sifive.com>
Date:   Sat Jun 30 21:52:01 2018 +0000

     RISC-V: Add patterns to convert AND mask to two shifts.

             gcc/
             * config/riscv/predicates.md (p2m1_shift_operand): New.
             (high_mask_shift_operand): New.
             * config/riscv/riscv.md (lshrsi3_zero_extend_3+1): New combiner
             pattern using p2m1_shift_operand.
             (lshsi3_zero_extend_3+2): New combiner pattern using
             high_mask_shift_operand.

             gcc/testsuite/
             * gcc.target/riscv/shift-shift-1.c: New.
             * gcc.target/riscv/shift-shift-2.c: New.
             * gcc.target/riscv/shift-shift-3.c: New.

     From-SVN: r262278

You might find further discussion in the gcc-patches archives.


>
> Also could you please explain where the clobber itself is allocated ?

I'd expect the combiner.   There's going to be 2 or more insns that are 
combined to create this pattern where the output of one feeds a 
subsequent insn and dies.  So it's effectively a temporary.  Combine 
will re-use that temporary as the clobbered operand.


Jeff



  reply	other threads:[~2022-11-04 23:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 22:59 Vineet Gupta
2022-11-04 23:13 ` Jeff Law [this message]
2022-11-04 23:38   ` Vineet Gupta
2022-11-04 23:47     ` Jeff Law

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=2541e77f-f069-13d1-c08e-47f55677a596@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=collison@rivosinc.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=vineetg@rivosinc.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).