gpt4 book ai didi

assembly - x86 程序集 : movsd instruction issue

转载 作者:行者123 更新时间:2023-12-02 17:08:57 24 4
gpt4 key购买 nike

这是我的问题:
我尝试使用 scanf (在 msvcrt.dll 中)在 平面汇编器 中输入单个浮点值,然后编写一个简单的“scanf 程序” “像这样(在C中):

#include <stdio.h>

int main() {
float a;

scanf("%f", &a);
printf("Just input: %f", a);
return 0;
}

然后使用cl.exe使用/FA参数进行编译,生成如下汇编文件:

    lea eax, DWORD PTR _a$[ebp]
push eax
push OFFSET $SG2935
call _scanf
add esp, 8
; Line 8
cvtss2sd xmm0, DWORD PTR _a$[ebp]
sub esp, 8
movsd QWORD PTR [esp], xmm0
push OFFSET $SG2936
call _printf
add esp, 12 ; 0000000cH

我误解的是movsd指令。根据这里:http://faydoc.tripod.com/cpu/movsb.htm将地址 DS:(E)SI 处的双字移动到地址 ES:(E)DI 但我没有看到任何设置 esiedi 这里和生成的源文件中的 movsd 有两个参数,但在链接的文档中不应该。有人可以在这里解释一下吗?

最佳答案

有两条同名的 x86 指令!

  1. MOVS/MOVSB/MOVSW/MOVSD/MOVSQ - 将数据从一个字符串移至另一个字符串
  2. MOVSD - 移动标量 double 浮点值

检查英特尔 datasheet

关于assembly - x86 程序集 : movsd instruction issue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14414194/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com