panfrost/mdg: Use shared fsign lowering

Fixes failures in shaders.operator.common_functions.sign.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig 2019-04-19 23:15:45 +00:00
parent 31d9caa239
commit 648cda258b
4 changed files with 4 additions and 11 deletions

View 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);

View 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,

View 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);

View 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())