pan/bi: Fix MKVEC.v2i8 src2 swizzle lowering

`MKVEC.v2i8` only has explicit lane selection for `src0` and `src1`.
`src` is implicitly read as `.b01`, so having a byte swizzle on `src2`
results in an instruction that cannot be encoded.

This fixes a failure in OpenCL-CTS when running `test_relationals
shuffle_copy`:
```
Invalid swizzle:
r0 = MKVEC.v2i8 r0^.b0, r0^.b3, r0^.b0

invalid_instruction: Assertion `!"Invalid instruction"' failed.
```

Fixes: bc7053a ("pan/bi: Add a lowering pass for MKVEC and SWZ")

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41109>
This commit is contained in:
Ahmed Hesham 2026-05-23 20:02:43 +00:00 committed by Marge Bot
parent 70329cf51f
commit b1c40839f2

View file

@ -190,8 +190,13 @@ build_mkvec_v4i8_to(bi_builder *b, bi_index dst, const bi_index src[4])
if (bi_is_zero(src[2]) && bi_is_zero(src[3]))
return bi_mkvec_v2i8_to(b, dst, src[0], src[1], bi_zero());
if (bi_is_word_equiv(src[2], src[3]) && bytes[2] == 0 && bytes[3] == 1)
return bi_mkvec_v2i8_to(b, dst, src[0], src[1], src[2]);
if (bi_is_word_equiv(src[2], src[3]) && bytes[2] == 0 && bytes[3] == 1) {
/* src2 is implicitly read as .b01 by MKVEC.v2i8. */
bi_index src2 = src[2];
src2.swizzle = BI_SWIZZLE_H01;
return bi_mkvec_v2i8_to(b, dst, src[0], src[1], src2);
}
bi_index acc = bi_mkvec_v2i8(b, src[2], src[3], bi_zero());
return bi_mkvec_v2i8_to(b, dst, src[0], src[1], acc);