state_tracker: Lower frexp before lowering doubles.
authorEmma Anholt <emma@anholt.net>
Thu, 23 Mar 2023 18:49:14 +0000 (11:49 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 6 Apr 2023 02:32:01 +0000 (02:32 +0000)
We don't have softfp64 for frexp, it has been lowered in GLSL up until
now.  I didn't bother splitting out 32 from 64 because it's not worth any
effort.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22083>

src/mesa/state_tracker/st_glsl_to_nir.cpp

index 8fa0ae7..02d588b 100644 (file)
@@ -542,6 +542,14 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
             NIR_PASS(revectorize, nir, nir_lower_alu_to_scalar, filter_64_bit_instr, nullptr);
             NIR_PASS(revectorize, nir, nir_lower_phis_to_scalar, false);
          }
+         /* doubles lowering requires frexp to be lowered first if it will be,
+          * since the pass generates other 64-bit ops.  Most backends lower
+          * frexp, and using doubles is rare, and using frexp is even more rare
+          * (no instances in shader-db), so we're not too worried about
+          * accidentally lowering a 32-bit frexp here.
+          */
+         NIR_PASS(lowered_64bit_ops, nir, nir_lower_frexp);
+
          NIR_PASS(lowered_64bit_ops, nir, nir_lower_doubles,
                   st->ctx->SoftFP64, nir->options->lower_doubles_options);
       }