diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-24 20:13:17 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-27 14:52:26 +0000 |
commit | 7b31f04bacfdb5420bc953ecdff0591058574f44 (patch) | |
tree | 62752aa3c02cdd1dbbf20bd97a9f8bd4120a808f /src/panfrost/bifrost | |
parent | ee561f0e6b8be3adeac4306234d7ff5027078e5c (diff) |
pan/bi: Pack FMA SEL16
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4766>
Diffstat (limited to 'src/panfrost/bifrost')
-rw-r--r-- | src/panfrost/bifrost/bi_pack.c | 16 | ||||
-rw-r--r-- | src/panfrost/bifrost/bifrost.h | 2 |
2 files changed, 18 insertions, 0 deletions
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 @@ -922,6 +922,20 @@ bi_pack_convert(bi_instruction *ins, struct bi_registers *regs, bool FMA) } 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) { if (!bundle.fma) @@ -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; |