Skip to content

[MIPS] Many MIPS16 instructions are not recognized #50595

Open
@jdeguire

Description

@jdeguire
Bugzilla Link 51251
Version trunk
OS Linux
Attachments Test asm file containing every MIPS16 instruction, The output of calling llvm-mc on the attached asm source

Extended Description

It would appear that LLVM does not recognize many MIPS16 instructions.

The attached assembly file is a test I made that contains, as far as I can tell, every MIPS16 instruction. I can build it with GCC 9.3 without any issues using the following command on Ubuntu 20.04 64-bit (Windows 10 WSL).

mipsel-linux-gnu-gcc -march=mips32r2 -mips16 <source> -o <obj file>

However, trying to build it with Clang or LLVM-MC fails with many "instruction requires a CPU feature not currently enabled" or "invalid operand for instruction" errors. I have not yet verified that the instructions that do not cause errors are correctly encoded, but a cursory look suggests that they are not (they might be using the MIPS32 forms instead).

llvm-mc -arch=mipsel -mcpu=mips32r2 -mattr=+mips16 -show-encoding -show-inst <source>
--OR--
clang -target mipsel-linux-gnu-musl -march=mips32r2 -mips16 -c <source> -o <obj file>

I cloned and built my version of LLVM and Clang on 27 July, 2021; however, I believe this issue has been present for a long time. It is present on LLVM 10 that is available on Ubuntu 20.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions