<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/98436>98436</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Argument limit for avx2_gather is too weak
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
KanRobert
</td>
</tr>
</table>
<pre>
https://www.godbolt.org/z/9T1eGPWjY
llvm/include/llvm/IR/IntrinsicsX86.td
```
def int_x86_avx2_gather_q_q_256 : ClangBuiltin<"__builtin_ia32_gatherq_q256">,
DefaultAttrsIntrinsic<[llvm_v4i64_ty],
[llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i8_ty],
[IntrReadMem, ImmArg<ArgIndex<4>>]>;
```
The i8 operand is a scale, and should be 1, 2, 4 or 8. But now the middle end only knows it's 8-bit immediate. So llvm-reduce may assign 0 to the operand and then produce incorrect IR.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU99vmzAQ_mvMy6kIbCDkgYf8aKZomjRllbY9IYMPcGvsxDZJs79-Mk3Xqh2CE_f5fnwH93HnZK8RK5KvSb6N-OQHY6uvXB9Mg9ZHjRHXavD-6AhbEbojdHe5XOLeiMYoHxvbE7r7Q-hu-ZDil-8_H3-TZEuS1YtV6jwSupO6VZNAQnc3YH8IRnsrtZOt-1UWsRe3xCK53bMLAjuQ2tfPZVHz8zOte-4HtPWpPtU0L4CwFWwU1_16kspLTdiGUFrXzYtbS85ec071ieYFoZSwe0I3twZb7Pik_Mp76_5RClXydWBbnzNZZLW_knz7lnS7PsXQDczA0dv37qfzT4AsP7Yg-TrQOSAX33AMgftxXNmesM3K9nst8JmwTRZmYfchM7ys__sRHwYEWYI5ouVagHTAwbVcYagaEDeYSQloENIA0WAyMBbKGNaTB20u4AeEUQqhEFALMFpd4UmbiwPpCV04KO8a6UGOIwrJPcbww8yz3VkUU4sw8iu87Bsk4M1c8JVSePyAGo7WzMFSt8ZabD3sD3EkKiaWbMkjrNIFTYpFyYosGipsm7ZMujZLW8E61vGCMt51aZaWOaVlG8mKJjRLFmmaFCnNsrgTXVsWy5SzRpSYNiRLcORSxYFpWOdIOjdhtSwzVkSKN6jcLA5KNV5gPgwblG8jW83TNVPvSJYo6bx7q-KlV1itbD-NqD0oOUoPnbHwbofDj_DGwAX5UzRZ9UFnvfTD1MStGd-EM3c8WvOIrQ_CCnRcUN9M91zRvwEAAP__aWQ0cA">