nir/algebraic: fix iabs(ishr(iabs(a), b)) optimization
iabs(a) is not positive if "a" is the minimum signed value, so this is incorrect in that case for some values of "b". Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Fixes:2b76de9b5d
("nir/algebraic: Add a couple optimizations for iabs and ishr") (cherry picked from commitecd6ae12fb
) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32261>
This commit is contained in:
@@ -1320,7 +1320,8 @@ optimizations.extend([
|
||||
# negative.
|
||||
(('bcsel', ('ilt', a, 0), ('ineg', ('ishr', a, b)), ('ishr', a, b)),
|
||||
('iabs', ('ishr', a, b))),
|
||||
(('iabs', ('ishr', ('iabs', a), b)), ('ishr', ('iabs', a), b)),
|
||||
(('iabs', ('ishr', ('iabs', a), b)), ('ushr', ('iabs', a), b)),
|
||||
(('iabs', ('ushr', ('iabs', a), b)), ('ushr', ('iabs', a), b)),
|
||||
|
||||
(('fabs', ('slt', a, b)), ('slt', a, b)),
|
||||
(('fabs', ('sge', a, b)), ('sge', a, b)),
|
||||
|
Reference in New Issue
Block a user