Mesa (master): nir/search: Extend 'a at bool' to handle a couple of system values.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Aug 18 08:31:45 UTC 2016


Module: Mesa
Branch: master
Commit: 3a9e6102b4baae3f50956e5f150c9e59138f4cc0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a9e6102b4baae3f50956e5f150c9e59138f4cc0

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Aug 17 15:03:00 2016 -0700

nir/search: Extend 'a at bool' to handle a couple of system values.

load_front_face and load_helper_invocation produce booleans.

On Broadwell:

total instructions in shared programs: 11638956 -> 11638011 (-0.01%)
instructions in affected programs: 115093 -> 114148 (-0.82%)
helped: 628
HURT: 14

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/compiler/nir/nir_search.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c
index bfa00c2..f24a7b9 100644
--- a/src/compiler/nir/nir_search.c
+++ b/src/compiler/nir/nir_search.c
@@ -78,6 +78,13 @@ src_is_type(nir_src src, nir_alu_type type)
       }
 
       return nir_alu_type_get_base_type(output_type) == type;
+   } else if (src.ssa->parent_instr->type == nir_instr_type_intrinsic) {
+      nir_intrinsic_instr *intr = nir_instr_as_intrinsic(src.ssa->parent_instr);
+
+      if (type == nir_type_bool) {
+         return intr->intrinsic == nir_intrinsic_load_front_face ||
+                intr->intrinsic == nir_intrinsic_load_helper_invocation;
+      }
    }
 
    /* don't know */




More information about the mesa-commit mailing list