mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
nir/opt_algebraic: fix fabs optimization
This fixes a regression found in blender's unit testing, which called fabs(-0.0) and invoked an NIR optimization that is was not valid for the parameter -0.0. IEEE 754 requires that abs clear the sign bit for the value -0.0. Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41060>
This commit is contained in:
parent
e5392e3d5f
commit
d1dd65d425
2 changed files with 3 additions and 1 deletions
|
|
@ -1943,7 +1943,8 @@ optimizations.extend([
|
|||
# fract(x) = x - floor(x), so fract(NaN/Inf) = NaN
|
||||
(('ffract(nnan)', 'a(is_integral)'), 0.0),
|
||||
(('ffract', ('ffract', a)), ('ffract', a)),
|
||||
(('fabs', 'a(is_not_negative)'), ('fcanonicalize', a)),
|
||||
(('fabs(nsz)', 'a(is_not_negative)'), ('fcanonicalize', a)),
|
||||
(('fabs', 'a(is_not_negative_or_negative_zero)'), ('fcanonicalize', a)),
|
||||
(('fabs(nsz)', 'a(is_not_positive)'), ('fneg', a)),
|
||||
|
||||
(('fneu', 'a(is_not_zero)', 0.0), True),
|
||||
|
|
|
|||
|
|
@ -891,6 +891,7 @@ RELATION_AND_NUM(lt_zero, FP_CLASS_ANY_POS | FP_CLASS_ANY_ZERO)
|
|||
RELATION_AND_NUM(not_positive, FP_CLASS_ANY_POS)
|
||||
RELATION_AND_NUM(gt_zero, FP_CLASS_ANY_NEG | FP_CLASS_ANY_ZERO)
|
||||
RELATION_AND_NUM(not_negative, FP_CLASS_ANY_NEG)
|
||||
RELATION_AND_NUM(not_negative_or_negative_zero, FP_CLASS_ANY_NEG | FP_CLASS_NEG_ZERO)
|
||||
RELATION_AND_NUM(not_zero, FP_CLASS_ANY_ZERO)
|
||||
RELATION_AND_NUM(zero_to_one, FP_CLASS_ANY_NEG | FP_CLASS_GT_POS_ONE | FP_CLASS_POS_INF)
|
||||
RELATION_AND_NUM(le_pos_one, FP_CLASS_GT_POS_ONE | FP_CLASS_POS_INF)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue