From b1c40839f2fc316ec8035c57ce5fdbf5162e924c Mon Sep 17 00:00:00 2001 From: Ahmed Hesham Date: Sat, 23 May 2026 20:02:43 +0000 Subject: [PATCH] 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 Reviewed-by: Lorenzo Rossi Part-of: --- src/panfrost/compiler/bifrost/bi_lower_mkvec_swz.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/panfrost/compiler/bifrost/bi_lower_mkvec_swz.c b/src/panfrost/compiler/bifrost/bi_lower_mkvec_swz.c index 5bdc4fc58fb..b0d764a75f9 100644 --- a/src/panfrost/compiler/bifrost/bi_lower_mkvec_swz.c +++ b/src/panfrost/compiler/bifrost/bi_lower_mkvec_swz.c @@ -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);