From 7b31f04bacfdb5420bc953ecdff0591058574f44 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 24 Apr 2020 20:13:17 -0400 Subject: pan/bi: Pack FMA SEL16 Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_pack.c | 16 ++++++++++++++++ src/panfrost/bifrost/bifrost.h | 2 ++ 2 files changed, 18 insertions(+) (limited to 'src/panfrost/bifrost') diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index d2c3aee9b2d..211c9e0fa1a 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -921,6 +921,20 @@ bi_pack_convert(bi_instruction *ins, struct bi_registers *regs, bool FMA) return bi_pack_add_1src(ins, regs, BIFROST_ADD_CONVERT | op); } +static unsigned +bi_pack_fma_select(bi_instruction *ins, struct bi_registers *regs) +{ + unsigned size = nir_alu_type_get_type_size(ins->src_types[0]); + + if (size == 16) { + unsigned swiz = (ins->swizzle[0][0] | (ins->swizzle[1][0] << 1)); + unsigned op = BIFROST_FMA_SEL_16(swiz); + return bi_pack_fma_2src(ins, regs, op); + } else { + unreachable("Unimplemented"); + } +} + static unsigned bi_pack_fma(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs) { @@ -948,7 +962,9 @@ bi_pack_fma(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs) case BI_MOV: return bi_pack_fma_1src(bundle.fma, regs, BIFROST_FMA_OP_MOV); case BI_SHIFT: + return BIFROST_FMA_NOP; case BI_SELECT: + return bi_pack_fma_select(bundle.fma, regs); case BI_ROUND: return BIFROST_FMA_NOP; case BI_REDUCE_FMA: diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index 89344ae062f..a7789a5a7fa 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -99,6 +99,7 @@ enum bifrost_packed_src { #define BIFROST_FMA_OP_MOV BIFROST_FMA_EXT | (0x32d) #define BIFROST_FMA_OP_FREXPE_LOG BIFROST_FMA_EXT | 0x3c5 #define BIFROST_FMA_OP_ADD_FREXPM ((BIFROST_FMA_EXT | 0x1e80) >> 3) +#define BIFROST_FMA_SEL_16(swiz) (((BIFROST_FMA_EXT | 0x1e00) >> 3) | (swiz)) struct bifrost_fma_inst { unsigned src0 : 3; @@ -149,6 +150,7 @@ struct bifrost_add_inst { #define BIFROST_ADD_OP_LD_UBO_2 (0x0c1e0 >> 3) #define BIFROST_ADD_OP_LD_UBO_3 (0x0caa0 >> 3) #define BIFROST_ADD_OP_LD_UBO_4 (0x0c220 >> 3) +#define BIFROST_ADD_SEL_16(swiz) ((0xea60 >> 3) | (swiz)) struct bifrost_add_2src { unsigned src0 : 3; -- cgit v1.2.3