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

Rob Clark robdclark at gmail.com
Thu Nov 27 05:58:58 PST 2014


On Wed, Nov 26, 2014 at 5:53 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Empirically, this fixes the glsl 1.30 mod tests.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>

actually it is the madsh.m16 right before, which used b as 2nd src,
which is a no-no (at least on a3xx), rather than the madsh.m16 which
used b as the first src

Reviewed-by: Rob Clark <robdclark at gmail.com>

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