[英]gcc inline assembly function that clobbers all the floating-point registers
I'm trying to write an asm
statement (inline assembly in GCC ), that just calls some function, that returns one value in floating-point register and has no operands, but potentially clobbers all the floating-point registers. 我正在尝试编写一个asm
语句( GCC中的内联汇编),该语句仅调用某些函数,该函数在浮点寄存器中返回一个值且没有操作数,但可能会破坏所有浮点寄存器。
asm("call *%1"
: "=t"(result_)
: "d"(code_.data())
: "memory", "cc", "ax", "%st(1)", "%st(2)", "%st(3)", "%st(4)", "%st(5)", "%st(6)", "%st(7)"
);
My problem is that I cannot tell the assembler, that is clobbering the top floating-point register %st(0)
too, because I cannot specify "%st(0)"
(or "%st"
) in clobber list (it results in an compilation error). 我的问题是我也无法告诉汇编程序,也正在破坏顶级浮点寄存器%st(0)
,因为我无法在障碍列表中指定"%st(0)"
(或"%st"
)(结果出现编译错误)。
You are returning a result in %st(0)
; 您正在%st(0)
中返回结果; that is what the t
constraint means. 这就是t
约束的含义。 The compiler therefore knows it is modified. 因此,编译器知道它已被修改。
I am not sure why your GCC is not recognizing %st(0)
or %st
as a name in the clobber list, but this should not cause a problem in this situation. 我不确定为什么您的GCC不能将%st(0)
或%st
识别为问题清单中的名称,但是在这种情况下这不会引起问题。
Apple clang version 4.0 (tags/Apple/clang-418.0.60) accepts %st
in the clobber list, even with =t
as an output constraint. Apple clang版本4.0(tags / Apple / clang-418.0.60)甚至在=t
作为输出约束的情况下,也接受了clobber列表中的%st
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.