diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 2789080d1df..006a25debc9 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3427,6 +3427,8 @@ typedef struct nir_shader_compiler_options { bool lower_fneg; /** lowers ineg to isub. Driver must call nir_opt_algebraic_late(). */ bool lower_ineg; + /** lowers fisnormal to alu ops. */ + bool lower_fisnormal; /* lower {slt,sge,seq,sne} to {flt,fge,feq,fneu} + b2f: */ bool lower_scmp; diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 6bb9884acbd..f2bf852ea8b 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -2143,6 +2143,10 @@ for op in ['ineg', 'iabs', 'inot', 'isign']: ((op, ('bcsel', c, '#a', '#b')), ('bcsel', c, (op, a), (op, b))), ] +optimizations.extend([ + (('fisnormal', 'a@32'), ('ult', 0x1ffffff, ('iadd', ('ishl', a, 1), 0x1000000)), 'options->lower_fisnormal') + ]) + # This section contains optimizations to propagate downsizing conversions of # constructed vectors into vectors of downsized components. Whether this is # useful depends on the SIMD semantics of the backend. On a true SIMD machine,