From 6069904bbd46592d13a87520dc256c6006b12c50 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 18 Mar 2020 11:02:57 -0400 Subject: [PATCH] pan/bi: Pack fadd32 Choo choo. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_pack.c | 23 +++++++++++++++++++++++ src/panfrost/bifrost/bifrost.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index beddb3f..325bd30 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -295,6 +295,28 @@ bi_pack_fma_fma(bi_instruction *ins, struct bi_registers *regs) } static unsigned +bi_pack_fma_add(bi_instruction *ins, struct bi_registers *regs) +{ + /* TODO: fadd16 packing is a bit different */ + assert(ins->dest_type == nir_type_float32); + + struct bifrost_fma_add pack = { + .src0 = bi_get_fma_src(ins, regs, 0), + .src1 = bi_get_fma_src(ins, regs, 1), + .src0_abs = ins->src_abs[0], + .src1_abs = ins->src_abs[1], + .src0_neg = ins->src_neg[0], + .src1_neg = ins->src_neg[1], + .unk = 0x0, + .outmod = ins->outmod, + .roundmode = ins->roundmode, + .op = BIFROST_FMA_OP_FADD32 + }; + + RETURN_PACKED(pack); +} + +static unsigned bi_pack_fma(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs) { if (!bundle.fma) @@ -302,6 +324,7 @@ bi_pack_fma(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs) switch (bundle.fma->type) { case BI_ADD: + return bi_pack_fma_add(bundle.fma, regs); case BI_CMP: case BI_BITWISE: case BI_CONVERT: diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index ba08633..292c35d 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -134,6 +134,8 @@ enum bifrost_minmax_mode { BIFROST_SRC0_WINS = 0x3, }; +#define BIFROST_FMA_OP_FADD32 (0x58 >> 2) + struct bifrost_fma_add { unsigned src0 : 3; unsigned src1 : 3; -- 2.7.4