etnaviv: use nir_lower_idiv(..) before opt loop
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Sun, 7 Mar 2021 10:05:52 +0000 (11:05 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 9 Mar 2021 06:45:31 +0000 (06:45 +0000)
nir_lower_idiv(..) creates during its lowering isub instructions.
Move nir_lower_idiv(..) before the opt loop to have a chance to
optimize/lower isub away. Also drop the drop the halti dependency to
make it easier to follow.

This fixes the following assert on GC3000:
  Unhandled ALU op: isub

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9447>

src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c

index 4a87590..684b609 100644 (file)
@@ -1104,6 +1104,7 @@ etna_compile_shader_nir(struct etna_shader_variant *v)
    NIR_PASS_V(s, nir_lower_indirect_derefs, nir_var_all, UINT32_MAX);
    NIR_PASS_V(s, nir_lower_tex, &(struct nir_lower_tex_options) { .lower_txp = ~0u });
    NIR_PASS_V(s, nir_lower_alu_to_scalar, etna_alu_to_scalar_filter_cb, specs);
+   NIR_PASS_V(s, nir_lower_idiv, nir_lower_idiv_fast);
 
    etna_optimize_loop(s);
 
@@ -1125,7 +1126,6 @@ etna_compile_shader_nir(struct etna_shader_variant *v)
       NIR_PASS_V(s, nir_opt_algebraic);
       NIR_PASS_V(s, nir_lower_bool_to_float);
    } else {
-      NIR_PASS_V(s, nir_lower_idiv, nir_lower_idiv_fast);
       NIR_PASS_V(s, nir_lower_bool_to_int32);
    }