diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-06 10:36:10 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-06 19:41:56 +0000 |
commit | c37c799284d59b445c110d7b5ca4b1ee6fa64492 (patch) | |
tree | 4b64e2d188c46c3f981314cba4c7731d7519bb68 /src/panfrost | |
parent | d7bb7b79a8b0a86ee3fbd21fffa8e3d0c8dd03a2 (diff) |
pan/bi: Add fp16 support for frcp/frsq
More ops.
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 | 13 | ||||
-rw-r--r-- | src/panfrost/bifrost/bifrost.h | 4 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index c6439c39e0c..81f149cf562 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -989,11 +989,20 @@ static unsigned bi_pack_add_special(bi_instruction *ins, struct bi_registers *regs) { unsigned op = 0; + bool fp16 = ins->dest_type == nir_type_float16; + bool Y = ins->swizzle[0][0]; if (ins->op.special == BI_SPECIAL_FRCP) { - op = BIFROST_ADD_OP_FRCP_FAST_F32; + op = fp16 ? + (Y ? BIFROST_ADD_OP_FRCP_FAST_F16_Y : + BIFROST_ADD_OP_FRCP_FAST_F16_X) : + BIFROST_ADD_OP_FRCP_FAST_F32; } else { - op = BIFROST_ADD_OP_FRSQ_FAST_F32; + op = fp16 ? + (Y ? BIFROST_ADD_OP_FRSQ_FAST_F16_Y : + BIFROST_ADD_OP_FRSQ_FAST_F16_X) : + BIFROST_ADD_OP_FRSQ_FAST_F32; + } return bi_pack_add_1src(ins, regs, op); diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index 31ea14db63c..602788a7225 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -111,7 +111,11 @@ struct bifrost_fma_2src { #define BIFROST_ADD_OP_BLEND (0x1952c) #define BIFROST_ADD_OP_FRCP_FAST_F32 (0x0cc00) +#define BIFROST_ADD_OP_FRCP_FAST_F16_X (0x0ce10) +#define BIFROST_ADD_OP_FRCP_FAST_F16_Y (0x0ce30) #define BIFROST_ADD_OP_FRSQ_FAST_F32 (0x0cc20) +#define BIFROST_ADD_OP_FRSQ_FAST_F16_X (0x0ce50) +#define BIFROST_ADD_OP_FRSQ_FAST_F16_Y (0x0ce70) struct bifrost_add_inst { unsigned src0 : 3; |