[llvm] [AArch64] Combine vector add(trunc(shift)) (PR #169523)

Usha Gupta via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 10:12:34 PST 2025


================
@@ -22586,6 +22596,37 @@ static SDValue performSubWithBorrowCombine(SDNode *N, SelectionDAG &DAG) {
                      Flags);
 }
 
+// add(trunc(ashr(A, C)), trunc(lshr(B, BW-1))), with C >= BW
+// ->
+// X = trunc(ashr(A, C)); add(x, lshr(X, BW-1)
+// The original converts into ashr+lshr+xtn+xtn+add. The second becomes
+// ashr+xtn+usra. The first form has less total latency due to more parallelism,
+// but more micro-ops and seems to be slower in practice.
+static SDValue performAddTrunkShiftCombine(SDNode *N, SelectionDAG &DAG) {
----------------
usha1830 wrote:

```suggestion
static SDValue performAddTruncShiftCombine(SDNode *N, SelectionDAG &DAG) {
```

https://github.com/llvm/llvm-project/pull/169523


More information about the llvm-commits mailing list