为什么 ARM 文档中没有 BXEQ 指令?

Why isn't the BXEQ instruction in the ARM documentation?

我目前正在尝试学习汇编,如果这真的很初级,请见谅。

我用arm-linux-gnueabi-gcc -march=armv8-a交叉编译了一个C程序,然后用arm-none-eabi-objdump -d反汇编了它。 在反汇编指令中,我看到许多对 BXEQ 指令的引用,例如:

   1032c:   e08f3003    add r3, pc, r3
   10330:   e7932002    ldr r2, [r3, r2]
   10334:   e3520000    cmp r2, #0
   10338:   012fff1e    bxeq    lr

但是,我在任何 ARM 文档中都没有看到 BXEQ。 我所能找到的只是它在一些代码示例中的使用,但没有任何解释甚至没有提到它:https://developer.arm.com/documentation/100748/0607/hpz1474359444075

请注意,我不是在问 BXEQ 的作用 - 我是在问为什么它不像其他 ARM 指令那样出现在文档中。

嗯,首先,您 link 的文档是编译器指南,与底层汇编程序指令没有任何关系。

您正在寻找的是 instruction set documentation for the BX instruction,它可以使用条件标志来决定是否执行它的工作。

也许可以在 this PDF link 部分 4.3 下找到更好的(虽然不一定是官方的)文档:

BX - branch and exchange.

  BX{cond} Rn
    {cond} Two character condition mnemonic.
           See Table 4-2: Condition code summary on page 4-5.
    Rn is an expression evaluating to a valid register number.

这实际上是 ARM 做事方式的基础,如前所述 here:

Most A32 instructions only execute when previous instructions have set a particular condition code. This means that instructions only have their normal effect on the programmers’ model operation, memory and coprocessors if the N, Z, C and V flags satisfy a condition specified in the instruction.

If the flags do not satisfy this condition, the instruction acts as a NOP. This means that execution advances to the next instruction as normal, including any relevant checks for exceptions being taken, but has no other effect.

This conditional execution of instructions allows small sections of if- and while-statements to be encoded without the use of branch instructions.