Mesa (staging/20.0): nir/algebraic: Optimize ushr of pack_half, not ishr
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue May 12 18:20:47 UTC 2020
Module: Mesa
Branch: staging/20.0
Commit: 787cecdb02f9345eeb28d3e13b96494c3d6dae61
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=787cecdb02f9345eeb28d3e13b96494c3d6dae61
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Thu Apr 2 12:14:12 2020 -0700
nir/algebraic: Optimize ushr of pack_half, not ishr
When a = -1.0, pack_half_2x16(vec2(0x0000, 0xBC00)) will produce
0xBC000000. The ishr will produce 0xFFFFBC00. The replacement
pack_half_2x16(vec2(0xBC00, 0x0000)) will produce 0x0000BC00.
Fixes: 1f72857739b ("nir/algebraic: add some half packing optimizations")
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Cc: Connor Abbott <cwabbott0 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4515>
(cherry picked from commit a2bf41ec6527fbedc2a75a8072d7222298bca347)
---
.pick_status.json | 2 +-
src/compiler/nir/nir_opt_algebraic.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index ae7bcd234c5..abd9f5b6a08 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -247,7 +247,7 @@
"description": "nir/algebraic: Optimize ushr of pack_half, not ishr",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "1f72857739beed55276f263f49b3802c336b8c58"
},
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 94c8836cbf7..e870bff4868 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -936,7 +936,7 @@ optimizations.extend([
# Optimize half packing
(('ishl', ('pack_half_2x16', ('vec2', a, 0)), 16), ('pack_half_2x16', ('vec2', 0, a))),
- (('ishr', ('pack_half_2x16', ('vec2', 0, a)), 16), ('pack_half_2x16', ('vec2', a, 0))),
+ (('ushr', ('pack_half_2x16', ('vec2', 0, a)), 16), ('pack_half_2x16', ('vec2', a, 0))),
(('iadd', ('pack_half_2x16', ('vec2', a, 0)), ('pack_half_2x16', ('vec2', 0, b))),
('pack_half_2x16', ('vec2', a, b))),
More information about the mesa-commit
mailing list