View Single Post
Old 2020-07-23, 13:06   #13
Tribal Bullet
jasonp's Avatar
Oct 2004

3×1,181 Posts

Modern assembler versions also let you switch to Intel syntax with an assembler directive.

The extra boilerplate controls where the input operands come from, where outputs go, what is expected to be overwritten and clobbered, whether the whole block can be moved around other basic blocks in your code, etc. The actual instructions in the inline asm are don't-cares for the compiler, you can put 1000 instructions in there and it will paste them into the generated assembly, or paste nonsense that will fail to compile if you make a mistake.

If you want a braindead alternative, Sun's compiler used to have an inline asm syntax that only allowed the text of one instruction, with no way to control any of the above. Good luck doing something nontrivial with that facility.

Last fiddled with by jasonp on 2020-07-23 at 13:12
jasonp is offline   Reply With Quote