llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.68k stars 11.86k forks source link

Assembler fails on capitalized instruction #87917

Open boomanaiden154 opened 6 months ago

boomanaiden154 commented 6 months ago

When llvm-mc (with the flags --filetype=obj --assemble) is run against the following assembly:

.intel_syntax noprefix
rep mov eax, 1

It produces a valid object file as expected. However, when llvm-mc is run against the same string, but with everything capitalized:

.intel_syntax noprefix
REP MOV EAX, 1

llvm-mc complains about it:

/tmp/test.s:2:1: error: invalid instruction mnemonic 'MOV'
REP MOV EAX, 1
^~~

I'm not sure if I'm missing something here, but as far as I'm aware, assembly is supposed to be capitalization agnostic.

topperc commented 6 months ago

this might be this FIXME in X86AsmParser.cpp

    // FIXME: The mnemonic won't match correctly if its not in lower case.
    Name = Parser.getTok().getString();