Mesa (master): nir/opt_algebraic: lower 64-bit fmin3/fmax3/fmed3

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 20 07:18:20 UTC 2020


Module: Mesa
Branch: master
Commit: 59427b6d1d07a5824272f7d6b562bcfe83d63b2b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=59427b6d1d07a5824272f7d6b562bcfe83d63b2b

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Apr 15 16:55:31 2020 +0200

nir/opt_algebraic: lower 64-bit fmin3/fmax3/fmed3

This unconditionally lowers 64-bit fmin3/fmax3/fmed3 because
AMD hardware doesn't have native instructions, and no drivers
except RADV uses these instructions.

Fixes dEQP-VK.spirv_assembly.instruction.amd_trinary_minmax.*.f64.*
with ACO.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4570>

---

 src/compiler/nir/nir_opt_algebraic.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 69f804783b2..00d18402bd1 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -1076,6 +1076,10 @@ optimizations.extend([
 
    (('bcsel', ('ine', a, -1), ('ifind_msb', a), -1), ('ifind_msb', a)),
 
+   (('fmin3 at 64', a, b, c), ('fmin at 64', a, ('fmin at 64', b, c))),
+   (('fmax3 at 64', a, b, c), ('fmax at 64', a, ('fmax at 64', b, c))),
+   (('fmed3 at 64', a, b, c), ('fmax at 64', ('fmin at 64', ('fmax at 64', a, b), c), ('fmin at 64', a, b))),
+
    # Misc. lowering
    (('fmod', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod'),
    (('frem', a, b), ('fsub', a, ('fmul', b, ('ftrunc', ('fdiv', a, b)))), 'options->lower_fmod'),



More information about the mesa-commit mailing list