Mesa (master): bifrost: Add support for nir_op_iabs
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jul 28 15:52:54 UTC 2020
Module: Mesa
Branch: master
Commit: 1882b1e5a7d26c5ecd3168224726efa42e2306c3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1882b1e5a7d26c5ecd3168224726efa42e2306c3
Author: Chris Forbes <chrisforbes at google.com>
Date: Mon Jul 27 11:51:31 2020 -0700
bifrost: Add support for nir_op_iabs
Signed-off-by: Chris Forbes <chrisforbes at google.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6098>
---
src/panfrost/bifrost/bi_pack.c | 3 +++
src/panfrost/bifrost/bifrost.h | 1 +
src/panfrost/bifrost/bifrost_compile.c | 4 ++++
src/panfrost/bifrost/compiler.h | 1 +
src/panfrost/bifrost/disassemble.c | 1 +
5 files changed, 10 insertions(+)
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index b7ae1132793..5fb8213d0a7 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -1434,6 +1434,9 @@ bi_pack_add_special(bi_instruction *ins, bi_registers *regs)
} else if (ins->op.special == BI_SPECIAL_EXP2_LOW) {
assert(!fp16);
op = BIFROST_ADD_OP_FEXP2_FAST;
+ } else if (ins->op.special == BI_SPECIAL_IABS) {
+ assert(ins->src_types[0] == nir_type_int32);
+ op = BIFROST_ADD_OP_IABS_32;
} else {
unreachable("Unknown special op");
}
diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h
index a41076bcea3..085b3296f2a 100644
--- a/src/panfrost/bifrost/bifrost.h
+++ b/src/panfrost/bifrost/bifrost.h
@@ -164,6 +164,7 @@ struct bifrost_fma_mscale {
#define BIFROST_ADD_OP_FRSQ_FAST_F16_Y (0x0ce70)
#define BIFROST_ADD_OP_LOG2_HELP (0x0cc68)
#define BIFROST_ADD_OP_FEXP2_FAST (0x0cd58)
+#define BIFROST_ADD_OP_IABS_32 (0x07bd4)
struct bifrost_add_inst {
unsigned src0 : 3;
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 2419a4fbcf5..ed8741ddb5a 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -600,6 +600,7 @@ bi_class_for_nir_alu(nir_op op)
case nir_op_frcp:
case nir_op_frsq:
+ case nir_op_iabs:
return BI_SPECIAL;
default:
@@ -808,6 +809,9 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
case nir_op_isub:
alu.op.imath = BI_IMATH_SUB;
break;
+ case nir_op_iabs:
+ alu.op.special = BI_SPECIAL_IABS;
+ break;
case nir_op_inot:
/* no dedicated bitwise not, but we can invert sources. convert to ~a | 0 */
alu.op.bitwise = BI_BITWISE_OR;
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 4c77ac5edf9..32361cc37e1 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -204,6 +204,7 @@ enum bi_special_op {
* exp2() in GL. In the first argument, it takes f2i_rte(x * 2^24). In
* the second, it takes x itself. */
BI_SPECIAL_EXP2_LOW,
+ BI_SPECIAL_IABS,
};
enum bi_tex_op {
diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c
index 92fbf20a17f..93afbee3896 100644
--- a/src/panfrost/bifrost/disassemble.c
+++ b/src/panfrost/bifrost/disassemble.c
@@ -1013,6 +1013,7 @@ static const struct add_op_info add_op_infos[] = {
{ 0x07ba5, "FSQRT_FREXPE", ADD_ONE_SRC },
{ 0x07bad, "FRSQ_FREXPE", ADD_ONE_SRC },
{ 0x07bc5, "FLOG_FREXPE", ADD_ONE_SRC },
+ { 0x07bd4, "IABS.i32", ADD_ONE_SRC },
{ 0x07d42, "CEIL.v2f16", ADD_ONE_SRC },
{ 0x07d45, "CEIL.f32", ADD_ONE_SRC },
{ 0x07d82, "FLOOR.v2f16", ADD_ONE_SRC },
More information about the mesa-commit
mailing list