diff options
Diffstat (limited to 'llvm/include/llvm/IR/PatternMatch.h')
| -rw-r--r-- | llvm/include/llvm/IR/PatternMatch.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h index 9b18850a54d..f22acba65cc 100644 --- a/llvm/include/llvm/IR/PatternMatch.h +++ b/llvm/include/llvm/IR/PatternMatch.h @@ -1349,15 +1349,22 @@ m_c_Xor(const LHS &L, const RHS &R) { return m_CombineOr(m_Xor(L, R), m_Xor(R, L)); } -// TODO: Add the related SMax, UMax, UMin commuted matchers. +// TODO: Add the related UMax and UMin commuted matchers. /// Matches an SMin with LHS and RHS in either order. -template<typename LHS, typename RHS> +template <typename LHS, typename RHS> inline match_combine_or<MaxMin_match<ICmpInst, LHS, RHS, smin_pred_ty>, MaxMin_match<ICmpInst, RHS, LHS, smin_pred_ty>> m_c_SMin(const LHS &L, const RHS &R) { return m_CombineOr(m_SMin(L, R), m_SMin(R, L)); } +/// Matches an SMax with LHS and RHS in either order. +template <typename LHS, typename RHS> +inline match_combine_or<MaxMin_match<ICmpInst, LHS, RHS, smax_pred_ty>, + MaxMin_match<ICmpInst, RHS, LHS, smax_pred_ty>> +m_c_SMax(const LHS &L, const RHS &R) { + return m_CombineOr(m_SMax(L, R), m_SMax(R, L)); +} } // end namespace PatternMatch } // end namespace llvm |

