summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorErico Nunes <[email protected]>2019-04-23 19:36:34 +0200
committerErico Nunes <[email protected]>2019-05-02 20:55:56 +0000
commit568e8fc736da97a51ae6ac0774a20279854e6958 (patch)
tree8fc39a2cc271c28ce354c8a11d5474142c17de54 /src/gallium
parent1291c68c9c44f7406404db83528001378079f4dd (diff)
lima/ppir: support nir_op_ftrunc
Support nir_op_ftrunc by turning it into a mov with a round to integer output modifier. Signed-off-by: Erico Nunes <[email protected]> Reviewed-by: Qiang Yu <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/lima/ir/pp/lower.c12
-rw-r--r--src/gallium/drivers/lima/ir/pp/nir.c1
-rw-r--r--src/gallium/drivers/lima/ir/pp/ppir.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/lower.c b/src/gallium/drivers/lima/ir/pp/lower.c
index 97243dcfa3f..ded92b150c5 100644
--- a/src/gallium/drivers/lima/ir/pp/lower.c
+++ b/src/gallium/drivers/lima/ir/pp/lower.c
@@ -389,6 +389,17 @@ static bool ppir_lower_select(ppir_block *block, ppir_node *node)
return true;
}
+static bool ppir_lower_trunc(ppir_block *block, ppir_node *node)
+{
+ /* Turn it into a mov with a round to integer output modifier */
+ ppir_alu_node *alu = ppir_node_to_alu(node);
+ ppir_dest *move_dest = &alu->dest;
+ move_dest->modifier = ppir_outmod_round;
+ node->op = ppir_op_mov;
+
+ return true;
+}
+
static bool (*ppir_lower_funcs[ppir_op_num])(ppir_block *, ppir_node *) = {
[ppir_op_const] = ppir_lower_const,
[ppir_op_dot2] = ppir_lower_dot,
@@ -405,6 +416,7 @@ static bool (*ppir_lower_funcs[ppir_op_num])(ppir_block *, ppir_node *) = {
[ppir_op_le] = ppir_lower_swap_args,
[ppir_op_load_texture] = ppir_lower_texture,
[ppir_op_select] = ppir_lower_select,
+ [ppir_op_trunc] = ppir_lower_trunc,
};
bool ppir_lower_prog(ppir_compiler *comp)
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index 008a5225edc..bdf54b227c6 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -150,6 +150,7 @@ static int nir_to_ppir_opcodes[nir_num_opcodes] = {
[nir_op_fnot] = ppir_op_not,
[nir_op_fcsel] = ppir_op_select,
[nir_op_inot] = ppir_op_not,
+ [nir_op_ftrunc] = ppir_op_trunc,
};
static ppir_node *ppir_emit_alu(ppir_block *block, nir_instr *ni)
diff --git a/src/gallium/drivers/lima/ir/pp/ppir.h b/src/gallium/drivers/lima/ir/pp/ppir.h
index 60901018a58..71d80dc5196 100644
--- a/src/gallium/drivers/lima/ir/pp/ppir.h
+++ b/src/gallium/drivers/lima/ir/pp/ppir.h
@@ -78,6 +78,7 @@ typedef enum {
ppir_op_mod,
ppir_op_min,
ppir_op_max,
+ ppir_op_trunc,
ppir_op_dot2,
ppir_op_dot3,