pan/bi: Pack FMA SEL16

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4766>
This commit is contained in:
Alyssa Rosenzweig
2020-04-24 20:13:17 -04:00
committed by Marge Bot
parent ee561f0e6b
commit 7b31f04bac
2 changed files with 18 additions and 0 deletions

View File

@@ -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:

View File

@@ -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;