Re: [Mesa-dev] [PATCH 4/4] nir: reorder some code

2019-02-13 Thread Timothy Arceri

On 14/2/19 1:44 am, Jason Ekstrand wrote:
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.


Callgrind did show a change but it was very small. I'm not fussed about 
this one so will drop it since you don't like it.




On February 13, 2019 02:00:49 Timothy Arceri  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

Re: [Mesa-dev] [PATCH 4/4] nir: reorder some code

2019-02-13 Thread Jason Ekstrand
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  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