locked
Error A2070: invalid instruction operands in SSE MASM64

    Question

  • when compiling this in ml64.exe 64bit (masm64)
    the SSE command give me an error
    what do i need to do to include the SSE commands in 64 bit?

     
       
    .code

    foo PROC

    movlps [rdx], xmm7 ;;error A2070: invalid instruction operands
    movhlps xmm6, xmm7
    movss [rdx+8], xmm6 ;;rror A2070: invalid instruction operands
    ret

    foo ENDP

    end

    i get the error:

     
       1>Performing Custom Build Step
    1> Assembling: extasm.asm
    1>extasm.asm(6) : error A2070: invalid instruction operands
    1>extasm.asm(10) : error A2070: invalid instruction operands
    1>Microsoft (R) Macro Assembler (x64) Version 8.00.50727.215
    1>Copyright (C) Microsoft Corporation. All rights reserved.
    1>Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"


    • Edited by _Green_ Monday, March 15, 2010 6:00 PM
    Monday, March 15, 2010 1:00 PM

Answers

  • The thing I would suggest is use the size descriptors for the first operand.

    movlps qword ptr [rdx], xmm7

    Because you are dereferencing a memory location (that is what the [] does, it says to access the memory location specified in rdx) the assembler doesn't know the size of the memory block you are pointing to. So you have to give the assembler the size of this memory location. The qword ptr tells it that it is pointing to a qword block of memory (that is quad word or 8 byte, which is the same size as half of xmm7).

    A similar thing is true for movss. Except that in this case you would need to use dword ptr instead of qword ptr. So modify this line to.

    movss dword ptr [rdx+8], xmm6

    Oh, and if you are going to give a sample please make sure that it will give only the problem you describe. Your sample will actually give two more errors. The first is on the line

    test PROC

    and the second is on the line

    test ENDP

    This is because test is an instruction and instructions take priority over identifiers. So instead of seeing the proc and thinking test is a name of a procedure, it will see test think that it is an instruction and expect two valid parameters for it.

    *Edit*

    Also, please don't post in multpile forums.
    Duplicate http://social.msdn.microsoft.com/Forums/en-GB/vcgeneral/thread/4f473acb-7b14-4bf4-bed3-e5e87e1f81e7

    Visit my (not very good) blog at http://c2kblog.blogspot.com/
    • Marked as answer by _Green_ Tuesday, March 16, 2010 7:38 AM
    Monday, March 15, 2010 5:11 PM