assemblyx86x86-64disassemblyxeon-phi

What are JKZD and JKNZD?


Looking through Zydis ( https://github.com/zyantific/zydis/blob/57be5b1d1b9dd99830b89caac928add64ad5d072/include/Zydis/Generated/EnumMnemonic.h ) mnemonics I found these:

ZYDIS_MNEMONIC_JKNZD,
ZYDIS_MNEMONIC_JKZD,

I couldn't find these mnemonics anywhere else; what instructions do they represent?

What operations do these instructions perform?

Z and NZ would likely indicate zero and not zero respectively, and J likely stands for jump, but K and D?

Edit: I found this old intel document, but it makes no sense:

http://www.cism.ucl.ac.be/Services/Formations/ICS/ics_2013.0.028/vtune_amplifier_xe/documentation/en/instructions/327364001EN.pdf

It states (page 75) that JKZD is encoded as VEX.NDS.128.0F.W0 84 id.


Solution

  • You already answered your own question with that Intel Knight's Corner link. KNC had its own version of what later became AVX-512, with incompatible machine-code encodings.

    As documented in that Intel manual, KNC had instructions like jrcxz but for mask registers (which KNC and AVX-512 call k0..k7) to let you compare-and-branch in one instruction on a vector compare-into-mask result. JKZD - Jump near if mask is zero. It has 2 forms, jkzd k1, rel32 and jkzd k1, rel8

    These are not standard instructions and don't appear in Intel's mainstream manuals (which include AVX-512). In AVX-512, you branch on a mask register value with ktest k1,k1 or kortest k1,k1 to set regular FLAGS, then use a regular branch condition. (With unrolling to get 2 vector compare results, you can branch on either of them being non-zero with kortest k1,k2 with 2 separate registers.)