代码之家  ›  专栏  ›  技术社区  ›  Steve Dell

ML—sar、shl(?)上的无效指令操作数

  •  0
  • Steve Dell  · 技术社区  · 9 年前

    获取汇编代码中以下指令的“错误A2070:无效指令操作数”(从CL生成)

    mov edx, DWORD PTR ?_Var2@@3JA      
    shl edx, 1326   ;this line gets the error
    
    mov ecx, DWORD PTR ?_Var3@@3JA
    shl ecx, 1514   ;this line gets the error
    
    mov ecx, DWORD PTR __Var4$74314[ebp]
    sar ecx, 3811   ;this line gets the error       
    

    这不是在这里发生的:

    ; Line 698
    movsx   edx, BYTE PTR ?_Var5@@3PAHA+4
    movsx   ecx, BYTE PTR ?_Var6@@3PADA+1
    sar edx, cl
    

    也许与shl,sar与常量而不是寄存器一起使用有关? 困惑:(

    1 回复  |  直到 9 年前
        1
  •  1
  •   Weather Vane    9 年前

    因为 edx 而其他寄存器的大小为32位,将它们移位超过32位是没有意义的。这就是汇编器发出错误的原因。