[cfe-dev] Questions on adding a CLANG builtin to connect to a LLVM intrinsic

Baoshan Pang via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 18 09:43:23 PST 2022


This commit is a good example for how to add an intrinsic for risc-v:

https://github.com/llvm/llvm-project/commit/16877c5d2cd3f5c45642c9dc546c376ac87aa54d#diff-d340caed3f9af6c4e7ca78d4473ba5375a4973dc2f2b261644248ac039c0b2d1

On Tue, Jan 18, 2022 at 3:35 AM David Mallasén Quintana via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hello,
>
> I have added new instructions to the RISC-V LLVM backend for some
> specific hardware I developed and I want to access a sequence of them
> directly from C code. As of now I do this using inline assembly but it
> can be a bit cumbersome. If I'm not mistaken the way to go would be to
> access this functionality from C with CLANG builtins and lowering this
> to machine code with LLVM intrinsics that generate my target RISC-V
> instructions.
>
> I have seen the documentation on how to add LLVM intrinsics. However,
> I can't find something similar with CLANG builtins, so any pointers to
> some documentation would be greatly appreciated. Also, if there is a
> better way of achieving this I would be grateful for some information
> on how it could be done.
>
> Best regards,
> David
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20220118/a8776e43/attachment.html>


More information about the cfe-dev mailing list