st,i965: Stop looping on 64-bit lowering
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 11 Jul 2019 21:59:31 +0000 (16:59 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Tue, 16 Jul 2019 16:05:16 +0000 (16:05 +0000)
Now that the 64-bit lowering passes do a complete lowering in one go, we
don't need to loop anymore.  We do, however, have to ensure that int64
lowering happens after double lowering because double lowering can
produce int64 ops.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/intel/compiler/brw_compiler.c
src/intel/compiler/brw_nir.c
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 6d9dac6c3ca9ebb6f1443027449573768e455c4a..7ceeb14c70f84a79a1b68ce9aab8f741d1b88d43 100644 (file)
@@ -133,7 +133,9 @@ brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo)
       nir_lower_dceil |
       nir_lower_dfract |
       nir_lower_dround_even |
-      nir_lower_dmod;
+      nir_lower_dmod |
+      nir_lower_dsub |
+      nir_lower_ddiv;
 
    if (!devinfo->has_64bit_types || (INTEL_DEBUG & DEBUG_SOFT64)) {
       int64_options |= nir_lower_mov64 |
index a08057581605d5f1b0e989caad482e3a25a5a330..675fe026695dea431eef8f68e55006ae3a5edc19 100644 (file)
@@ -681,18 +681,8 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir,
 
    brw_nir_optimize(nir, compiler, is_scalar, true);
 
-   bool lowered_64bit_ops = false;
-   do {
-      progress = false;
-
-      OPT(nir_lower_int64, nir->options->lower_int64_options);
-      OPT(nir_lower_doubles, softfp64, nir->options->lower_doubles_options);
-
-      /* Necessary to lower add -> sub and div -> mul/rcp */
-      OPT(nir_opt_algebraic);
-
-      lowered_64bit_ops |= progress;
-   } while (progress);
+   OPT(nir_lower_doubles, softfp64, nir->options->lower_doubles_options);
+   OPT(nir_lower_int64, nir->options->lower_int64_options);
 
    /* This needs to be run after the first optimization pass but before we
     * lower indirect derefs away
index be1fc3b24842af1cd6d7f98dfe00b05b240fb743..9bd69383373eea442857ad1ed8af665276a58ae6 100644 (file)
@@ -367,23 +367,14 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
 
    if (lower_64bit) {
       bool lowered_64bit_ops = false;
-      bool progress = false;
-
-      NIR_PASS_V(nir, nir_opt_algebraic);
-
-      do {
-         progress = false;
-         if (options->lower_int64_options) {
-            NIR_PASS(progress, nir, nir_lower_int64,
-                     options->lower_int64_options);
-         }
-         if (options->lower_doubles_options) {
-            NIR_PASS(progress, nir, nir_lower_doubles,
-                     st->ctx->SoftFP64, options->lower_doubles_options);
-         }
-         NIR_PASS(progress, nir, nir_opt_algebraic);
-         lowered_64bit_ops |= progress;
-      } while (progress);
+      if (options->lower_doubles_options) {
+         NIR_PASS(lowered_64bit_ops, nir, nir_lower_doubles,
+                  st->ctx->SoftFP64, options->lower_doubles_options);
+      }
+      if (options->lower_int64_options) {
+         NIR_PASS(lowered_64bit_ops, nir, nir_lower_int64,
+                  options->lower_int64_options);
+      }
 
       if (lowered_64bit_ops)
          st_nir_opts(nir, is_scalar);