gpt4 book ai didi

gcc inline - 'cmp' 的操作数类型不匹配

转载 作者:行者123 更新时间:2023-12-04 20:37:30 24 4
gpt4 key购买 nike

我收到以下错误:

Assembler messages:
Error: operand type mismatch for `cmp'

我的代码中唯一的 cmp 是:

"cmpl %eax, $15\n\t"

我不明白这有什么问题 - 我有一个寄存器和一个立即值,它应该被隐式地符号扩展到 32 位。

最佳答案

根据 Official Intel ISA Reference 3.2 说明(A-L)

CMP EAX, imm32

这意味着 Intel Syntax

cmp eax, 15D

或在AT&T Syntax :

cmpl $15, %eax

恰恰相反:)


cmp 没有从立即数中减去 reg/mem 的形式。相反,如果您想检查除相等性之外的其他内容,请使用相反的分支/cmov 条件。

关于gcc inline - 'cmp' 的操作数类型不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30200515/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com