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

    <tr>
        <th>Summary</th>
        <td>
            [RISCV] What index should we use for vrgather.vv for shufflevector with undef index.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:RISC-V
      </td>
    </tr>

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

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

<pre>
    If we receive a vector shuffle with undef indices, we need to pick an index for the vrgather. Ideally for each DLEN of the destination we want the elements to come from as few DLENs of the source vector as possible.

Without -mrvv-vector-bits we don't know where the DLEN boundaries are so won't know what elements to consider.

If the index type is large enough, we could use a value like -1U if it is larger than the worst case VLMAX. According to the vector specification, indices larger than VLMAX should return 0 rather than element from the source.

CC: @preames @frasercrmck @lukel97 @rofirrim 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcU02PozgQ_TXmUgoCky8OHLLJRorUu4ddTfdcjV2AJ8ZG_oDufz-yQ3crcwGbqnr1qh6POSd7jdiQ3V9kd8lY8IOxjTfThJZnrREfza2DBcEiRzkjMJiRe2PBDaHrFMIi_QBBC-xAaiE5OkLPsUIjCvAGJsnvwHSM4jt0xoIfEGbbMz-gzeEmkCn1kSLI-ACXl7__BdOlNIHOS828NDpiLkz79B0Vjqi9iw24GRE6a0ZgDjpcEoD7RHAmWI6frJmDyTgnW4U5KS6kOD2eb9IPJnjYjHaeN4_kTSu9i12F0YQePNy1WWAZ0GJCTjxbE7RgVqIDZmM3WJ6zmf-DrHZSoH3qfntQfWzIf0wI0oFitkdAbUI_rCvlJigBwSUZmAoISt4RNuUPkB1I_1UWd8x0Al2MdR44cwivL_-cfuZw4txYIXUf-SQtVkUn5LKTPG07dlz1fIJMGOCGxMSiD1ZDATZp-chYp30o8q3A08DnM6lOQLbFZJGN6OKxs8yh5Xbk93hV4Y6qPsSjNZ20Vo6QiaYSdVWzDJvyUOyLqt6Wx2xo-GFf7-ixZKJrW1bRXU3F9ljQWmBV1kWVyYYWdFuUtCrrXVEec8FFVVHK9oLXnHaMbAscmVS5UvOYG9tn0rmAzaEu632mWIvKJZdQ2jJ-Ry1Idfrv9v9580oojd6xTSzdtKF3kb503n2DeelVclkseSW7C7zFP-Oh-LrNBZO00Qdf7pjndF_Ntgr1bDl8z7NgVTN4PzlSnQi9EnrtpR9Cm3MzEnqNNNbXZrLmF3JP6DUN6Ai9phl_BwAA__82bl2N">