This question is about Parity Flag. I cannot figure out the difference between JP and JPE or JNP and JPO. Did it just another name for each one or it did have some differnce?
-
@Hovercraft That question is very close, but it's asking about the sign/carry flags; the jump-if-parity varieties are never mentioned, except in a table. – Jonathon Reinhart Aug 21 '18 at 2:36
For a given jump instruction (size), there are just two parity flag conditions it can test. As you guessed, they each have two names:
7B cb JNP rel8 Jump short if not parity (PF=0).
7A cb JP rel8 Jump short if parity (PF=1).
7A cb JPE rel8 Jump short if parity even (PF=1).
7B cb JPO rel8 Jump short if parity odd (PF=0).
x86 Instruction Set Reference - Jcc (c9x.me)
You can see that JNP
and JPO
are the same exact instruction (7B
), as are JP
and JPE
(7A
).
-
3
-
Thank you very much! You solved my probem. I just cannot figure that why a instruction have two name. I had learn that the reason JZ and JE were set is because it have different usage preference or different meaning for USERS. But JP and JPE have no reason to be set. Anyway, Thank you.@Jonathon Reinhart – Jack Zhang Aug 21 '18 at 3:11
-
-
1@JackZhang it's the same reason... the "JPE" reads "jump when parity is even", while the "JP" is "jump when parity is set" ... if you don't write tons of x86 assembly, you may find easier to recall "JPE" than recall if the PF is 1 or 0 when the low 8 bits of result had even parity (also if you expect the HW implementation to just
xor
the 8 bits and put the result into PF, you will actually guess it wrong, the PF=1 for even parity, so there's extra "1" beingxor
-ed into it). So in that aspect usingJPE
is sort of easier to remember. OTOH if you really just want to know if PF=1,JP
.. – Ped7g Aug 21 '18 at 9:51 -
Similarly
JB
andJC
andJNAE
are all the same instruction, involving the carry flag. – Weather Vane Aug 21 '18 at 14:43