如何将全 1 加载到 mmx 寄存器中?为什么这不起作用?
当我搜索时,除了关于 64/32 位内容的意见问题之外,似乎找不到任何其他内容。
__asm__ {
mov rbx, 0xFFFFffffFFFFffffull
movq mm2, rbx
}
根据我的 xcode 调试器(这是 C++ 中的内联 asm),在这 2 条指令之后,mm2 寄存器保存值 0x30500004ffffffff。现在我是 x86 汇编的新手,我的汇编课程是用 MIPS 教授的,我很久以前就学过,但我想这不起作用,因为我正在 32 位模式和 rbx 下编译(这是 Photoshop 插件的一部分)( ebx、bx 等的 64 位版本,对吗?)技术上可能不存在。我尝试了其他方法来获得全 1,例如将 0xfffffffful 加载到 mm2 和另一个寄存器中并相乘,但这似乎也不起作用。
我正在用一些 SIMD 指令来优化我的插件,但我似乎无法弄清楚或找到任何不会让我的眼睛受伤的文档。非常感谢任何帮助!
couldn't seem to find anything besides opinion questions on 64/32 bit stuff when I searched.
__asm__ {
mov rbx, 0xFFFFffffFFFFffffull
movq mm2, rbx
}
After these 2 instructions the mm2 register holds the value 0x30500004ffffffff according to my xcode debugger (this is inline asm in C++). Now I am new to x86 assembly and my assembly class was taught in MIPS which I took forever ago, but I suppose this isn't working because I am compiling (this is a part of a photoshop plugin) in 32 bit mode and rbx (the 64 bit version of ebx, bx etc, right?) probably doesn't technically exist. I tried other methods to get all 1's like loading 0xfffffffful into mm2 and another register and multiplying but that also didn't seem to work.
I'm fixing to optimize my plugin with some SIMD instructions but I can't seem to figure it out or find any documentation that doesn't make my eyes hurt. Any help is much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然 interjay 的代码可以实现您想要的功能,但有一种更简单的方法可以将 MMX 寄存器(或 XMM 寄存器,就此而言)设置为全 1(此处为
mm2
):Although interjay's code does what you want, there's an easier way to set an MMX register (or XMM register, for that matter) to all-1's (here for
mm2
):您无法在 32 位程序中运行 64 位汇编代码。您可以从内存位置将值读入 MMX 寄存器,或者使用如下所示的内容:
You can't run 64-bit assembly code in a 32-bit program. You can either read the value into the MMX register from a memory location, or use something like this: