<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115742>115742</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Bug in the VectorEmulateNarrowType logic
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
banach-space
</td>
</tr>
</table>
<pre>
**Reproducer**
```mlir
func.func @vector_cst_maskedload_i4(%passthru: vector<8xi4>) -> vector<8xi4> {
%0 = memref.alloc() : memref<3x8xi4>
%cst = arith.constant dense<0> : vector<8xi4>
%mask = arith.constant dense<[false, true, true, true, true, false, false, false]> : vector<8xi1>
%c0 = arith.constant 0 : index
%1 = vector.maskedload %0[%c0, %c0], %mask, %passthru :
memref<3x8xi4>, vector<8xi1>, vector<8xi4> into vector<8xi4>
return %1 : vector<8xi4>
}
```
**To run**
```bash
mlir-opt --test-emulate-narrow-int="arith-compute-bitwidth=1 memref-load-bitwidth=8" --cse --split-input-file
```
**Error**
ATM, this example will trigger an infinite loop due to this [while cond](url) not supporting `arith.constant`. Once that's fixed, I get this error:
```bash
file.mlir:1 offset :8:8: error: failed to legalize operation 'vector.maskedload' that was explicitly marked illegal
%1 = vector.maskedload %0[%c0, %c0], %mask, %passthru :
^
```
CC @lialan
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU1v4zYQ_TX0ZSBBJiXLPujg2AnQQ1ugCHoNKGoksUuRAjnKR399QcrZbBJvelrDpmhq5vHpzRtKhqAHi9iw6oZV541caHS-aaWVaszCLBVuWte9NIwfGT_-hbN33aLQr_-BFWdWHC_jrli_k9F-XeoXq_I4ACuLR1Tk_IMK9DDJ8A0742T3oEvG94xXswyBRr8wcYQ1konT_lmXTNwyfoCMidtPN4DVN-tOAIxXBTBxhgknj30ujXEqYR8ggq7LTJzE8yvsmsl4pQKlVOk1jblyNpC0BB3agEycirTVNWJve8dH-gqDVTe9NAEZPwH55cvr98APk-p8jcj2PRFVXKNRpDRtO3z-IXabQlew_K0oScvoiIgWt18n1fkyj5GX6WvZIvwrMFzTmp8-k_6wliqqLbmf6uyRFm9fmf-sHqw-f3DkO5sm59478Itd5x-CWxnGdSkaOXMzQZYRBspwWowkzKz03j1l2hITZ8Z50jpTbpoXwqzV9KQ7Gpk4by9KZFHVH2_sGeeQZSogZFmYjaZM23mhrNcG_5f8rffOv-OexuP978lFow6Az3KaDcKTNgbI62FAD9KCtr22mhCMczN0CwK5NYNVN0-jNgjK2S7Ver94E7vHOoKwzLPzpO0AbFe8NxfbFTn8aRUCjZIYrwP0-hm7SOY3GJAulBJrcbx6ZryJHhXI0xEijltwfR8wNudxf_l9x4FeaoNdfACDgzT6XwQ3o5ekXfRI_cnXjNeJIjzJqNBstNJkXmCS_ht2oE3C-dX9warbLyp8OsWz0mhppIVN14juIA5yg822FltRlsWh2oxN1e8Ph17WbVvvOrU_dGVX94USu0O9Vyj4Rje84OU2fnZVWVU5VkK2dbtryz0XquWsLHCS2uTGPE6588NGh7Bgs91Wdck3RrZowutrwTcxKmuXISRygcJbHmky2NwsA2gLNCL8nfS6XZvlj9Qr9y9ztNyg1WbxphmJ5hAV4XeM3w2axqXNlZsYv4uwl0s2e_cPKmL8LnELjN9d6D02_L8AAAD__zKyAdo">