Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22148

How to pass arguments to inline GCC/Clang asembly with Intel syntax? [duplicate]

$
0
0

This question already has an answer here:

All documentation uses AT&T syntax.

int EAX;
asm( "movl $5, %0"
   : "=a" (EAX)
);

How do I re-write this using Intel syntax?

int EAX;
asm( 
 ".intel_syntax noprefix;""mov %0, 5"
 :"=a"(EAX)
);

Doesn't work:

 error: unknown token in expression
 asm(".intel_syntax noprefix;"
     ^
<inline asm>:1:29: note: instantiated into assembly here
        .intel_syntax noprefix;mov %0, 5

Viewing all articles
Browse latest Browse all 22148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>