我正在使用visual studio 2005练习编写一些汇编代码。我使用.mmx
编写了一个简单的函数。
这是完整的文件
.586
.mmx
.model flat,c
.code
Sum_ proc
; Sun_(unsigned short int*, number)
;Pre Setup
push ebp
mov ebp, esp
push esi
push ebx
; Get the number of values to sum
mov ecx, [ebp+12]; ecx = number
xor eax, eax ; eax = 0
; Get data array to sum
mov esi, [ebp+8]
; Set mm0 to 0
movd mm0, eax
@@:
add eax, 4
; See if the system exceeds the number
cmp eax, ecx
jg @f
; process through mmx
movq mm1, [esi + eax - 4]
paddsw mm0, mm1
jmp @b
@@:
; Clear some registers
pxor mm1, mm1
pxor mm2, mm2
; Unpack and sum
punpckhwd mm1, mm0
punpcklwd mm2, mm0
paddd mm2, mm1
; Clear some registers
pxor mm0, mm0
pxor mm1, mm1
punpckldq mm0, mm2
punpckhdq mm1, mm2
paddd mm0, mm1
pshufw mm4, mm0, 00011011b ; Retreive the summed value
movd edx, mm4
; Add the remaining values
sub eax, 3
@@: cmp eax, ecx
jge @f
xor ebx, ebx
mov bx, word ptr [esi + eax]
add edx, ebx
inc eax
add edx, ebx
jmp @b
@@:
mov eax, edx
; Return
emms
pop ebx
pop esi
pop ebp
ret
Sum_ endp
end
在线:pshufw mm4, mm0, 00011011b ; Retreive the summed value
我收到以下错误:
Error 1 error A2085: instruction or register not accepted in current CPU mode
我知道命令有效。任何人都可以告诉我如何解决此错误。