装配小于

Assembly less than

我正在尝试在 AMD64 汇编中重新创建一个 "less than" 函数。

就像在这种情况下,如果 %rdi 中的参数小于 3,我想要 return1。

        .globl f
        .type f, @function
f:
        xor %rax, %rax
        movq %rdi, %r10
        cmpq , %r10
        cmovlq , %rax
        ret

我以前从未使用过cmov,我不确定我是否正确使用它。我收到以下错误:

Error: suffix or operands invalid for cmovl

有人可以帮我吗?

您应该已经查阅了指令集参考。没有cmov允许立即数,需要使用寄存器。