Re: Custom Float Instructions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have implemented custom floating point sine instruction,  now  I am
trying to test following sample c code:

//sin_example.c
int main()
{
float angle1 = 3.1415926, a;

a = sin(angle1);


return 0;
 }
./riscv32-unknown-elf-gcc sin_example.c

I am getting following error:

sin_example.c:(.text+0x34): undefined reference to `sin'
collect2: error: ld returned 1 exit status.


Please guide me how to test custom float sine instruction. I asked this
question in riscv-gnu-toolchain forum, they pointed me to ask in gcc forum
since it is related to GCC toolchain.

Thanks,
Amit

On Sat, Aug 17, 2024 at 12:38 PM Xi Ruoyao <xry111@xxxxxxxxxxx> wrote:

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




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux