From 578f5d00000d864e2c19cf451a438444dd763505 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 13 Apr 2021 20:21:03 -0400 Subject: [PATCH] pan/bi: Track scalarness of 16-bit ALU Needed for optimal swizzle lowering. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 4 ++++ src/panfrost/bifrost/compiler.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index dee0dd16572..399cbf534fe 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -1532,6 +1532,10 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr) unsigned comps = nir_dest_num_components(instr->dest.dest); unsigned src_sz = srcs > 0 ? nir_src_bit_size(instr->src[0].src) : 0; + /* Indicate scalarness */ + if ((sz == 1 || sz == 16) && comps == 1) + dst.swizzle = BI_SWIZZLE_H00; + if (!instr->dest.dest.is_ssa) { for (unsigned i = 0; i < comps; ++i) assert(instr->dest.write_mask); diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 6627d26070c..1c1ee1ab2b0 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -83,6 +83,9 @@ typedef struct { bool abs : 1; bool neg : 1; + /* For a source, the swizzle. For a destination, acts a bit like a + * write mask. Identity for the full 32-bit, H00 for only caring about + * the lower half, other values unused. */ enum bi_swizzle swizzle : 4; uint32_t offset : 2; bool reg : 1;