I'm not sure that I think about this one. I kind of like the pattern where the first thing in the switch case on subtype is a cast to that subtype. It's also just a cast in debug builds so it should generate zero code.

On February 13, 2019 02:00:49 Timothy Arceri <tarc...@itsqueeze.com> wrote:

The compile shoud do this for us so this is more for neatness
rather than speed.
---
src/compiler/nir/nir_search.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c
index d257b639189..f0a79a54301 100644
--- a/src/compiler/nir/nir_search.c
+++ b/src/compiler/nir/nir_search.c
@@ -272,11 +272,10 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src,
   }

   case nir_search_value_constant: {
-      nir_search_constant *const_val = nir_search_value_as_constant(value);
-
      if (!nir_src_is_const(instr->src[src].src))
         return false;

+      nir_search_constant *const_val = nir_search_value_as_constant(value);
      switch (const_val->type) {
      case nir_type_float:
         for (unsigned i = 0; i < num_components; ++i) {
--
2.20.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev



_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to