- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的问题:
我尝试使用 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
但我没有看到任何设置 esi
、edi
这里和生成的源文件中的 movsd
有两个参数,但在链接的文档中不应该。有人可以在这里解释一下吗?
最佳答案
有两条同名的 x86 指令!
检查英特尔 datasheet 。
关于assembly - x86 程序集 : movsd instruction issue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14414194/
mov esi,offset @s1 mov edi,offset @s2 mov ecx,10 cld rep movsd 1.rep movsd 每次ecx!=0便执行movsd ,然后ecx
我想在时间关键函数中复制一个相对较短的内存序列(小于 1 KB,通常为 2-200 字节)。在 CPU 方面最好的代码似乎是 rep movsd。但是我不知何故无法让我的编译器生成这段代码。我希望(我
基本上问题说的是,如果我在各种 CPU 上执行不是 8 字节(甚至 4 字节)对齐的 MOVSD,会发生什么?它是否会对性能产生影响,是否会出现段错误等? 最佳答案 摘自英特尔规范第 1 卷第 4.1
这是我的问题: 我尝试使用 scanf (在 msvcrt.dll 中)在 平面汇编器 中输入单个浮点值,然后编写一个简单的“scanf 程序” “像这样(在C中): #include int ma
我正在尝试编写一个小型 x86-64 JIT,但我在一些地方有点难以理解。 我正在尝试 JIT 一个简单的函数,该函数将 float 的值分配给 xmm0 寄存器,然后返回它,但我不确定应该如何对 m
我是一名优秀的程序员,十分优秀!