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

    <tr>
        <th>Summary</th>
        <td>
            [x86/x86-64] 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

We found that clang silently changes the size of registers without any WARNING message. 
We found such cases from `tpause` and `umwait` instructions.
```
$ cat buggy4.s
.intel_syntax noprefix
    tpause RDX
    umwait RBP

$ ./bin/clang -c buggy4.s -o buggy4.o

$ ./bin/objdump -d -M intel buggy4.o

buggy4.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:
   0:   66 0f ae f2             tpause edx
   4:   f2 0f ae f5     umwait ebp
```

### Different Memory Operand Format

Lastly, we found that Clang changes a memory operand to a different format.

```
$ cat buggy6.s
.intel_syntax noprefix
 enqcmd SP, ZMMWORD PTR [EAX+1]
    enqcmds SP, [EAX]
    movdir64b SP, [EAX+1]
$ ./bin/clang -c -m32 buggy6.s -o buggy6.o

$ ./bin/objdump -d buggy6.o -M intel

buggy6.o:     file format elf32-i386


Disassembly of section .text:

00000000 <.text>:
   0:   67 f2 0f 38 f8 60 01    enqcmd sp,[bx+si+0x1]
   7:   67 f3 0f 38 f8 20       enqcmds sp,[bx+si]
   d:   67 66 0f 38 f8 60 01    movdir64b sp,[bx+si+0x1]
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU2Pm0gQ_TXtSwnUNNDYBw7jcbyKtJOMZkeaaC-rBgroBBpCNWN7f_2KD2N7NpONFiF_dFe9erx6TSkiXRjEmIVbFu5Wqrdl08UHbZNOm2KVNNkp_giEreqURbAl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