i965: Enable vector shrinking in the vec4 backend.
authorEric Anholt <eric@anholt.net>
Thu, 23 Jul 2020 04:35:07 +0000 (21:35 -0700)
committerMarge Bot <eric+marge@anholt.net>
Mon, 3 Aug 2020 21:26:45 +0000 (21:26 +0000)
This manages to make some extra vec operations that would turn into movs
go away.

brw shader-db:
total instructions in shared programs: 3895037 -> 3893221 (-0.05%)
total cycles in shared programs: 113832759 -> 113792154 (-0.04%)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6050>

src/intel/compiler/brw_nir.c

index 9a6914f92f257e57f0d5dd615ed64f19e11eacd6..510ab0b769ce317b0ea53ea336857ec5aa86df27 100644 (file)
@@ -516,6 +516,8 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,
 
       if (is_scalar) {
          OPT(nir_lower_alu_to_scalar, NULL, NULL);
 
       if (is_scalar) {
          OPT(nir_lower_alu_to_scalar, NULL, NULL);
+      } else {
+         OPT(nir_opt_shrink_vectors);
       }
 
       OPT(nir_copy_prop);
       }
 
       OPT(nir_copy_prop);