<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118085>118085</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AArch64][GlobalISel] ABD operations and combines
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davemgreen
</td>
</tr>
</table>
<pre>
SDAG, via these nodes can pattern-recognise and optimise abd nodes. We should add the same operations for global isel.
```
/// ABDS/ABDU - Absolute difference - Return the absolute difference between
/// two numbers interpreted as signed/unsigned.
/// i.e trunc(abs(sext(Op0) - sext(Op1))) becomes abds(Op0, Op1)
/// or trunc(abs(zext(Op0) - zext(Op1))) becomes abdu(Op0, Op1)
ABDS,
ABDU,
```
There are tests in, for example, llvm/test/CodeGen/AArch64/abd-combine.ll.
https://godbolt.org/z/71PGjf486
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8k8GOmzAQhp_GXEZBYCCBAweSiKinVt2uerbxAF4ZG9kmu92nrwxJu41WleZgS7_nn_nGw5yTg0asSXEkxTliix-NrQW74jRYRB1xI37VT-fmQugJrpKBH9EhaCPQQcc0zMx7tHpnsTODlg6BaQFm9nJaL1xs4hh-IrjRLEoAEyLkAccmBDOjZV4a7aA3FgZlOFMgHaqYJE2IfXKLpAEgtN0CmuP5idC2OZ6fYQcNd0YtHkHIvkeLukPYwXf0i9WrGftEwNG_IuqHxP7VgF4mjtaB1B7tbNGjAOZgxSUIbRe9HeOHtzJG8HbRHaEl447Q0uGbJ7T8OieEVrCDP_eU0GoL4NiZCV2g5e7aE9wk_xqAsQ8G7w8G7_83WD412GCe7ufn7fwRPUmaHyNaBGYRPDof4IQsYWr4xqZZYbgqdZ0IbYOC0PZkBF5Qhzk1thv3OaEt42LXmYlLjbFapzx6PzuSNVuPgxHcKB8bOxDavhPaHtJvl5c-L_eRqDNRZRWLsE4PGS1Lmh2yaKyx6vqeZYLSar_Pk4omFd_TAxdpl-aMp5GsaULzNKVVSlNaZDEXRZ9WZVEdKONZXpA8wYlJFYcGgncknVuwTtMyKYtIMY7K3RfF1kG148vgSJ4o6bz7-85Lr9aVurdcnElxvKwf-8sTKlKcA-OPPz_szA2Jixar6gci0o8LjzsTyN4ArwXM1rxgF0CvxTpC21u915r-DgAA__9LUDCA">