nir/range_analysis: unsigned upper bound analysis for b2i
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 1 Dec 2022 20:22:16 +0000 (20:22 +0000)
committerMarge Bot <emma+marge@anholt.net>
Tue, 6 Dec 2022 15:23:38 +0000 (15:23 +0000)
fossil-db (navi21):
Totals from 93 (0.07% of 135636) affected shaders:
Instrs: 133949 -> 133899 (-0.04%); split: -0.05%, +0.01%
CodeSize: 708124 -> 707528 (-0.08%); split: -0.09%, +0.01%
Latency: 2451564 -> 2450158 (-0.06%); split: -0.06%, +0.00%
InvThroughput: 398282 -> 397345 (-0.24%)
SClause: 4441 -> 4437 (-0.09%); split: -0.18%, +0.09%
Copies: 7578 -> 7546 (-0.42%); split: -0.55%, +0.13%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20117>

src/compiler/nir/nir_range_analysis.c

index 56fd3f0..7770bcf 100644 (file)
@@ -1526,6 +1526,9 @@ nir_unsigned_upper_bound(nir_shader *shader, struct hash_table *range_ht,
       case nir_op_extract_i8:
       case nir_op_extract_u16:
       case nir_op_extract_i16:
+      case nir_op_b2i8:
+      case nir_op_b2i16:
+      case nir_op_b2i32:
          break;
       case nir_op_u2u1:
       case nir_op_u2u8:
@@ -1657,6 +1660,11 @@ nir_unsigned_upper_bound(nir_shader *shader, struct hash_table *range_ht,
       case nir_op_u2u32:
          res = MIN2(src0, max);
          break;
+      case nir_op_b2i8:
+      case nir_op_b2i16:
+      case nir_op_b2i32:
+         res = 1;
+         break;
       case nir_op_sad_u8x4:
          res = src2 + 4 * 255;
          break;