FLD指令64位 [英] FLD instruction x64 bit

查看:912
本文介绍了FLD指令64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在64位指令FLD一个小问题...
要加载双精度值ST0寄存器堆栈指针FPU,但它似乎是不可能的。
在Delphi的32倍,我可以用这code:

I have a little problem with FLD instruction in x64 bit ... want to load Double value to the stack pointer FPU in st0 register, but it seem to be impossible. In Delphi x32, I can use this code :

function DoSomething(X:Double):Double;
asm

  FLD    X
   // Do Something ..
  FST Result

end;

不幸的是,在64位,同样code不起作用。

Unfortunately, in x64, the same code does not work.

推荐答案

在64位模式下浮点参数在XMM寄存器传递。因此,当德尔福试图编译FLD X中,它变得FLD XMM0但不存在这样的指令。首先,您需要将其移动到内存中。

In x64 mode floating point parameters are passed in xmm-registers. So when Delphi tries to compile FLD X, it becomes FLD xmm0 but there is no such instruction. You first need to move it to memory.

也是一样的结果,应该在XMM0传递回来。

The same goes with the result, it should be passed back in xmm0.

试试这个(未测试):

function DoSomething(X:Double):Double;
var
  Temp : double;
asm
  MOVQ qword ptr Temp,X
  FLD Temp
  //do something
  FST Temp
  MOVQ xmm0,qword ptr Temp
end;

这篇关于FLD指令64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆