diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 90fabd487ba..b065ca59181 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -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), diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index be838f4a35b..5a86c73418e 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -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)