[Freedreno] [PATCH] freedreno/ir3: don't pass consts to madsh.m16 in MOD logic

Ilia Mirkin imirkin at alum.mit.edu
Wed Nov 26 14:53:00 PST 2014


Empirically, this fixes the glsl 1.30 mod tests.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

This is most likely a hack, since in some situations, it works just fine with
a const in the madsh args. There's something we're not understanding going on,
but this definitely fixes the fs-op-mod-* piglits. [And no need to do a full
piglit run, since this exclusively gets used for mod/umod, which only ever
even happen with native ints.]

 src/gallium/drivers/freedreno/ir3/ir3_compiler.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
index aaf362d..0d1c08b 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
@@ -2350,6 +2350,10 @@ trans_idiv(const struct instr_translater *t,
 	if (t->tgsi_opc == TGSI_OPCODE_MOD || t->tgsi_opc == TGSI_OPCODE_UMOD) {
 		/* The division result will have ended up in q. */
 
+		/* One of these operations is unhappy with b being a const. */
+		if (is_const(b))
+			b = get_unconst(ctx, b);
+
 		/* mull.u r, q, b */
 		instr = instr_create(ctx, 2, OPC_MULL_U);
 		vectorize(ctx, instr, &r_dst, 2, q_src, 0, b, 0);
-- 
2.0.4



More information about the Freedreno mailing list