1

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.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Hi - I love SO
  • 615
  • 3
  • 14
  • What's Zydis? Those aren't x86 instructions, and you don't have any other tags that would shed any light on where they come from. – Peter Cordes Aug 23 '20 at 08:30
  • Zydis is an x86 disassembler. Added a link. – Hi - I love SO Aug 23 '20 at 08:35
  • Given that it's not referenced anywhere else in the source tree (just the auto-generated and the `ZYDIS_MAKE_SHORTSTRING("jkzd")` https://github.com/zyantific/zydis/search?q=JKZD&unscoped_q=JKZD), there's no way to know why it's there. Except maybe if there's a mention in a git commit message. Unless something indexes that array element with a numeric constant or reaches it in a loop? Anyway, it's not an x86 instruction. You might want to open an issue on their github to point out that these aren't instructions. Either it was a bug or they'll explain why it's there. – Peter Cordes Aug 23 '20 at 08:35
  • @PeterCordes Edited with another source. – Hi - I love SO Aug 23 '20 at 08:39
  • Ah, interesting, yeah Knight's Corner has its own version of what later became AVX-512. So there you go, 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. – Peter Cordes Aug 23 '20 at 08:41

1 Answers1

7

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.)

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847