Mesa (master): lima/ppir: Add fneg op
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 24 14:58:36 UTC 2019
Module: Mesa
Branch: master
Commit: f1d89bbc2fdb9952471e8e726453526fcf68d835
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1d89bbc2fdb9952471e8e726453526fcf68d835
Author: Andreas Baierl <ichgeh at imkreisrum.de>
Date: Fri Jun 21 10:54:04 2019 +0200
lima/ppir: Add fneg op
Signed-off-by: Andreas Baierl <ichgeh at imkreisrum.de>
Reviewed-by: Qiang Yu <yuq825 at gmail.com>
---
src/gallium/drivers/lima/ir/pp/lower.c | 14 ++++++++++++++
src/gallium/drivers/lima/ir/pp/nir.c | 1 +
src/gallium/drivers/lima/ir/pp/node.c | 3 +++
src/gallium/drivers/lima/ir/pp/ppir.h | 1 +
4 files changed, 19 insertions(+)
diff --git a/src/gallium/drivers/lima/ir/pp/lower.c b/src/gallium/drivers/lima/ir/pp/lower.c
index db62988078d..2e87754d893 100644
--- a/src/gallium/drivers/lima/ir/pp/lower.c
+++ b/src/gallium/drivers/lima/ir/pp/lower.c
@@ -414,6 +414,19 @@ static bool ppir_lower_abs(ppir_block *block, ppir_node *node)
return true;
}
+static bool ppir_lower_neg(ppir_block *block, ppir_node *node)
+{
+ /* Turn it into a mov and set the negate modifier */
+ ppir_alu_node *alu = ppir_node_to_alu(node);
+
+ assert(alu->num_src == 1);
+
+ alu->src[0].negate = !alu->src[0].negate;
+ node->op = ppir_op_mov;
+
+ return true;
+}
+
static bool ppir_lower_branch(ppir_block *block, ppir_node *node)
{
ppir_branch_node *branch = ppir_node_to_branch(node);
@@ -450,6 +463,7 @@ static bool ppir_lower_branch(ppir_block *block, ppir_node *node)
static bool (*ppir_lower_funcs[ppir_op_num])(ppir_block *, ppir_node *) = {
[ppir_op_abs] = ppir_lower_abs,
+ [ppir_op_neg] = ppir_lower_neg,
[ppir_op_const] = ppir_lower_const,
[ppir_op_dot2] = ppir_lower_dot,
[ppir_op_dot3] = ppir_lower_dot,
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index 18c6eb347f4..4ad85635399 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -120,6 +120,7 @@ static int nir_to_ppir_opcodes[nir_num_opcodes] = {
[nir_op_mov] = ppir_op_mov,
[nir_op_fmul] = ppir_op_mul,
[nir_op_fabs] = ppir_op_abs,
+ [nir_op_fneg] = ppir_op_neg,
[nir_op_fadd] = ppir_op_add,
[nir_op_fdot2] = ppir_op_dot2,
[nir_op_fdot3] = ppir_op_dot3,
diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c
index a1a7f819f1b..425329bb713 100644
--- a/src/gallium/drivers/lima/ir/pp/node.c
+++ b/src/gallium/drivers/lima/ir/pp/node.c
@@ -40,6 +40,9 @@ const ppir_op_info ppir_op_infos[] = {
[ppir_op_abs] = {
.name = "abs",
},
+ [ppir_op_neg] = {
+ .name = "neg",
+ },
[ppir_op_mul] = {
.name = "mul",
.slots = (int []) {
diff --git a/src/gallium/drivers/lima/ir/pp/ppir.h b/src/gallium/drivers/lima/ir/pp/ppir.h
index cc3a37e8ade..bf4bb544261 100644
--- a/src/gallium/drivers/lima/ir/pp/ppir.h
+++ b/src/gallium/drivers/lima/ir/pp/ppir.h
@@ -33,6 +33,7 @@
typedef enum {
ppir_op_mov,
ppir_op_abs,
+ ppir_op_neg,
ppir_op_add,
ppir_op_ddx,
More information about the mesa-commit
mailing list