MS assembly integer literal question

Hi all,

I’ve got an interesting AsmLexer failure (originally found as a breakage post-D87400, now reverted). ms-inline-asm-avx512.c includes the line:
__asm vaddps xmm1, xmm2, [c]{1to4}

The trouble is: MASM doesn’t use the {1toX} syntax for the AVX-512 instructions. Instead, they implemented a “bcst” keyword, which would roughly apply as:
__asm vaddps xmm1, xmm2, dword bcst [c]

See https://devblogs.microsoft.com/cppblog/microsoft-visual-studio-2017-supports-intel-avx-512/#embedded-broadcast

Can we remove support for the {1toX} syntax in MASM contexts, or do we need to keep it until we can implement “bcst” support?

Context:

The current implementation (before my change) doesn’t support this “bcst” keyword, so it isn’t actually following MASM - but no one noticed. x64 MSVC doesn’t allow inline assembly, so there’s nothing to compare to in that context.

The problem: I’m trying to add support for full MASM-style integer literals in our inline assembly when targeting MSVC compatibility (or at least in the upcoming LLVM-ML project). The “1to4” syntax conflicts with that, as “1t” gets lexed as an integer literal, with the “t” recognized as a decimal radix specifier. We can special-case that away by checking for an “o” following the “t”, but that might have false positives.

Thanks,

  • Eric

I think disabling support for the 1to4 syntax in masm-mode would be fine. No need to wait until bcast is implemented. It’s probably better to keep things moving.