Mesa (master): nir/algebraic: Optimize ushr of pack_half, not ishr
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 11 19:39:53 UTC 2020
Module: Mesa
Branch: master
Commit: a2bf41ec6527fbedc2a75a8072d7222298bca347
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2bf41ec6527fbedc2a75a8072d7222298bca347
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>
---
src/compiler/nir/nir_opt_algebraic.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index f9ebd5af4ad..2122559e7d6 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -1030,7 +1030,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