On Thu, Aug 8, 2024 at 3:56 AM Amit Hiremath <amit.hm...@googlemail.com> wrote: > > Hello, > > I want to add custom single precision floating point sine, cosine, exp > instructions to risc-v gnu tool chain, and I have designed hardware for > this. I was going through tutorials on how to add custom instructions at: > https://pcotret.gitlab.io/riscv-custom/sw_toolchain.html after adding > custom instructions, I think one has to use asm macro to use custom > instructions in C. Is there anyway where one do not need to use this macro? > I would like the compiler to automatically map to custom instructions in > the risc-v processor, like how it will map to fadd.s, fmul.s instructions, > where one does not need to use asm macro. > > I asked in riscv gnu tool chain forum about this issue: > https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1526 they > suggested that I ask this query in the gcc forum. > > Can you please guide me?
We have for sin, cos and exp so you only have to add define_expand to the risc-v machine description with the correct pattern names (for example sindf). You can look at the x86 backend for examples where the x87 unit has those transcendentals as well. Richard. > > Many Thanks, > -Amith