[llvm] [AMDGPU][GISel] Fold 'min(min(x,y),z)' and 'max(max(x,y),z)' into min3 and max3 (PR #200410)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 06:44:41 PDT 2026


================
@@ -519,10 +519,10 @@ bool AMDGPURegBankCombinerImpl::matchMinMaxToMinMax3(
     return false;
 
   Register R0, R1, R2;
-  auto P1 = m_BinOp(Opc, m_OneNonDBGUse(m_BinOp(Opc, m_Reg(R0), m_Reg(R1))),
+  auto P1 = m_CommutativeBinOp(Opc, m_OneNonDBGUse(m_CommutativeBinOp(Opc, m_Reg(R0), m_Reg(R1))),
----------------
xiongzile wrote:

Two matcher is for min(min(a, b), c) and min(a, min(b, c))
commutative is just for min(min(a, b), c) and min(c, min(a, b)) and min(min(b, a), c) and min(c, min(b, a))?


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


More information about the llvm-commits mailing list