assemblyx86x86-64instructionsmnemonics

Is VGF2P8AFFINEINVQB the longest x86 instruction mnemonic?


Trivia Question

At 17 characters, is VGF2P8AFFINEINVQB - Galois Field Affine Transformation Inverse, the longest x86 instruction mnemonic? Is there a length limit?


Solution

  • Sure, probably yes at the moment, VGF2P8AFFINEINVQB at 17 bytes is the longest mnemonic in Intel's docs.

    There's no length limit; assemblers are just software, each one with a different parser. If you were adding this instruction to an old assembler that had some hard-coded token-length limit, you could make up an alternate name. The CPU only cares about machine code1.

    One way to confirm if it's the longest Intel currently documents would be to check a database of instructions, like the one that comes with XED. https://uops.info/xml.html . That should contain them all, unless some are constructed via suffixes.


    Other long instructions I see from visually scanning down the left-hand column of https://www.felixcloutier.com/x86/ include AESDECWIDE128KL (15 bytes), but that doesn't have a V VEX form and that would only get it up to 16 byte. But that page doesn't use a monospace font, and some entry titles aren't the full name of an instruction (e.g. vbroadcast).

    Compares with an infix predicate can get somewhat long, but I think the longest is VCMPUNORD_SPS (13 bytes).

    VFMADDSUB132PD and VPMULTISHIFTQB are both 14. VBROADCASTF32X8 is 15.


    Footnote 1: Intel's manuals don't bother to define much about asm syntax rules, but do lay out rules for machine code.

    Machine code has a max instruction length of 15 byte which can at least hypothetically force breaking up a complex instruction into multiple instructions using a temporary register, e.g. for an LEA or mov-immediate. (Maybe for real with APX for 4-byte EVEX prefixes for integer instructions, like lock add r31d, [fs: r30+rax*4 + 0x123456], 12345678 which needs a ModRM+SIB + disp32 and an imm32, so 10 bytes for that, plus 4-byte EVEX plus opcode. So that's 15 byte without segment or lock prefixes.)