using inline assembler in c++

I am trying to get inline assembler to work using the pgi compilers on the xt3.
It works fine if I use pgcc, but I need to compile c++ code, and pgCC chokes on it.
Here is my asm section:
asm
(
“movupd (%0), %%xmm1\n\t”
“addpd %%xmm1, %%xmm1\n\n”
“movupd %%xmm1, (%0)”
:: “r” (&d)
: “%xmm1”
);
and here is pgCC’s output:
hello.c:
“hello.c”, line 17: error: unknown register name “%xmm1”
: “%xmm1”
^

1 error detected in the compilation of “hello.c”.

I would really appreciate it if someone could tell me what I’m doing wrong, or how to get this to work with c++.

Hi soyke,

Unfortunately, we only support basic or extended asm in C but not C++. Is it possible to write these routines in C, and then link in the C objects with the rest of your C++ code?

  • Mat

The only problem with that, is that my c++ function needs to call other c++ functions. I supposed I could isolate the assembler, and declare the c function as inline.

-Jordan