gpt4 book ai didi

assembly - 使用 xmm 寄存器来保存通用寄存器是否安全?

转载 作者:行者123 更新时间:2023-12-04 18:16:17 24 4
gpt4 key购买 nike

        pushf       //couldnt store this in other registers 
movd xmm0,eax//storing in xmm registers instead of pushing
movd xmm1,ebx//
movd xmm2,ecx//
movd xmm3,edx//
movd xmm4,edi//end of push backups
.
.//doing work
.
movd edi,xmm4//pop edi
movd edx,xmm3//pop edx
movd ecx,xmm2//pop ecx
movd ebx,xmm1//pop ebx
movd eax,xmm0//pop eax
popf

比我电脑中的 push eax 版本快 %50。这安全吗?

最佳答案

是的,只要您(或您正在调用的某些代码)在此期间不将 XMM regs 用于其他任何事情。事实上,这个技巧在 RAM init 之前的 BIOS 代码中很常用。

关于assembly - 使用 xmm 寄存器来保存通用寄存器是否安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11630571/

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