[llvm-branch-commits] [llvm] [RISCV] Support memcmp expansion for vectors (PR #114517)
Luke Lau via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 11 06:16:00 PDT 2025
================
@@ -14520,17 +14520,78 @@ static bool narrowIndex(SDValue &N, ISD::MemIndexType IndexType, SelectionDAG &D
return true;
}
+/// Try to map an integer comparison with size > XLEN to vector instructions
+/// before type legalization splits it up into chunks.
+static SDValue
+combineVectorSizedSetCCEquality(EVT VT, SDValue X, SDValue Y, ISD::CondCode CC,
+ const SDLoc &DL, SelectionDAG &DAG,
+ const RISCVSubtarget &Subtarget) {
+ assert(ISD::isIntEqualitySetCC(CC) && "Bad comparison predicate");
+
+ if (!Subtarget.hasVInstructions())
+ return SDValue();
+
+ MVT XLenVT = Subtarget.getXLenVT();
+ EVT OpVT = X.getValueType();
+ // We're looking for an oversized integer equality comparison.
+ if (OpVT.isScalableVT() || !OpVT.isScalarInteger())
+ return SDValue();
+
+ unsigned OpSize = OpVT.getSizeInBits();
+ // TODO: Support non-power-of-2 types.
+ if (!isPowerOf2_32(OpSize))
+ return SDValue();
----------------
lukel97 wrote:
I think as long as it's byte sized it should be ok right? E.g.
```suggestion
if (OpSize % 8)
return SDValue();
```
But happy if you want to leave this as is and do it as a follow on with the TODO in RISCVTargetTransformInfo.cpp
https://github.com/llvm/llvm-project/pull/114517
More information about the llvm-branch-commits
mailing list