aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-18 11:02:57 -0400
committerMarge Bot <[email protected]>2020-03-19 03:23:07 +0000
commit6069904bbd46592d13a87520dc256c6006b12c50 (patch)
tree73a06a6f780968d5d4496415372fe33e41a96496 /src
parentf2afcc6101047b8cfcd5fac3f144e1f3325e6207 (diff)
pan/bi: Pack fadd32
Choo choo. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4242>
Diffstat (limited to 'src')
-rw-r--r--src/panfrost/bifrost/bi_pack.c23
-rw-r--r--src/panfrost/bifrost/bifrost.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index beddb3f4314..325bd30a83a 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 ba08633f8f9..292c35db11d 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;