panfrost/mdg: Use shared fsign lowering
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 19 Apr 2019 23:15:45 +0000 (23:15 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 19 Apr 2019 23:15:57 +0000 (23:15 +0000)
Fixes failures in shaders.operator.common_functions.sign.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/midgard/midgard_compile.c
src/gallium/drivers/panfrost/midgard/midgard_compile.h
src/gallium/drivers/panfrost/midgard/midgard_nir.h
src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py

index 203e6cdf69a6f983818bf7d6c3adb8db5c0f0add..67c1d59d85afa0996fc553c71994868be74d2003 100644 (file)
@@ -767,7 +767,6 @@ optimise_nir(nir_shader *nir)
         do {
                 progress = false;
 
-                NIR_PASS(progress, nir, midgard_nir_lower_algebraic);
                 NIR_PASS(progress, nir, nir_lower_var_copies);
                 NIR_PASS(progress, nir, nir_lower_vars_to_ssa);
 
index 4bc5d475b5a635f7fb90a2ad508410a2b3b7d571..0724582d62c8ad2747815d9540ac06725297fa2d 100644 (file)
@@ -99,6 +99,10 @@ static const nir_shader_compiler_options midgard_nir_options = {
         .lower_fpow = true,
         .lower_find_lsb = true,
 
+        /* TODO: We have native ops to help here, which we'll want to look into
+         * eventually */
+        .lower_fsign = true,
+
         .vertex_id_zero_based = true,
         .lower_extract_byte = true,
         .lower_extract_word = true,
index 6b4833b32b2d4d76085e4eb17eaed45cf7576e13..85eadd346319eb8607e6aefcfd381d586e1ec9e1 100644 (file)
@@ -1,6 +1,5 @@
 #include <stdbool.h>
 #include "nir.h"
 
-bool midgard_nir_lower_algebraic(nir_shader *shader);
 bool midgard_nir_lower_algebraic_late(nir_shader *shader);
 bool midgard_nir_scale_trig(nir_shader *shader);
index 8aad4b128c477bb17c5013aa96bcf02284b262f1..7c8cd06feed637c970667e41d8b2bb2d67063379 100644 (file)
@@ -29,13 +29,6 @@ import math
 a = 'a'
 b = 'b'
 
-algebraic = [
-    # XXX: We have hw ops for this, just unknown atm..
-    #(('fsign@32', a), ('i2f32@32', ('isign', ('f2i32@32', ('fmul', a, 0x43800000)))))
-    #(('fsign', a), ('fcsel', ('fge', a, 0), 1.0, ('fcsel', ('flt', a, 0.0), -1.0, 0.0)))
-    (('fsign', a), ('bcsel', ('fge', a, 0), 1.0, -1.0)),
-]
-
 algebraic_late = [
     # ineg must be lowered late, but only for integers; floats will try to
     # have modifiers attached... hence why this has to be here rather than
@@ -65,8 +58,6 @@ def run():
     import nir_algebraic  # pylint: disable=import-error
 
     print('#include "midgard_nir.h"')
-    print(nir_algebraic.AlgebraicPass("midgard_nir_lower_algebraic",
-                                      algebraic).render())
 
     print(nir_algebraic.AlgebraicPass("midgard_nir_lower_algebraic_late",
                                       algebraic_late).render())