Mesa (master): pan/mdg: Ingest fsat_signed/fclamp_pos
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue May 19 20:42:39 UTC 2020
Module: Mesa
Branch: master
Commit: 24e2e24dc0124e5c5f9426a5f571a487b2ac6bfe
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=24e2e24dc0124e5c5f9426a5f571a487b2ac6bfe
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Mon May 4 16:12:41 2020 -0400
pan/mdg: Ingest fsat_signed/fclamp_pos
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5102>
---
src/panfrost/midgard/midgard_compile.c | 2 ++
src/panfrost/midgard/midgard_nir_algebraic.py | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 907634b1e13..0f57ba67626 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -770,6 +770,8 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
ALU_CASE(fabs, fmov);
ALU_CASE(fneg, fmov);
ALU_CASE(fsat, fmov);
+ ALU_CASE(fsat_signed, fmov);
+ ALU_CASE(fclamp_pos, fmov);
/* For size conversion, we use a move. Ideally though we would squash
* these ops together; maybe that has to happen after in NIR as part of
diff --git a/src/panfrost/midgard/midgard_nir_algebraic.py b/src/panfrost/midgard/midgard_nir_algebraic.py
index ae399c36d5b..d7eceeba869 100644
--- a/src/panfrost/midgard/midgard_nir_algebraic.py
+++ b/src/panfrost/midgard/midgard_nir_algebraic.py
@@ -45,6 +45,13 @@ algebraic_late = [
(('b32csel', a, 'b at 32', 0), ('iand', a, b)),
(('b32csel', a, 0, 'b at 32'), ('iand', ('inot', a), b)),
+
+ # Fuse sat_signed. This should probably be shared with Bifrost
+ (('~fmin', ('fmax', a, -1.0), 1.0), ('fsat_signed', a)),
+ (('~fmax', ('fmin', a, 1.0), -1.0), ('fsat_signed', a)),
+
+ # Fuse clamp_positive. This should probably be shared with Utgard/bifrost
+ (('fmax', a, 0.0), ('fclamp_pos', a)),
]
More information about the mesa-commit
mailing list