문제

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!

도움이 되었습니까?

해결책

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):

pcmpeqw mm2, mm2

다른 팁

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:

mov ebx, 0xffffffff
movd mm2, ebx       //copy value to lower 32 bits
punpckldq mm2, mm2  //copy lower 32-bits to upper 32 bits
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top