vc4: Use NIR-level lowering for idiv.
authorEric Anholt <eric@anholt.net>
Mon, 13 Apr 2015 21:12:59 +0000 (14:12 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 14 Apr 2015 04:36:40 +0000 (21:36 -0700)
This fixes the idiv tests in piglit.

src/gallium/drivers/vc4/vc4_program.c

index ca2e81c3900ad2dddbf8762eabcd803c00056ccc..ec649c9c43bd9efd7f12417cc33e82d620f83cc3 100644 (file)
@@ -311,14 +311,6 @@ ntq_umul(struct vc4_compile *c, struct qreg src0, struct qreg src1)
                                         qir_uniform_ui(c, 24)));
 }
 
-static struct qreg
-ntq_idiv(struct vc4_compile *c, struct qreg src0, struct qreg src1)
-{
-        return qir_FTOI(c, qir_FMUL(c,
-                                    qir_ITOF(c, src0),
-                                    qir_RCP(c, qir_ITOF(c, src1))));
-}
-
 static void
 ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
 {
@@ -983,9 +975,6 @@ ntq_emit_alu(struct vc4_compile *c, nir_alu_instr *instr)
         case nir_op_imul:
                 *dest = ntq_umul(c, src[0], src[1]);
                 break;
-        case nir_op_idiv:
-                *dest = ntq_idiv(c, src[0], src[1]);
-                break;
 
         case nir_op_seq:
                 qir_SF(c, qir_FSUB(c, src[0], src[1]));
@@ -2096,6 +2085,7 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
         c->s = tgsi_to_nir(tokens, &nir_options);
         nir_opt_global_to_local(c->s);
         nir_convert_to_ssa(c->s);
+        nir_lower_idiv(c->s);
 
         vc4_optimize_nir(c->s);