<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/67951>67951</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [MIPS] Backend Bugs
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          witbring
      </td>
    </tr>
</table>

<pre>
    I separate the bug report #67787 since the report has distinct bugs

The subsequent issue was identified within Clang v16.0.0.

### Operand Type Check Bug

Clang changes a memory operand as an immediate value in the case of `bc1tl`, `bc1fl`, `jal`, `jalx` and `j` instructions.
```
$ cat buggy3.s
    bc1tl (1)
 bc1fl (2)
    jal (3)
    jalx (4)
    j (5)

$ ./bin/clang -c --target=mips buggy3.s -o buggy3.o

$ objdump -d buggy3.o

00000000 <.text>:
   0:   45030000        bc1tl   0x4
 4:     00000000        nop
   8:   45020000        bc1fl   0xc
   c:   00000000        nop
  10:   0c000000        jal     0x0
  14:   00000000        nop
 18:    74000001        jalx    0x4
  1c:   00000000        nop
  20:   08000001        j       0x4
  24:   00000000        nop
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8lNuOmzAQhp_G3IyCjM0hvuBiN2mkvahaqfsCxgzgLBiKzSZ5-8rA5rCqEqGE-T3-_M8QRlqra4OYk-SVJPtATq7px_ykXTFqUwdFX17yN7A4yFE6BNcgFFMNIw796IAwnmbZNgOrjVpW15VGWii1ddoo53dYQveEvizf7w2CnQqLfyc0DrS1E8JJWtAlGqcrjSWctGu0gV0rTQ2fURrSkIb3EML4csGvAUdpSni_DAi7BtUHvE71fe5CUY00NVqQ0GHXjxfo143SgjSguw5L7av8lO2EoM1ckJIWoa-ApLRQkWtJSgnbrWF1Fx7lY3AmKQWP96G_18a6cVJO98Z-lZLS9VprikHJuWH1hYdr0wAA5qOBsG1EmFjl-XyvsZsGAEc5i_y7ePZq_Kh6KblKNxMhYYdCG8IOam7dRsFm4-RYoyN83-nBXj3Cpv-6779j-uJYTt0Am_K_KXT9AOG70OHZEf6D8JerPzoHIk4oX9KoWB4BFfQcr2nxknRjUWH64crYXhnsjlEtDHVNU08p0eqEqtuyf9yeQa9JT51Eq5EsnhejFXF-qAWi5z7Yl4_tHeSRwJ65-PZ3C8qcl4ILGWAepSJlLM4SETQ5k0mWJUnMKK8KWWIlkFIhJC0Uj7diG-icUcYjShlNOOMirEqOosAoyraJSpKKxBQ7qduwbT-7sB_rYH7L8zQTSRS0ssDWzkOHMYOnZQQQxvwMGnO_ZzMPjZi22jp7ozjt2nla_Xz7_Ycke3iV6gNN6d94G0xjmzfODdb3gB0IO9TaNVMRqr4j7OAp689mGPsjKkfYYT7bEnaYvf0LAAD__1U1YXA">