[Mesa-dev] [PATCH v2 11/29] nir: Drop support for lower_b2f

Jason Ekstrand jason at jlekstrand.net
Thu Dec 6 19:45:02 UTC 2018


This was originally added for the out-of-tree Mali driver but I think
we've all agreed it's easy enough for them to just do in their back-end.

Cc: Alyssa Rosenzweig <alyssa at rosenzweig.io>
---
 src/compiler/nir/nir.h                | 3 ---
 src/compiler/nir/nir_opt_algebraic.py | 5 +----
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index cb8122def8a..4d8c7bd8a3c 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2115,9 +2115,6 @@ typedef struct nir_shader_compiler_options {
    /** enables rules to lower idiv by power-of-two: */
    bool lower_idiv;
 
-   /* lower b2f to iand */
-   bool lower_b2f;
-
    /* Does the native fdot instruction replicate its result for four
     * components?  If so, then opt_algebraic_late will turn all fdotN
     * instructions into fdot_replicatedN instructions.
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index ea24094a927..57abe7c9952 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -440,7 +440,7 @@ optimizations = [
    (('imul', ('b2i', 'a at 32'), ('b2i', 'b at 32')), ('b2i', ('iand', a, b))),
    (('fmul', ('b2f', 'a at 32'), ('b2f', 'b at 32')), ('b2f', ('iand', a, b))),
    (('fsat', ('fadd', ('b2f', 'a at 32'), ('b2f', 'b at 32'))), ('b2f', ('ior', a, b))),
-   (('iand', 'a at bool', 1.0), ('b2f', a), '!options->lower_b2f'),
+   (('iand', 'a at bool', 1.0), ('b2f', a)),
    # True/False are ~0 and 0 in NIR.  b2i of True is 1, and -1 is ~0 (True).
    (('ineg', ('b2i32', 'a at 32')), a),
    (('flt', ('fneg', ('b2f', 'a at 32')), 0), a), # Generated by TGSI KILL_IF.
@@ -916,9 +916,6 @@ late_optimizations = [
    # we do these late so that we don't get in the way of creating ffmas
    (('fmin', ('fadd(is_used_once)', '#c', a), ('fadd(is_used_once)', '#c', b)), ('fadd', c, ('fmin', a, b))),
    (('fmax', ('fadd(is_used_once)', '#c', a), ('fadd(is_used_once)', '#c', b)), ('fadd', c, ('fmax', a, b))),
-
-   # Lowered for backends without a dedicated b2f instruction
-   (('b2f32', 'a at 32'), ('iand', a, 1.0), 'options->lower_b2f'),
 ]
 
 print(nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render())
-- 
2.19.2



More information about the mesa-dev mailing list