pan/bi: use only 1 MKVEC.v2i8 to generate v4i8 when possible

When making a vector of 4 elements, try to make it with only 1
instruction instead of 2 at the moment, if the last 2 elements respect
the pattern supported by MKVEC.v2i8

Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35643>
This commit is contained in:
Romaric Jodin
2025-07-04 14:59:23 +02:00
committed by Marge Bot
parent 8b96f66da6
commit 857f29d67b
+11 -2
View File
@@ -761,8 +761,17 @@ bi_make_vec8_helper(bi_builder *b, bi_index *src, unsigned *channel,
if (b->shader->arch >= 9) {
bi_index vec = bi_zero();
if (count >= 3)
vec = bi_mkvec_v2i8(b, bytes[2], bytes[3], vec);
if (count >= 3) {
if ((count == 3 && bytes[2].swizzle == BI_SWIZZLE_B0) ||
(count == 4 && bi_is_word_equiv(bytes[2], bytes[3]) &&
bytes[2].swizzle == BI_SWIZZLE_B0 &&
bytes[3].swizzle == BI_SWIZZLE_B1)) {
vec = bytes[2];
vec.swizzle = BI_SWIZZLE_B0123;
} else {
vec = bi_mkvec_v2i8(b, bytes[2], bytes[3], vec);
}
}
return bi_mkvec_v2i8(b, bytes[0], bytes[1], vec);
} else {