本文介绍了为什么x86具有冗余的JNGE指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

英特尔指令集参考,其中提到了两种不同的指令:

On page 3-431 of the Intel instruction set reference, two different instructions are mentioned:

7C cb  JL rel8   Jump short if less (SF ≠ OF).
7C cb  JNGE rel8 Jump short if not greater or equal (SF ≠ OF).

为同一条指令使用两个名称背后的原因是什么?我是否使用 JL JNGE 都很重要?

What is the reasoning behind having two names for the same instruction? Is there any instance where it matters whether I use JL or JNGE?

推荐答案

这只是为了使代码更具可读性,以防一个或多个代码与您的意图更好地匹配.正如您所引用的,机器代码是相同的,最终这就是处理器将执行的代码.因此,它不知道您使用的是 JL 还是 JNGE .所有关系的名称也都取反.

It's just to make code more readable in case one or the other matches your intention better. As you quoted, the machine code is the same, and ultimately that's what the processor will execute. As such, it won't know whether you used JL or JNGE. All the relations have their negated name too.

还有其他重复项可以更好地说明可读性,例如 JE JZ .比较之后,通常使用 JE ,否则使用 JZ .同样,您有 JB JC .

There are other duplicates that illustrate the readability point a little better, for example JE and JZ. You'd normally use JE after a comparison, and JZ otherwise. Similarly you have JB and JC.

这篇关于为什么x86具有冗余的JNGE指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 21:18