[cfe-dev] Syntax for asm in clang
David Wohlferd
dw at LimeGreenSocks.com
Mon Sep 15 21:38:13 PDT 2014
I'm working with some code that has inline asm. While it compiles and
runs correctly with gcc (4.9), clang (3.5.0) is giving compile errors.
No doubt this is due to variations in what is supported in gcc and clang
for the very compiler-specific asm command.
I was hoping to resolve this myself by looking at the docs, but I'm not
finding anything that details what clang's asm supports (other than
saying "highly compatible" with GCC). Does anyone have a link?
Assuming I didn't just miss where this is doc'ed, perhaps someone with
more clang experience can suggest how to emulate gcc's %z modifier (see
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#i386Operandmodifiers).
In short, %z0 is expanded in inline asm strings to one of b/w/l/q (byte,
word, long, qword), depending on the type of parameter 0. This is useful
for cases where the type cannot be inferred from the operators, for
example "rep stos%z0". While there are ways to do this manually, I'm
hoping clang provides something (macro? intrinsic? different modifier?)
similar to gcc.
Thanks,
dw
More information about the cfe-dev
mailing list