<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [MIPS] Many MIPS16 instructions are not recognized"
   href="https://bugs.llvm.org/show_bug.cgi?id=51251">51251</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[MIPS] Many MIPS16 instructions are not recognized
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jesse.a.deguire@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25082" name="attach_25082" title="Test asm file containing every MIPS16 instruction">attachment 25082</a> <a href="attachment.cgi?id=25082&action=edit" title="Test asm file containing every MIPS16 instruction">[details]</a></span>
Test asm file containing every MIPS16 instruction

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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>