Mesa (main): nir: add fisnormal lowering
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 6 05:17:31 UTC 2021
Module: Mesa
Branch: main
Commit: ad92c2b253d8e122d0f01ab72ccbdfa37efde538
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad92c2b253d8e122d0f01ab72ccbdfa37efde538
Author: Dave Airlie <airlied at redhat.com>
Date: Fri Aug 6 07:19:27 2021 +1000
nir: add fisnormal lowering
just lower the 32-bit version for now.
Thanks to alyssa for this suggested lowering.
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12207>
---
src/compiler/nir/nir.h | 2 ++
src/compiler/nir/nir_opt_algebraic.py | 4 ++++
2 files changed, 6 insertions(+)
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 at 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,
More information about the mesa-commit
mailing list