llvm-project
4fdf07fd - [AArch64] Use CNEG for absolute difference patterns. (#151177)

Commit
62 days ago
[AArch64] Use CNEG for absolute difference patterns. (#151177) The current code generated for absolute difference patterns (a > b ? a - b : b - a) typically consists of sequences of: ``` sub w8, w1, w0 subs w9, w0, w1 csel w0, w9, w8, hi ``` The first sub is redundant if the csel is replaced by a cneg: ``` subs w8, w0, w1 cneg w0, w8, ls ``` This is achieved by canonicalising ``` select_cc lhs, rhs, sub(lhs, rhs), sub(rhs, lhs), cc -> select_cc lhs, rhs, sub(lhs, rhs), neg(sub(lhs, rhs)), cc select_cc lhs, rhs, sub(rhs, lhs), sub(lhs, rhs), cc -> select_cc lhs, rhs, neg(sub(lhs, rhs)), sub(lhs, rhs), cc ``` as the second forms can already be matched. This helps with some of the patterns in #118413.
Author
Parents
Loading