From a68bed798c1e7581c7345a5a0345d97f725dc483 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 22 Jun 2022 15:42:43 -0400 Subject: [PATCH] pan/bi: Implement nir_op_vec8 and nir_op_vec16 These are used with OpenCL, particularly with 8-bit types. Luckily, they are pretty easy to implement with our existing infrastructure. We just need to hit backspace enough times and we're good to go. Fixes a subtest of test_basic hiloeo. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 0c44be3..15a5888 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -2329,29 +2329,21 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr) switch (instr->op) { case nir_op_vec2: case nir_op_vec3: - case nir_op_vec4: { - bi_index unoffset_srcs[4] = { - srcs > 0 ? bi_src_index(&instr->src[0].src) : bi_null(), - srcs > 1 ? bi_src_index(&instr->src[1].src) : bi_null(), - srcs > 2 ? bi_src_index(&instr->src[2].src) : bi_null(), - srcs > 3 ? bi_src_index(&instr->src[3].src) : bi_null(), - }; + case nir_op_vec4: + case nir_op_vec8: + case nir_op_vec16: { + bi_index unoffset_srcs[16] = { bi_null() }; + unsigned channels[16] = { 0 }; - unsigned channels[4] = { - instr->src[0].swizzle[0], - instr->src[1].swizzle[0], - srcs > 2 ? instr->src[2].swizzle[0] : 0, - srcs > 3 ? instr->src[3].swizzle[0] : 0, - }; + for (unsigned i = 0; i < srcs; ++i) { + unoffset_srcs[i] = bi_src_index(&instr->src[i].src); + channels[i] = instr->src[i].swizzle[0]; + } bi_make_vec_to(b, dst, unoffset_srcs, channels, srcs, sz); return; } - case nir_op_vec8: - case nir_op_vec16: - unreachable("should've been lowered"); - case nir_op_unpack_32_2x16: { /* Should have been scalarized */ assert(comps == 2 && sz == 16); -- 2.7.4