On Sat, 2024-08-17 at 09:22 +0530, Amit Hiremath via Gcc-help wrote: > Hello David, > > Actually I was following this video: > https://www.youtube.com/watch?v=RT0GqJySnBc to add custom float > instructions to risc-v, as per the video one has to modify riscv-opc.c, > riscv-opc.h and riscv.md. I added fsin instruction by defining match, mask > in the file riscv-opc.h, fsin.s to riscv-opc.c, I did define instruction in > riscv-gcc/gcc/config/riscv/riscv.md as shown below > > (define_insn "sin<mode>2" > [(set (match_operand:ANYF 0 "register_operand" "=f") > (sin:ANYF (match_operand:ANYF 1 "register_operand" " f")))] You need to add an UNSPEC because there's currently no RTX code for sin. You can use gcc/config/m68k/m68k.md as a reference. /* snip */ > ../.././riscv-gcc/gcc/config/riscv/riscv.md:838:12: error: unknown rtx code > sin' And this error message just precisely tells you the fact. Please read https://gcc.gnu.org/onlinedocs/gccint/ if you are modifying GCC code, before raising questions. Known RTX codes are listed at https://gcc.gnu.org/onlinedocs/gccint/Arithmetic.html. -- Xi Ruoyao <xry111@xxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University