summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-06-05 15:24:51 +0000
committerAlyssa Rosenzweig <[email protected]>2019-06-05 17:59:24 +0000
commit88c59798fe1c21061ba99db5b3337d69c3fb7004 (patch)
tree3a19a3d571852e4e9336018b2a2109e40642f2b2 /src
parent9f14e20fa1fdb36ff8a014d9f4e2c4a2fba7b588 (diff)
panfrost/midgard: Fix 1-arg ALU memory corruption
Certain ops that only take one argument have an imaginary "zero" constant for their second argument. For instance, conversions: i2f [dest], [source], #0 Memory corruption meant that #0 was instead random noise. For some ops, that doesn't matter (manifested as abnormally large code size and poor scheduling due to extra constants in random places). But for others, where a 1-op is emulated by a 2-op with an implicit 0 second argument, that broke things. Fixes iabs (emulated by iabsdiff). Signed-off-by: Alyssa Rosenzweig <[email protected]> Reviewed-By: Ryan Houdek <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/panfrost/midgard/midgard_compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index 96f3e525b4a..99a648788ef 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -930,7 +930,8 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
}
ins.alu.src2 = vector_alu_srco_unsigned(blank_alu_src_xxxx);
- } else if (instr->op == nir_op_f2b32 || instr->op == nir_op_i2b32) {
+ } else if (nr_inputs == 1 && !quirk_flipped_r24) {
+ /* Lots of instructions need a 0 plonked in */
ins.ssa_args.inline_constant = false;
ins.ssa_args.src1 = SSA_FIXED_REGISTER(REGISTER_CONSTANT);
ins.has_constants = true;