From 9924e6f291496e1c53a1691bc371c99b0f49964b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 18 May 2022 12:44:38 -0400 Subject: [PATCH] pan/bi: Fix mov and pack_32_2x16 Move can take in a vector and write a scalar, depending on the swizzle. We need to handle this case. Split out mov and pack_32_2x16 so we can specify correct behaviour for both. Also drop unused 1-bit boolean stuff which obscured the fix. Fixes: 76cea8e27b3 ("panfrost: Fix pack_32_2x16 implementation") Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index e338c5e7185..abf0b834f7b 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -2157,10 +2157,7 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr) return; } - case nir_op_mov: - case nir_op_pack_32_2x16: { - unsigned src_comps = nir_src_num_components(instr->src[0].src); - + case nir_op_mov: { bi_index idx = bi_src_index(&instr->src[0].src); bi_index unoffset_srcs[4] = { idx, idx, idx, idx }; @@ -2171,8 +2168,23 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr) comps > 3 ? instr->src[0].swizzle[3] : 0, }; - if (src_sz == 1) src_sz = 16; - bi_make_vec_to(b, dst, unoffset_srcs, channels, src_comps, src_sz); + bi_make_vec_to(b, dst, unoffset_srcs, channels, comps, src_sz); + return; + } + + case nir_op_pack_32_2x16: { + assert(nir_src_num_components(instr->src[0].src) == 2); + assert(comps == 1); + + bi_index idx = bi_src_index(&instr->src[0].src); + bi_index unoffset_srcs[4] = { idx, idx, idx, idx }; + + unsigned channels[2] = { + instr->src[0].swizzle[0], + instr->src[0].swizzle[1] + }; + + bi_make_vec_to(b, dst, unoffset_srcs, channels, 2, 16); return; }