如何在移动两个32位寄存器,一个64位的? [英] How to move two 32 bit registers in to one 64 bit?

查看:253
本文介绍了如何在移动两个32位寄存器,一个64位的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们说,我想提出两个32位的寄存器 EAX 低32位字和 EDX 高32位字到RAX。
我已经找到一种方法:

Let's say that I want to put two 32 bit registers EAX as low 32 bit word and EDX as high 32 bit word into RAX. I have find one way:

  shl   rdx, 32
  or    rax, rdx

此方法仅适用,如果我们相信,从32到 RAX 61位是0,如果我们不舒尔说,比我们首先要明确的高32位字,如:

This method works only if we are sure that bits from 32 to 61 of RAX are 0. If we are not shure that, than we must first clear the high 32 bit word, like:

  mov   eax, eax      //This instruction should clear the high 32 bit word of RAX

这是最近的路?

有没有执行此操作的一个asm X86-64运算指令?

Is there a single asm x86-64 instruction that does this operation?

推荐答案

这也许就是防抖:

shl     rax,32
shrd    rax,rdx,32

不认为高双字均为零。

Does not assume that high dwords are zero.

这篇关于如何在移动两个32位寄存器,一个64位的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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