nir/algebraic: Optimize ushr of pack_half, not ishr
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 2 Apr 2020 19:14:12 +0000 (12:14 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 11 May 2020 19:07:01 +0000 (12:07 -0700)
commita2bf41ec6527fbedc2a75a8072d7222298bca347
treea3625f8b946bf9376779b9232292ec3a022c03b3
parentab16bff97d75301b56530c2c9a410960e2de8bc8
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@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4515>
src/compiler/nir/nir_opt_algebraic.py