diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-06 10:15:34 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-06 19:41:56 +0000 |
commit | d7bb7b79a8b0a86ee3fbd21fffa8e3d0c8dd03a2 (patch) | |
tree | 1ea4626fea180802647720635b992b669dfafb2a /src | |
parent | a6ae2d8f940df3d9e0b71b13336ca01e5b6a2c47 (diff) |
pan/bi: Add 32-bit _FAST packing
For frcp/frsq on newer Bifrost.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4470>
Diffstat (limited to 'src')
-rw-r--r-- | src/panfrost/bifrost/bi_pack.c | 26 | ||||
-rw-r--r-- | src/panfrost/bifrost/bifrost.h | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index ea68aa41b37..c6439c39e0c 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -634,6 +634,17 @@ bi_pack_fma_1src(bi_instruction *ins, struct bi_registers *regs, unsigned op) RETURN_PACKED(pack); } +static unsigned +bi_pack_add_1src(bi_instruction *ins, struct bi_registers *regs, unsigned op) +{ + struct bifrost_add_inst pack = { + .src0 = bi_get_src(ins, regs, 0, true), + .op = op + }; + + RETURN_PACKED(pack); +} + static enum bifrost_csel_cond bi_cond_to_csel(enum bi_cond cond, bool *flip, bool *invert, nir_alu_type T) { @@ -975,6 +986,20 @@ bi_pack_add_blend(bi_instruction *ins, struct bi_registers *regs) } static unsigned +bi_pack_add_special(bi_instruction *ins, struct bi_registers *regs) +{ + unsigned op = 0; + + if (ins->op.special == BI_SPECIAL_FRCP) { + op = BIFROST_ADD_OP_FRCP_FAST_F32; + } else { + op = BIFROST_ADD_OP_FRSQ_FAST_F32; + } + + return bi_pack_add_1src(ins, regs, op); +} + +static unsigned bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs) { if (!bundle.add) @@ -1013,6 +1038,7 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs) case BI_STORE_VAR: return bi_pack_add_st_vary(clause, bundle.add, regs); case BI_SPECIAL: + return bi_pack_add_special(bundle.add, regs); case BI_SWIZZLE: case BI_TEX: case BI_ROUND: diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index 4dc3c741b38..31ea14db63c 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -110,6 +110,8 @@ struct bifrost_fma_2src { } __attribute__((packed)); #define BIFROST_ADD_OP_BLEND (0x1952c) +#define BIFROST_ADD_OP_FRCP_FAST_F32 (0x0cc00) +#define BIFROST_ADD_OP_FRSQ_FAST_F32 (0x0cc20) struct bifrost_add_inst { unsigned src0 : 3; |