[llvm] [AMDGPU] Fix an issue that wrong index is used in calculation of byte provider when the op is extract_vector_elt (PR #91697)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 14:50:49 PDT 2024


shiltian wrote:

> > It didn't cause a crash. It causes wrong results in just one OpenCL conformance test. That is because wrong register is used in `v_perm_b32` instruction.
> 
> Ah, I see the issue. Thanks.
> 
> It is because the current index calculation condition assumes less than 32 bit.
> 
> Can you try
> 
> ```
>     if (ScalarSize < 32) {
>       Index = ScalarSize == 8 ? VecIdx : VecIdx * 2 + Index;
>     }
> 
>     return calculateSrcByte(ScalarSize >= 32 ? Op : Op.getOperand(0),
>                             StartingIndex, Index);
> ```

It works. Why do we want to differentiate them here?

https://github.com/llvm/llvm-project/pull/91697


More information about the llvm-commits mailing list