From 7d78fe4a8691d3bdd37961f305220500729fcd92 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Fri, 11 Nov 2022 19:05:24 +0100 Subject: [PATCH] etnaviv: Support negative float inline immediates Closes: #7652 Fixes: 45a111c21c2 ("nir/opt_algebraic: Fuse c - a * b to FMA") Signed-off-by: Christian Gmeiner Reviewed-by: Lucas Stach Part-of: --- src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c index 4f76384609a..e64eb8b2811 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c @@ -498,8 +498,14 @@ emit_alu(struct etna_compile *c, nir_alu_instr * alu) src.neg = asrc->negate || (alu->op == nir_op_fneg); src.abs = asrc->abs || (alu->op == nir_op_fabs); } else { - assert(!asrc->negate && alu->op != nir_op_fneg); + assert(alu->op != nir_op_fneg); assert(!asrc->abs && alu->op != nir_op_fabs); + + if (src.imm_type > 0) + assert(!asrc->negate); + + if (asrc->negate && src.imm_type == 0) + src.imm_val ^= 0x80000; } srcs[i] = src;