diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-14 16:44:44 -0400 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2020-04-17 16:25:35 -0400 |
commit | c3eebfeb11cd57998134c0bb903c2447296f43c7 (patch) | |
tree | 38a9631b1dfa6784d6d2fd9596509324d73538c2 /src/panfrost | |
parent | 0cb703984e68c426a173df1e0c951591dca17fb8 (diff) |
pan/bi: Pack FMA_MSCALE
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4615>
Diffstat (limited to 'src/panfrost')
-rw-r--r-- | src/panfrost/bifrost/bi_pack.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index 1b968942cd1..e530862a7cc 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -490,7 +490,29 @@ bi_pack_fma_fma(bi_instruction *ins, struct bi_registers *regs) /* (-a)(-b) = ab, so we only need one negate bit */ bool negate_mul = ins->src_neg[0] ^ ins->src_neg[1]; - if (ins->dest_type == nir_type_float32) { + if (ins->op.mscale) { + assert(!(ins->src_abs[0] && ins->src_abs[1])); + assert(!ins->src_abs[2] || !ins->src_neg[3] || !ins->src_abs[3]); + + /* We can have exactly one abs, and can flip the multiplication + * to make it fit if we have to */ + bool flip_ab = ins->src_abs[1]; + + struct bifrost_fma_mscale pack = { + .src0 = bi_get_src(ins, regs, flip_ab ? 1 : 0, true), + .src1 = bi_get_src(ins, regs, flip_ab ? 0 : 1, true), + .src2 = bi_get_src(ins, regs, 2, true), + .src3 = bi_get_src(ins, regs, 3, true), + .mscale_mode = 0, + .mode = ins->outmod, + .src0_abs = ins->src_abs[0] || ins->src_abs[1], + .src1_neg = negate_mul, + .src2_neg = ins->src_neg[2], + .op = BIFROST_FMA_OP_MSCALE, + }; + + RETURN_PACKED(pack); + } else if (ins->dest_type == nir_type_float32) { struct bifrost_fma_fma pack = { .src0 = bi_get_src(ins, regs, 0, true), .src1 = bi_get_src(ins, regs, 1, true), |