nir/lower_idiv: add new llvm-based path
[mesa.git] / src / gallium / drivers / etnaviv / etnaviv_compiler_nir.c
index bc8aac03c46f83a5b55d653b16162f25c790f0ec..4cf48b46e785b548d5a63aa00af38556d776ae75 100644 (file)
@@ -63,12 +63,6 @@ struct etna_compile {
    bool error;
 };
 
-#define compile_error(ctx, args...) ({ \
-   printf(args); \
-   ctx->error = true; \
-   assert(0); \
-})
-
 /* io related lowering
  * run after lower_int_to_float because it adds i2f/f2i ops
  */
@@ -152,6 +146,8 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
                   lod_bias = &tex->src[i].src;
                   lod_bias_idx = i;
                   break;
+               case nir_tex_src_comparator:
+                  break;
                default:
                   assert(0);
                   break;
@@ -493,7 +489,7 @@ etna_emit_alu(struct etna_compile *c, nir_op op, struct etna_inst_dst dst,
 static void
 etna_emit_tex(struct etna_compile *c, nir_texop op, unsigned texid, unsigned dst_swiz,
               struct etna_inst_dst dst, struct etna_inst_src coord,
-              struct etna_inst_src lod_bias)
+              struct etna_inst_src lod_bias, struct etna_inst_src compare)
 {
    struct etna_inst inst = {
       .dst = dst,
@@ -505,6 +501,9 @@ etna_emit_tex(struct etna_compile *c, nir_texop op, unsigned texid, unsigned dst
    if (lod_bias.use)
       inst.src[1] = lod_bias;
 
+   if (compare.use)
+      inst.src[2] = compare;
+
    switch (op) {
    case nir_texop_tex: inst.opcode = INST_OPCODE_TEXLD; break;
    case nir_texop_txb: inst.opcode = INST_OPCODE_TEXLDB; break;
@@ -763,7 +762,7 @@ etna_compile_shader_nir(struct etna_shader_variant *v)
       OPT_V(s, nir_opt_algebraic);
       OPT_V(s, nir_lower_bool_to_float);
    } else {
-      OPT_V(s, nir_lower_idiv);
+      OPT_V(s, nir_lower_idiv, nir_lower_idiv_fast);
       OPT_V(s, nir_lower_bool_to_int32);
    }