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 <nunes.erico@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
This commit is contained in:
Erico Nunes 2019-04-23 19:36:34 +02:00
parent 1291c68c9c
commit 568e8fc736
3 changed files with 14 additions and 0 deletions

View file

@ -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)

View file

@ -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)

View file

@ -78,6 +78,7 @@ typedef enum {
ppir_op_mod,
ppir_op_min,
ppir_op_max,
ppir_op_trunc,
ppir_op_dot2,
ppir_op_dot3,