We can use inline assembly by using __asm__(). However, this approach can only support instructions that are recognized by the compiler.
What I am using is gem5 hardware simulator, in which I implemented a new instruction in RISCV. Such instruction is a bit string of 1's and 0's. Hence, if such instruction is in the executable, then it will be fetched, decoded and executed by gem5 hardware simulator.
However, since that is a new instruction, the compiler does not recognize it.
For example, suppose the instruction that I implemented has mnemonic newInst %a0, %a1. If I directly insert it using inline assembly by
__asm__("newInst %0, %1": /* etc... */);
The compiler would not be able to translate that into machine code.
Hence, may I know if there is a way to hard code the instruction using inline assembly, without modifying the compiler?