<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58270>58270</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AMDGPU][GFX9][MC] Invalid encoding of image_gather4h
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AMDGPU,
mc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
dpreobra
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dpreobra
</td>
</tr>
</table>
<pre>
The encoding of `image_gather4h` is not valid.
An example of failed test (GFX9):
image_gather4h v[252:255], v[1:2], s[8:15], s[12:15] dmask:0x1
Expected output:
0x00,0x01,0x08,0xf1,0x01,0xfc,0x62,0x00
Actual result:
0x00,0x01,0x84,0xf1,0x01,0xfc,0x62,0x00
Moreover, assembler accepts `image_gather4h` for SI, CI and VI where this opcode is not supported.
An example of failed test (VI):
image_gather4h v[252:255], v[1:2], s[8:15], s[12:15] dmask:0x1
Expected output:
error: instruction not supported on this GPU
Actual result:
0x00,0x01,0x84,0xf1,0x01,0xfc,0x62,0x00
Looks like the issue was introduced by [D130764 ](https://reviews.llvm.org/D130764).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVMGOmzAQ_Rq4WI2Mgwk5cMgm3VWkRqrUdtVbZcwAbgxGtkmyf98xS9pE2sP2UjUJGc8De968Z1Oa6qX42gKBXppK9Q0xNYkyqjrRwI9G-BZs2iJAlCO98eQktKoWEd1FdPP6v-kJXEQ3aAhza6E0VMSD8yRi-dPj93XE1tFyczuF4Oe-AjlF_IFxhg8yziO-i9h2wpKAzLnDPMc84TdAwq4IqTrhjpjRS3Jb7eNlAOmRlBn9MPo3uNALpbgehuQ15FOok1uwllPI2CtI7zSQfhSaWHCjfk-BPP3LAgdjwZzAhq6Fc9CVGiwRUsLg3duG1caSL_swYbsnoq_I856c8S4Q36KZZkDD4WqrG4fBWBTp_dY-7_9_Y8FaYxEnqnfejtIr09_3SxCY9Hj6_O2fOvrJmKMjWh2DH8EHNwI5C4dUvTXVKJFb-UJQiF2ypKssJZM2eev94AIh9og_CycFZ7fQ-tQtjG0Qmh9Hc2YvYyiSLOMpS_GKq2JZrZdrEXvlNRS4_uawC83j6vxhOq_T6LANyu_76cDfvR7uDY5Hq4t7Uo3y7VgupOkwCczm8GGw5ic6hunUrsMBz9mKxm0hQYo6ldmSZ1km8jSDMhcJoxLKdCVFEmtRgnaBb8RYKeQR-gorzuRZkBh3JetkGPNdrApGGUsoflccG1-smFhzmed5wmqRZnWUUuhwS__WLrbFxLIcG4c3tXL-j7AxnjrV9AAzg2rAA1laMVcTo2-NLa5oPPVXTM39Atxqi3k">