x87 register clobber returns "unknown register name" error

Hadrien Grasland hadrien.grasland@neel.cnrs.fr
Thu Oct 15 07:59:00 GMT 2015


Hello,

I am trying to write inline assembly code that uses the x86 floating
point stack.

As far as I understood
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Clobbers , the
proper register clobber to use in this case is "st(x)". For example,
this example from the documentation uses the "st(1)" clobber :

asm ("fyl2xp1" : "=t" (result) : "0" (x), "u" (y) : "st(1)");

However, if I try it on the trivial example attached, it fails with the
following error.

$ gcc-4.8 display_representation.c
display_representation.c: In function ‘main’:
display_representation.c:11:5: error: unknown register name ‘st(0)’ in ‘asm’
     asm volatile ("fstps (%1)" :
     ^

What am I doing wrong ?

Thanks in advance,
Hadrien Grasland
-------------- next part --------------
A non-text attachment was scrubbed...
Name: display_representation.c
Type: text/x-csrc
Size: 557 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20151015/08f936c6/attachment.bin>


More information about the Gcc-help mailing list