I think it depends a lot on what you are doing. Modifying GCC and requiring a GCC change to build your program, unless your GCC patch makes it upstream is more of a headache than just using the built-in asm.
If the command you want to use has an abstract value that is not tied to a specific instruction set architecture, adding inline / inline so that the same code can automatically work with all goals with its help (with a return to a more complex implementation with several instructions for goals that don't have instructions) is probably the βrightβ choice, but may not be entirely practical.
If the instruction is something very specific to ISA, obscure, not performance critical, etc. (I'm going to download a special equipment recorder, processor mode register, get information about the model, etc., but I'm sure you can come up with other examples), then just using inline asm is definitely the right solution.
Even if you think that the built-in is the βrightβ solution for your problem, but for practical reasons you need to use the asm built-in approach, you can still abstract it with a macro or a static built-in function so that it can easily replace all use with built-in later (or with a backup implementation for goals without instructions).
source share