nir: add fisnormal lowering

just lower the 32-bit version for now.

Thanks to alyssa for this suggested lowering.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12207>
This commit is contained in:
Dave Airlie 2021-08-06 07:19:27 +10:00
parent 330e28155f
commit ad92c2b253
2 changed files with 6 additions and 0 deletions

View file

@ -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;

View file

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