Skip to content

Commit

Permalink
[RISCV] Obey -riscv-v-fixed-length-vector-elen-max when lowering mask…
Browse files Browse the repository at this point in the history
… BUILD_VECTORs.

We may not be allowed to use vXiXLen vectors. Consult ELEN to
determine what is allowed. This will become even more important
when Zve32 is added.

Reviewed By: frasercrmck, arcbbb

Differential Revision: https://reviews.llvm.org/D117518
  • Loading branch information
topperc committed Jan 19, 2022
1 parent c167fa4 commit 4060b81
Show file tree
Hide file tree
Showing 2 changed files with 1,753 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Expand Up @@ -1929,6 +1929,8 @@ static SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
// codegen across RV32 and RV64.
unsigned NumViaIntegerBits =
std::min(std::max(NumElts, 8u), Subtarget.getXLen());
NumViaIntegerBits = std::min(NumViaIntegerBits,
Subtarget.getMaxELENForFixedLengthVectors());
if (ISD::isBuildVectorOfConstantSDNodes(Op.getNode())) {
// If we have to use more than one INSERT_VECTOR_ELT then this
// optimization is likely to increase code size; avoid peforming it in
Expand Down

0 comments on commit 4060b81

Please sign in to comment.