diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-06 13:48:26 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-06 19:41:56 +0000 |
commit | 822f127fe5b60887f90d8561559d979748049961 (patch) | |
tree | 7aba7e82521568f41f4505b0602452b600664e98 /src/panfrost | |
parent | 36e4c6b267bf1083efd3417beb333e43d28062d7 (diff) |
pan/bi: Add ADD add/min/max fp32 packing
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4470>
Diffstat (limited to 'src/panfrost')
-rw-r--r-- | src/panfrost/bifrost/bi_pack.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index 648e6932915..99a0077d1ae 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -882,6 +882,41 @@ bi_pack_add_2src(bi_instruction *ins, struct bi_registers *regs, unsigned op) } static unsigned +bi_pack_add_addmin_f32(bi_instruction *ins, struct bi_registers *regs) +{ + unsigned op = + (ins->type == BI_ADD) ? BIFROST_ADD_OP_FADD32 : + (ins->op.minmax == BI_MINMAX_MIN) ? BIFROST_ADD_OP_FMIN32 : + BIFROST_ADD_OP_FMAX32; + + struct bifrost_add_faddmin pack = { + .src0 = bi_get_src(ins, regs, 0, true), + .src1 = bi_get_src(ins, regs, 1, true), + .src0_abs = ins->src_abs[0], + .src1_abs = ins->src_abs[1], + .src0_neg = ins->src_neg[0], + .src1_neg = ins->src_neg[1], + .outmod = ins->outmod, + .mode = (ins->type == BI_ADD) ? ins->roundmode : ins->minmax, + .op = op + }; + + RETURN_PACKED(pack); +} + +static unsigned +bi_pack_add_addmin(bi_instruction *ins, struct bi_registers *regs) +{ + if (ins->dest_type == nir_type_float32) + return bi_pack_add_addmin_f32(ins, regs); + else if(ins->dest_type == nir_type_float16) + unreachable("todo"); + //return bi_pack_add_addmin_f16(ins, regs); + else + unreachable("Unknown FMA/ADD type"); +} + +static unsigned bi_pack_add_ld_ubo(bi_clause *clause, bi_instruction *ins, struct bi_registers *regs) { unsigned components = bi_load32_components(ins); @@ -1046,6 +1081,7 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs) case BI_LOAD_VAR_ADDRESS: return bi_pack_add_ld_var_addr(clause, bundle.add, regs); case BI_MINMAX: + return bi_pack_add_addmin(bundle.add, regs); case BI_MOV: case BI_SHIFT: case BI_STORE: |