From db5c1ae8fd17f3113a88029ea90d23f10df293ed Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 14 Apr 2020 16:59:19 -0400 Subject: [PATCH] pan/bi: Add fexp2_fast packing Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_pack.c | 7 ++++++- src/panfrost/bifrost/bifrost.h | 1 + src/panfrost/bifrost/disassemble.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index e530862a7cc..09fefd810ad 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -1140,12 +1140,17 @@ bi_pack_add_special(bi_instruction *ins, struct bi_registers *regs) (Y ? BIFROST_ADD_OP_FRCP_FAST_F16_Y : BIFROST_ADD_OP_FRCP_FAST_F16_X) : BIFROST_ADD_OP_FRCP_FAST_F32; - } else { + } else if (ins->op.special == BI_SPECIAL_FRSQ) { op = fp16 ? (Y ? BIFROST_ADD_OP_FRSQ_FAST_F16_Y : BIFROST_ADD_OP_FRSQ_FAST_F16_X) : BIFROST_ADD_OP_FRSQ_FAST_F32; + } else if (ins->op.special == BI_SPECIAL_EXP2_LOW) { + assert(!fp16); + op = BIFROST_ADD_OP_FEXP2_FAST; + } else { + unreachable("Unknown special op"); } return bi_pack_add_1src(ins, regs, op); diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index e3f822c321e..1c47dab9fc4 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -138,6 +138,7 @@ struct bifrost_fma_mscale { #define BIFROST_ADD_OP_FRSQ_FAST_F16_X (0x0ce50) #define BIFROST_ADD_OP_FRSQ_FAST_F16_Y (0x0ce70) #define BIFROST_ADD_OP_LOG2_HELP (0x0cc68) +#define BIFROST_ADD_OP_FEXP2_FAST (0x0cd58) struct bifrost_add_inst { unsigned src0 : 3; diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c index 3babcf621de..9ff4ab77f7a 100644 --- a/src/panfrost/bifrost/disassemble.c +++ b/src/panfrost/bifrost/disassemble.c @@ -1041,6 +1041,7 @@ static const struct add_op_info add_op_infos[] = { { 0x0cc00, "FRCP_FAST.f32", ADD_ONE_SRC }, { 0x0cc20, "FRSQ_FAST.f32", ADD_ONE_SRC }, { 0x0cc68, "FLOG2_U.f32", ADD_ONE_SRC }, + { 0x0cd58, "FEXP2_FAST.f32", ADD_ONE_SRC }, { 0x0ce00, "FRCP_TABLE", ADD_ONE_SRC }, { 0x0ce10, "FRCP_FAST.f16.X", ADD_ONE_SRC }, { 0x0ce20, "FRSQ_TABLE", ADD_ONE_SRC }, -- 2.30.2