From 551d990a7c85d2b3cba567b00e6f2aceef6e2e87 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 13 May 2020 16:17:46 -0400 Subject: [PATCH] pan/mdg: Handle un/pack opcodes as moves Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/midgard_compile.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index a98e2b32805..68af4859da2 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -909,6 +909,14 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr) break; } + case nir_op_unpack_32_2x16: + case nir_op_unpack_32_4x8: + case nir_op_pack_32_2x16: + case nir_op_pack_32_4x8: { + op = midgard_alu_op_imov; + break; + } + default: DBG("Unhandled ALU op %s\n", nir_op_infos[instr->op].name); assert(0); @@ -1076,6 +1084,18 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr) for (unsigned c = 0; c < 16; ++c) ins.swizzle[1][c] = 0; + } else if (instr->op == nir_op_pack_32_2x16) { + ins.dest_type = nir_type_uint16; + ins.mask = mask_of(nr_components * 2); + } else if (instr->op == nir_op_pack_32_4x8) { + ins.dest_type = nir_type_uint8; + ins.mask = mask_of(nr_components * 4); + } else if (instr->op == nir_op_unpack_32_2x16) { + ins.dest_type = nir_type_uint32; + ins.mask = mask_of(nr_components >> 1); + } else if (instr->op == nir_op_unpack_32_4x8) { + ins.dest_type = nir_type_uint32; + ins.mask = mask_of(nr_components >> 2); } /* Arrange for creation of iandnot/iornot */ -- 2.30.2