pan/bi: Always use SWZ.v4i8 in bi_lower_swizzle()

Now that we lower it, there's no advantage to one over the other at the
time this pass runs.  Also, the is_8bit check was technically wrong
since it checks destination sizes, not source sizes.  It's a lot safer
to just use SWZ.v4i8 and let the lowering pass do the right thing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40720>
This commit is contained in:
Faith Ekstrand 2026-04-06 17:14:38 -04:00 committed by Marge Bot
parent bc7053a976
commit ed83d46d4e
2 changed files with 2 additions and 6 deletions

View file

@ -148,15 +148,11 @@ lower_swizzle(bi_context *ctx, bi_instr *ins, unsigned src)
/* Lower it away */
bi_builder b = bi_init_builder(ctx, bi_before_instr(ins));
bool is_8 = (bi_get_opcode_props(ins)->size == BI_SIZE_8) ||
(bi_get_opcode_props(ins)->size == BI_SIZE_32 &&
ins->src[src].swizzle >= BI_SWIZZLE_B0000);
bi_index orig = ins->src[src];
bi_index stripped = bi_replace_index(bi_null(), orig);
stripped.swizzle = ins->src[src].swizzle;
bi_index swz = is_8 ? bi_swz_v4i8(&b, stripped) : bi_swz_v2i16(&b, stripped);
bi_index swz = bi_swz_v4i8(&b, stripped);
bi_replace_src(ins, src, swz);
ins->src[src].swizzle = BI_SWIZZLE_H01;

View file

@ -43,7 +43,7 @@ class LowerSwizzle : public testing::Test {
TEST_F(LowerSwizzle, Csel16)
{
CASE(bi_csel_v2f16_to(b, reg, bi_half(x, 0), y, z, w, BI_CMPF_NE),
bi_csel_v2f16_to(b, reg, bi_swz_v2i16(b, bi_half(x, 0)), y, z, w,
bi_csel_v2f16_to(b, reg, bi_swz_v4i8(b, bi_half(x, 0)), y, z, w,
BI_CMPF_NE));
}