I'm currently testing some inline assembly in C++ on an old compiler (GCC circa 2004) and I wanted to perform the square root function on a floating point number. After trying and searching for a successful method, I came across the following code
float r3(float n){
__asm__("fsqrt" : "+t" (n));
return n;
};
which worked. The issue is, even though I understand the assembly instructions used, I'm unable to find any particular documentation as to what the "+t"
flag means on the n
variable. I'm under the genuine idea that it seems to be a manner by which to treat the variable n
as both the input and output variable but I was unable to find any information on it. So, what exactly is the "t"
flag and how does it work here?
+
Means that this operand is both read and written by the instruction. (From here)
t
Top of 80387 floating-point stack (%st(0)). (From here)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With