public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Kito Cheng <kito.cheng@gmail.com>,
	Mary Bennett <mary.bennett@embecosm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/1] RISC-V: Add support for XCVbitmanip extension in CV32E40P
Date: Wed, 6 Dec 2023 10:59:52 -0700	[thread overview]
Message-ID: <9ec33a97-6807-433e-95d2-25a4830ee57a@gmail.com> (raw)
In-Reply-To: <CA+yXCZAh6-iJDEXf_GcATAir-YjGE-594eT+xtmnW8UKGO6pRQ@mail.gmail.com>



On 12/5/23 08:30, Kito Cheng wrote:
>> index 7d7b952d817..e7d4ad1760c 100644
>> --- a/gcc/config/riscv/corev.md
>> +++ b/gcc/config/riscv/corev.md
>> @@ -27,6 +27,25 @@
>>
>>     ;;CORE-V EVENT LOAD
>>     UNSPECV_CV_ELW
>> +
>> +  ;;CORE-V BITMANIP
>> +  UNSPEC_CV_BITMANIP_EXTRACT
>> +  UNSPEC_CV_BITMANIP_EXTRACT_INSN
>> +  UNSPEC_CV_BITMANIP_EXTRACTR_INSN
>> +  UNSPEC_CV_BITMANIP_EXTRACTU
>> +  UNSPEC_CV_BITMANIP_EXTRACTU_INSN
>> +  UNSPEC_CV_BITMANIP_EXTRACTUR_INSN
>> +  UNSPEC_CV_BITMANIP_INSERT
>> +  UNSPEC_CV_BITMANIP_INSERT_INSN
>> +  UNSPEC_CV_BITMANIP_INSERTR_INSN
> 
> You could reference bfe, sbfx and ubfx instructions in aarch64.md
> to see how to write the insert and extract bit with RTL code.
> 
>> +  UNSPEC_CV_BITMANIP_BCLR
>> +  UNSPEC_CV_BITMANIP_BCLR_INSN
>> +  UNSPEC_CV_BITMANIP_BCLRR_INSN
>> +  UNSPEC_CV_BITMANIP_BSET
>> +  UNSPEC_CV_BITMANIP_BSET_INSN
>> +  UNSPEC_CV_BITMANIP_BSETR_INSN
> 
> Just use generic RTL code for bset and bclr is fine, you could
> reference bitmanip.md
Agreed.  And as a general principle if we can reasonably express the 
semantics of an instruction with RTL, we generally should.  Doing so 
gives the optimizers a chance to improve stuff.

I haven't looked at the patches, but the same might apply to the 
extractions & insertions, though there's more complex in that there's 
multiple implementations and I suspect some general cleanups would 
likely be necessary for that to work.  We started to look at it a bit, 
but concluded there were bigger fish to fry.

jeff

      reply	other threads:[~2023-12-06 18:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 10:55 [PATCH 0/1] RISC-V: Support CORE-V XCVBITMAIP extension Mary Bennett
2023-11-09 10:55 ` [PATCH 1/1] RISC-V: Add support for XCVbitmanip extension in CV32E40P Mary Bennett
2023-12-05 15:30   ` Kito Cheng
2023-12-06 17:59     ` Jeff Law [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=9ec33a97-6807-433e-95d2-25a4830ee57a@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@gmail.com \
    --cc=mary.bennett@embecosm.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).