Module: Mesa
Branch: main
Commit: 47d3f7c69f52432566653834cde0f4fcbef408dd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=47d3f7c69f52432566653834cde0f4fcbef408dd

Author: Gert Wollny <[email protected]>
Date:   Sun Apr 24 14:25:01 2022 +0200

nir: Don't optimize to 64 bit fsub if the driver doesn't support it

Fixes: a4840e15ab77b44a72cabd7d503172e8357477eb
  r600: Use nir-to-tgsi instead of TGSI when the NIR debug opt is disabled.

Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Emma Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16130>

---

 src/compiler/nir/nir_opt_algebraic.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 3eba54f675f..eec10407842 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -2556,7 +2556,11 @@ late_optimizations = [
    (('~fadd@32', ('fmulz', a, b), c), ('ffmaz', a, b, c), 
'options->fuse_ffma32'),
 
    # Subtractions get lowered during optimization, so we need to recombine them
-   (('fadd', a, ('fneg', 'b')), ('fsub', 'a', 'b'), 'options->has_fsub'),
+   (('fadd@8', a, ('fneg', 'b')), ('fsub', 'a', 'b'), 'options->has_fsub'),
+   (('fadd@16', a, ('fneg', 'b')), ('fsub', 'a', 'b'), 'options->has_fsub'),
+   (('fadd@32', a, ('fneg', 'b')), ('fsub', 'a', 'b'), 'options->has_fsub'),
+   (('fadd@64', a, ('fneg', 'b')), ('fsub', 'a', 'b'), 'options->has_fsub && 
!(options->lower_doubles_options & nir_lower_dsub)'),
+
    (('fneg', a), ('fmul', a, -1.0), 'options->lower_fneg'),
    (('iadd', a, ('ineg', 'b')), ('isub', 'a', 'b'), 'options->has_isub || 
options->lower_ineg'),
    (('ineg', a), ('isub', 0, a), 'options->lower_ineg'),

Reply via email to