zyantific / zydis

Fast and lightweight x86/x86-64 disassembler and code generation library
https://zydis.re
MIT License
3.44k stars 438 forks source link

Incorrect broadcast format in MASM formatter #522

Open sneves opened 2 months ago

sneves commented 2 months ago

Disassembling (for example) the byte sequence 62 f2 55 5b 64 5c 24 20 using the ZYDIS_FORMATTER_STYLE_INTEL_MASM formatting style yields

vpblendmd zmm3 {k3}, zmm5, dword ptr [rsp+80h] {1to16}

However this is not the correct format for MASM, and MASM will complain about it. The correct format for this would be

vpblendmd zmm3 {k3}, zmm5, dword bcst [rsp+80h]

as described in the MASM documentation.

flobernd commented 2 months ago

Hi @sneves, thanks for reporting.

So basically MASM syntax uses bcst instead of ptr to indicate broadcasting and as well omits the regular Intel style broadcast decorator.