diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-17 15:21:08 -0400 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2020-04-17 16:25:35 -0400 |
commit | f87403c4c134454d991c1962b746a257f5f11d00 (patch) | |
tree | 7c493a3dda0e68f9aae1d9946df014e9360c5606 | |
parent | 7e76c2b806dcef8254f0039ce27d916ca6dc2bf5 (diff) |
pan/bi: Pack ADD.v2f16
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4615>
-rw-r--r-- | src/panfrost/bifrost/bi_pack.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index f135cab5c02..84018551d24 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -1009,14 +1009,39 @@ bi_pack_add_addmin_f32(bi_instruction *ins, struct bi_registers *regs) } static unsigned +bi_pack_add_add_f16(bi_instruction *ins, struct bi_registers *regs) +{ + /* ADD.v2f16 can't have outmod */ + assert(ins->outmod == BIFROST_NONE); + + 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], + .select = bi_swiz16(ins, 0), /* swizzle_0 */ + .outmod = bi_swiz16(ins, 1), /* swizzle_1 */ + .mode = ins->roundmode, + .op = BIFROST_ADD_OP_FADD16 + }; + + 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 + else if (ins->dest_type == nir_type_float16) { + if (ins->type == BI_ADD) + return bi_pack_add_add_f16(ins, regs); + else + unreachable("TODO"); + //return bi_pack_add_min_f16(ins, regs); + } else unreachable("Unknown FMA/ADD type"); } |