For GNU toolchain, the inline assembler is independent with instruction encoding.
If you can use this instruction in .S file, then you can use it as inline C.
E.g., for asm volatile (“insn_x, %0, %1 %2” : “=r”(x1) : “m”(x2), “I”(0));
the “insn_x, %0, %1 %2” is just a format string like printf has. And Gcc manual describes the way to replace place holder %<idx> from arguments.
From another side, the argument list is the interface with normal C, for dependency and register share.
Regards.
From: muralihegde100 <hegde...@gmail.com>
Sent: 2021年3月15日 16:39
To: RISC-V SW Dev <sw-...@groups.riscv.org>
Subject: [sw-dev] writing inline assembly in C code for RISCV assembler
External email: Use caution opening links or attachments |
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
sw-dev+un...@groups.riscv.org.
To view this discussion on the web visit
https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/a4f55c8b-24a6-40a7-8553-6ce7f812d68cn%40groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/DM6PR12MB332202CC9CB8004905508E29AD6B9%40DM6PR12MB3322.namprd12.prod.outlook.com.
Hi MK,
I guess you mean the section “Labels” in this page:
https://github.com/riscv/riscv-asm-manual/blob/master/riscv-asm.md
Regards.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CACmy24QNsNK5TpP_kEZm_zVB8UT0oJcwckG%3D5g%3DNqOd-oiYBEQ%40mail.gmail.com.