[llvm] [RISCV] Combine ADDD(lo, hi, x, 0) -> WADDAU(lo, hi, x, 0). Combine WADDAU (WADDAU lo, hi, x, 0), y, 0 -> WADDAU lo, hi, x, y (PR #181396)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 11:48:17 PST 2026


================
@@ -1493,6 +1493,15 @@ def riscv_addd : RVSDNode<"ADDD", SDT_RISCVIntBinOpD,
                           [SDNPCommutative, SDNPAssociative]>;
 def riscv_subd : RVSDNode<"SUBD", SDT_RISCVIntBinOpD>;
 
+def SDT_RISCVWideningAddSubAccumulate : SDTypeProfile<2, 4, [SDTCisVT<0, i32>,
+                                                             SDTCisVT<1, i32>,
+                                                             SDTCisSameAs<0, 2>,
+                                                             SDTCisSameAs<1, 3>,
+                                                             SDTCisVT<4, i32>,
+                                                             SDTCisVT<5, i32>]>;
----------------
topperc wrote:

I was trying (and perhaps failing) to write it in terms of the pairs while also keeping the parts of the pairs separate. So 0 and 1 are a pair. 2 and 3 are a pair that match the equivalent part in 0 and 1. 4 and 5 are not pairs so they are independent. Though I guess they should be the same as 0?

I should just abandon this idea.

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


More information about the llvm-commits mailing list