在 x86 汇编代码中,和JE与 和JNE完全一样吗?JZJNZ
163105 次
3 回答
138
JE并且JZ只是完全相同的事物的不同名称:当ZF(“零”标志)等于1时的条件跳转。
(类似地,当等于 0时, JNEandJNZ只是条件跳转的不同名称。 )ZF
你可以互换使用它们,但你应该根据你在做什么来使用它们:
JZ/JNZ当您明确测试等于零的东西时更合适:dec ecx jz counter_is_now_zeroJE并且在指令JNE之后更合适:CMPcmp edx, 42 je the_answer_is_42(一条
CMP指令执行减法,并把结果的值扔掉,同时保留标志;这就是为什么ZF=1当操作数相等而ZF=0它们不相等时得到的原因。)
于 2013-01-10T21:31:34.027 回答
41
从Intel 的手册 - Instruction Set Reference中,JEandJZ具有相同的操作码(74for rel8 / 0F 84for rel 16/32)也 JNE和JNZ(75for rel8 / 0F 85for rel 16/32)共享操作码。
JE并且JZ它们都检查(或零标志),虽然手册中对第一个rel8 和rel8用法ZF的描述略有不同,但基本上它们是相同的。JEJZZF
这是手册第 464、465 和 467 页的摘录。
Op Code | mnemonic | Description
-----------|-----------|-----------------------------------------------
74 cb | JE rel8 | Jump short if equal (ZF=1).
74 cb | JZ rel8 | Jump short if zero (ZF ← 1).
0F 84 cw | JE rel16 | Jump near if equal (ZF=1). Not supported in 64-bit mode.
0F 84 cw | JZ rel16 | Jump near if 0 (ZF=1). Not supported in 64-bit mode.
0F 84 cd | JE rel32 | Jump near if equal (ZF=1).
0F 84 cd | JZ rel32 | Jump near if 0 (ZF=1).
75 cb | JNE rel8 | Jump short if not equal (ZF=0).
75 cb | JNZ rel8 | Jump short if not zero (ZF=0).
0F 85 cd | JNE rel32 | Jump near if not equal (ZF=0).
0F 85 cd | JNZ rel32 | Jump near if not zero (ZF=0).
于 2013-01-10T21:32:49.487 回答
-6
je : Jump if equal:
399 3fb: 64 48 33 0c 25 28 00 xor %fs:0x28,%rcx
400 402: 00 00
401 404: 74 05 je 40b <sims_get_counter+0x51>
于 2019-07-05T06:41:52.423 回答