Mesa (master): pan/bi: Add support for ishr
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Nov 9 19:50:31 UTC 2020
Module: Mesa
Branch: master
Commit: af70987b36364c5c6447d7bf66dc06b8e31886ff
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=af70987b36364c5c6447d7bf66dc06b8e31886ff
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Fri Nov 6 11:51:48 2020 +0100
pan/bi: Add support for ishr
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
---
src/panfrost/bifrost/bi_pack.c | 4 ++++
src/panfrost/bifrost/bifrost_compile.c | 9 +++++++++
src/panfrost/bifrost/compiler.h | 3 ++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index 47ee8c802c4..79f03cacb61 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -426,6 +426,7 @@ BI_PACK_SHIFT(rshift_or)
BI_PACK_SHIFT(lshift_or)
BI_PACK_SHIFT(rshift_xor)
BI_PACK_SHIFT(lshift_xor)
+BI_PACK_SHIFT(arshift)
static unsigned
bi_pack_fma_bitwise(bi_clause *clause, bi_instruction *ins, bi_registers *regs)
@@ -443,6 +444,9 @@ bi_pack_fma_bitwise(bi_clause *clause, bi_instruction *ins, bi_registers *regs)
return ins->bitwise.rshift ?
bi_pack_fma_rshift_xor(clause, ins, regs) :
bi_pack_fma_lshift_xor(clause, ins, regs);
+ case BI_BITWISE_ARSHIFT:
+ assert(ins->bitwise.rshift);
+ return bi_pack_fma_arshift(clause, ins, regs);
default:
unreachable("Invalid bitwise op");
}
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 116bd1d08e0..9fbd5956e3e 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -896,6 +896,7 @@ bi_class_for_nir_alu(nir_op op)
case nir_op_ixor:
case nir_op_inot:
case nir_op_ishl:
+ case nir_op_ishr:
return BI_BITWISE;
BI_CASE_CMP(nir_op_flt)
@@ -1210,6 +1211,14 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
alu.src_types[2] = nir_type_uint8;
alu.src[1] = BIR_INDEX_ZERO;
break;
+ case nir_op_ishr:
+ alu.op.bitwise = BI_BITWISE_ARSHIFT;
+ alu.bitwise.rshift = true;
+ /* move src1 to src2 and replace with zero. underlying op is (src0 >> src2) */
+ alu.src[2] = alu.src[1];
+ alu.src_types[2] = nir_type_uint8;
+ alu.src[1] = BIR_INDEX_ZERO;
+ break;
case nir_op_imul:
alu.op.imul = BI_IMUL_IMUL;
break;
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 11689c4a797..7a581c4802f 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -193,7 +193,8 @@ enum bi_minmax_op {
enum bi_bitwise_op {
BI_BITWISE_AND,
BI_BITWISE_OR,
- BI_BITWISE_XOR
+ BI_BITWISE_XOR,
+ BI_BITWISE_ARSHIFT,
};
enum bi_imath_op {
More information about the mesa-commit
mailing list