diff options
author | Ian Romanick <[email protected]> | 2020-04-02 12:14:12 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2020-05-12 11:08:39 -0700 |
commit | 787cecdb02f9345eeb28d3e13b96494c3d6dae61 (patch) | |
tree | 31a1e36d31eed98fc57bf45514fba1590649a9e3 /src | |
parent | 061d24b4b21173a53bf795895e5d4c524c6d8365 (diff) |
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 <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Cc: Connor Abbott <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4515>
(cherry picked from commit a2bf41ec6527fbedc2a75a8072d7222298bca347)
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/nir/nir_opt_algebraic.py | 2 |
1 files changed, 1 insertions, 1 deletions
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))), |