From 9bd7570e96f21e8d6e3c441d699dd64406574830 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 23 Jun 2022 09:58:59 -0400 Subject: [PATCH] pan/bi: Fix unpack_32_2x16 definition This got messed up when scalarizing the IR. Fix the definition of the opcode to return (instead of break, asserting out) and to respect the swizzle (instead of failing validation). Noticed when bringing up OpenCL on Valhall. Fixes: 5febeae58e0 ("pan/bi: Emit collect and split") Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index bacd9e14242..b375d924099 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -2318,9 +2318,16 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr) case nir_op_vec16: unreachable("should've been lowered"); - case nir_op_unpack_32_2x16: - bi_mov_i32_to(b, dst, bi_src_index(&instr->src[0].src)); - break; + case nir_op_unpack_32_2x16: { + /* Should have been scalarized */ + assert(comps == 2 && sz == 16); + + bi_index vec = bi_src_index(&instr->src[0].src); + unsigned chan = instr->src[0].swizzle[0]; + + bi_mov_i32_to(b, dst, bi_extract(b, vec, chan)); + return; + } case nir_op_unpack_64_2x32_split_x: bi_mov_i32_to(b, dst, bi_extract(b, bi_src_index(&instr->src[0].src), 0));