[llvm] [GlobalISel] Combine into abd[su] and legalize abd[su] (PR #118865)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 09:18:30 PST 2024


Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/118865 at github.com>


================
@@ -7865,3 +7865,35 @@ bool CombinerHelper::matchSuboCarryOut(const MachineInstr &MI,
 
   return false;
 }
+
+// sub(smax(lhs,rhs), smin(lhs,rhs)) -> abds(lhs, rhs)
+bool CombinerHelper::matchSubAbds(const MachineInstr &MI) {
+  const GSub *Sub = cast<GSub>(&MI);
+  const GMaxMinOp *LHS = cast<GMaxMinOp>(MRI.getVRegDef(Sub->getLHSReg()));
+  const GMaxMinOp *RHS = cast<GMaxMinOp>(MRI.getVRegDef(Sub->getLHSReg()));
----------------
arsenm wrote:

getRHSReg?

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


More information about the llvm-commits mailing list