public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to add a custom instruction to the RISC-V GCC tools?
       [not found]   ` <7f955b41-3e9d-400d-a947-881f8106023dn@groups.riscv.org>
@ 2024-02-06  3:57     ` hameeza ahmed
  2024-02-06 14:19       ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: hameeza ahmed @ 2024-02-06  3:57 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

Hello,
I want to add an intrinsic in gcc toolchain that will generate the assembly
instruction. As it is said I need
to add a pattern to the gcc/config/riscv/riscv.md file to describe the
instruction. Can you please help me. Are there any tutorial that you can
recommend for this?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to add a custom instruction to the RISC-V GCC tools?
  2024-02-06  3:57     ` How to add a custom instruction to the RISC-V GCC tools? hameeza ahmed
@ 2024-02-06 14:19       ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2024-02-06 14:19 UTC (permalink / raw)
  To: hameeza ahmed, gcc



On 2/5/24 20:57, hameeza ahmed via Gcc wrote:
> Hello,
> I want to add an intrinsic in gcc toolchain that will generate the assembly
> instruction. As it is said I need
> to add a pattern to the gcc/config/riscv/riscv.md file to describe the
> instruction. Can you please help me. Are there any tutorial that you can
> recommend for this?
The process of adding target specific intrinsics is fairly target 
specific.  There isn't any guide that I'm aware of; your best bet is 
going to be to find an existing intrinsic that roughly matches yours and 
copy how that intrinsic works.

The good news is intrinsics don't have to expose full semantics of the 
underlying instrution -- you can get away with just referencing any 
values read and values written, but not the semantics of the operation. 
Meaning that when you look for an intrinsic to copy-n-paste, you're 
mostly concerned about the number and types of arguments.

Having said that, there is a GCC internals manual which describes the 
RTL language, the format of backend patterns, expanders, etc.  While the 
vast majority will not be relevant to your effort, it is likely worth 
bookmarking it for future reference.

jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-06 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <d18fd33d-d02e-41df-b442-544cb66b9544@groups.riscv.org>
     [not found] ` <CAFyWVabV=6mBGqfNx3hCxJJA45Mh6W3zgDRnJYPc+wfXsJE8HQ@mail.gmail.com>
     [not found]   ` <7f955b41-3e9d-400d-a947-881f8106023dn@groups.riscv.org>
2024-02-06  3:57     ` How to add a custom instruction to the RISC-V GCC tools? hameeza ahmed
2024-02-06 14:19       ` Jeff Law

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).