[llvm] [RISCV] Use slideup to lower build_vector when its last operand is an extraction (PR #154450)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 21 11:07:28 PDT 2025
================
@@ -4512,42 +4512,98 @@ static SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
"Illegal type which will result in reserved encoding");
const unsigned Policy = RISCVVType::TAIL_AGNOSTIC | RISCVVType::MASK_AGNOSTIC;
+ auto getVSlide = [&](bool SlideUp, EVT ContainerVT, SDValue Passthru,
+ SDValue Vec, SDValue Offset, SDValue Mask,
+ SDValue VL) -> SDValue {
+ if (SlideUp)
+ return getVSlideup(DAG, Subtarget, DL, ContainerVT, Passthru, Vec, Offset,
+ Mask, VL, Policy);
+ return getVSlidedown(DAG, Subtarget, DL, ContainerVT, Passthru, Vec, Offset,
+ Mask, VL, Policy);
+ };
+
+ // General case: splat the first operand and slide other operands down one
+ // by one to form a vector. Alternatively, if the last operand is an
+ // extraction from element 0 of a vector, we can use the original vector
+ // reduction result as the start value and slide up instead of slide down.
----------------
mshockwave wrote:
Fixed
https://github.com/llvm/llvm-project/pull/154450
More information about the llvm-commits
mailing list