(('~fadd', '#a', ('fneg', ('fadd', 'b(is_not_const)', '#c'))), ('fadd', ('fadd', a, ('fneg', c)), ('fneg', b))),
(('iadd', '#a', ('iadd', 'b(is_not_const)', '#c')), ('iadd', ('iadd', a, c), b)),
+ # Drop mul-div by the same value when there's no wrapping.
+ (('idiv', ('imul(no_signed_wrap)', a, b), b), a),
+
# By definition...
(('bcsel', ('ige', ('find_lsb', a), 0), ('find_lsb', a), -1), ('find_lsb', a)),
(('bcsel', ('ige', ('ifind_msb', a), 0), ('ifind_msb', a), -1), ('ifind_msb', a)),
return true;
}
+static inline bool
+no_signed_wrap(nir_alu_instr *instr)
+{
+ return instr->no_signed_wrap;
+}
+
+static inline bool
+no_unsigned_wrap(nir_alu_instr *instr)
+{
+ return instr->no_unsigned_wrap;
+}
+
#endif /* _NIR_SEARCH_ */