![](/img/trans.png)
[英]How to specify clobbered bottom of the x87 FPU stack with extended gcc assembly?
[英]Explanation for clobber list in extended GCC inline assembly executing the x87 FPATAN operation
以下代碼位於MinGW x86inline.h文件中:
/*
** in-line atan2(y,x) function.
** Computes arctan(y/x).
*/
#define atan2(y,x) atan2_x87_inline(y,x)
double atan2_x87_inline(double y,double x);
extern __inline__ double atan2_x87_inline(double y,double x)
{
double result;
__asm__ ("fpatan" : "=t" (result) : "0" (x), "u" (y) : "st(1)");
return(result);
}
據我所知,所述的x87 fpatan
操作使用st(0)
和st(1)
寄存器,將覆蓋的內容st(1)
寄存器,然后彈出頂部寄存器。
那么為什么只有st(1)
包含在clobber列表中,而不是st(0)
呢?
編輯 :事實上,為什么它需要一個clobber列表,因為編譯器應該通過"t"
和"u"
約束知道st(0)
和st(1)
。 是對的嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.