diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 0c441b8fb8c..fa9ecf7c531 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -972,15 +972,20 @@ optimizations.extend([ (('iand', 'a@bool16', 1.0), ('b2f', a)), (('iand', 'a@bool32', 1.0), ('b2f', a)), (('flt', ('fneg', ('b2f', 'a@1')), 0), a), # Generated by TGSI KILL_IF. - # Comparison with the same args. Note that these are not done for - # the float versions because NaN always returns false on float - # inequalities. + # Comparison with the same args. Note that these are only done for the + # float versions when the source must be a number. Generally, NaN cmp NaN + # produces the opposite result of X cmp X. flt is the outlier. NaN < NaN + # is false, and, for any number X, X < X is also false. (('ilt', a, a), False), (('ige', a, a), True), (('ieq', a, a), True), (('ine', a, a), False), (('ult', a, a), False), (('uge', a, a), True), + (('flt', a, a), False), + (('fge', 'a(is_a_number)', a), True), + (('feq', 'a(is_a_number)', a), True), + (('fneu', 'a(is_a_number)', a), False), # Logical and bit operations (('iand', a, a), a), (('iand', a, ~0), a),