Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11661

When to use earlyclobber constraint in extended GCC inline assembly?

$
0
0

I understand when to use a clobber list (e.g. listing a register which is modified in the assembly so that it doesn't get chosen for use as an input register, etc), but I can't wrap my head around the the earlyclobber constraint &. If you list your outputs, wouldn't that already mean that inputs can't use the selected register (aside from matching digit constraints)?

For example:

asm("movl $1, %0;""addl $3, %0;""addl $4, %1;"   // separate bug: modifies input-only operand"addl %1, %0;"    : "=g"(num_out)    : "g"(num_in)    :);

Would & even be needed for the output variables? The compiler should know the register that was selected for the output, and thus know not to use it for the input.


Viewing all articles
Browse latest Browse all 11661

Trending Articles



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