is it safe to use xmm registers to save the general-purpose ones?

核能气质少年 提交于 2019-12-10 23:49:37

问题


        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

is %50 faster than push eax version in my computer. Is this safe?


回答1:


Yes, as long as you (or some code you're calling) doesn't use XMM regs for anything else in the meantime. In fact, this trick is commonly used in BIOS code before RAM init.



来源:https://stackoverflow.com/questions/11630571/is-it-safe-to-use-xmm-registers-to-save-the-general-purpose-ones

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!