gpt4 book ai didi

arm - ARM7 IT(如果有的话)指令的真正作用是什么?

转载 作者:行者123 更新时间:2023-12-04 10:06:58 24 4
gpt4 key购买 nike

我无法理解IT指令的功能(如果有的话)。 quick reference card具有以下内容:

Operation: If-Then
Assembler: IT{pattern} {cond}
Action: Makes up to four following instructions conditional, according to pattern. pattern is a string of up to three letters. Each letter can be T (Then) or E (Else). The first instruction after IT has condition cond. The following instructions have condition cond if the corresponding letter is T, or the inverse of cond if the corresponding letter is E.



实际上,该提要有点意义。在了解的过程中, manual entry体系结构并没有带我去任何地方:

If-Then condition instruction.
Syntax

IT{x{y{z}}} cond

Where: x specifies the condition switch for the second instruction in the IT block.
y Specifies the condition switch for the third instruction in the IT block.
z Specifies the condition switch for the fourth instruction in the IT block.
cond Specifies the condition for the first instruction in the IT block.

The condition switch for the second, third and fourth instruction in the IT block can be either:
T Then. Applies the condition cond to the instruction.
E Else. Applies the inverse condition of cond to the instruction.

Note

It is possible to use AL (the always condition) for cond in an IT instruction. If this is done, all of the instructions in the IT block must be unconditional, and each of x, y, and z must be T or omitted but not E. Operation

The IT instruction makes up to four following instructions conditional. The conditions can be all the same, or some of them can be the logical inverse of the others. The conditional instructions following the IT instruction form the IT block.

The instructions in the IT block, including any branches, must specify the condition in the {cond} part of their syntax.



由于(大多数)每条指令都可以轻松指定条件,因此 IT指令有什么用?

最佳答案

首先请注意,大多数指令可以在ARM指令中指定条件代码,而不是在Thumb中指定条件代码。

使用IT指令,您最多可以为4条指令指定条件代码。对于每条指令,您可以指定它是If(T)还是Else(E)的一部分。

例如:

ITTET EQ
ADD r0,r0,r0
ADD r1,r0,r0
ADD r2,r0,r0
ADD r3,r0,r0

实际上将转换为:
ADDEQ r0,r0,r0  (Always if for 1st one)
ADDEQ r1,r0,r0 (T for 2nd one)
ADDNE r2,r0,r0 (E for 3rd one)
ADDEQ r3,r0,r0 (T for 4th one)

关于arm - ARM7 IT(如果有的话)指令的真正作用是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36558926/

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