0

the visual studio 2019 compiler marks the colon in the line " : [x] "m" (x), " as an error and says that it expected a closing paranthes ")" instead. Why does this inline assembly code not work?

asm
(
    "rsqrtss %[x], %%xmm0;"
    "movss %%xmm0, %[y];"

    : [x] "m" (x),
    : [y] "m" (y)
    : "xmm0"
);
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • That's GNU C inline asm syntax. MSVC doesn't support it, only it's less-good `asm{ }` version (which clang's `-fasm_blocks` is compatible with). Generally use intrinsics; you're not doing yourself any favours by forcing the input and output to be in memory instead of `"=x"`. Also, that's not quite valid GNU C inline asm syntax, your output operand is missing an `=`. – Peter Cordes Apr 24 '21 at 09:22
  • Intrinsics aren't totally convenient / efficient for scalar float either ([How to merge a scalar into a vector without the compiler wasting an instruction zeroing upper elements? Design limitation in Intel's intrinsics?](https://stackoverflow.com/q/39318496)), but https://gcc.gnu.org/wiki/DontUseInlineAsm. – Peter Cordes Apr 24 '21 at 09:31

0 Answers0