[llvm] [VectorCombine] Scalarize binop-like intrinsics (PR #138095)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Sat May 3 08:09:25 PDT 2025
================
@@ -1016,21 +1017,34 @@ bool VectorCombine::scalarizeVPIntrinsic(Instruction &I) {
return true;
}
-/// Match a vector binop or compare instruction with at least one inserted
-/// scalar operand and convert to scalar binop/cmp followed by insertelement.
+/// Match a vector binop, compare or binop-like intrinsic with at least one
+/// inserted scalar operand and convert to scalar binop/cmp/intrinsic followed
+/// by insertelement.
bool VectorCombine::scalarizeBinopOrCmp(Instruction &I) {
CmpPredicate Pred = CmpInst::BAD_ICMP_PREDICATE;
Value *Ins0, *Ins1;
if (!match(&I, m_BinOp(m_Value(Ins0), m_Value(Ins1))) &&
- !match(&I, m_Cmp(Pred, m_Value(Ins0), m_Value(Ins1))))
- return false;
+ !match(&I, m_Cmp(Pred, m_Value(Ins0), m_Value(Ins1)))) {
+ // TODO: Allow unary and ternary intrinsics
+ // TODO: Allow intrinsics with different argument types
+ // TODO: Allow intrinsics with scalar arguments
----------------
lukel97 wrote:
I've posted the WIP of this patch that handles n-ary intrinsics here for reference: https://github.com/llvm/llvm-project/pull/138406/commits/2698f8ae3037b77c8625914b44ce4817001f7f99
https://github.com/llvm/llvm-project/pull/138095
More information about the llvm-commits
mailing list