asm syntax

I am looking for documentation on the asm syntax that I can use with the 6.1 PGI compilers. I have a little snippet like

asm volatile (“lock; incl %0”
: “=m”(mValue)
: “m”(mValue));

and I get compilation errors along the lines of

/tmp/pgCCbaaaafqpaA.s: Assembler messages:
/tmp/pgCCbaaaafqpaA.s:103: Error: bad register name `%0’

which seems to strongly suggest that the asm syntax that I would have used with a gnu compiler will not work for me here (this does work with my gnu compilers). There is presumably a document on how to use the newly introduced asm and I would like to have a copy of that. I’ve searched the web and this site (in vain evidently).

Thanks in advance.

Hi esmyth,

Which compiler are you using? With PGI 6.1, extended asm is only supported in C but it appears that you might be compiling with the C++ compiler. C++ extended asm support will available with the up coming 6.2 release.


Hello Mat:
I am using pgCC for this portion. You are right. I was unaware of this “inconsistency” between the pgcc and pgCC compilers in 6.1. I gather 6.2 is close at hand. In the meantime, I will try to move this code to a C translation unit and will thus inclur the overhead of an extra function call (which may turn out to be a bad deal). Nevertheless, it should work.