GCC Assembly "+ t"

I am currently testing some built-in 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 to find a successful method, I came across the following code

float r3(float n){
    __asm__("fsqrt" : "+t" (n));
    return n;
};

who worked. The problem is that, although I understand the assembly instructions used, I cannot find any specific documentation regarding what the flag means "+t"in a variable n. I come to the true idea that it seems to be nused as an input and output variable to process the variable , but I could not find any information on it. So what is a flag "t"and how does it work here?

+4
source share
2 answers

+

means that this operand is read and written by the instruction. (From here )

t

Top 80387 floating point stack (% st (0)). (From here )

+3
source

+means you are reading and writing case.
tmeans the value is at the top of the 80387 floating point stack.

 

Literature:

  • GCC Guide, Extended Asm Contains General Information About Constraints - Finding "Constraints"
  • GCC Handbook, Machine Constraints provides information on specific constraints supported for each architecture - search for the "x86 family"
+3
source

Source: https://habr.com/ru/post/1674615/


All Articles