Skip to content

Commit

Permalink
[RISCV][TTI] Implement instruction cost for vp_merge. (llvm#112327)
Browse files Browse the repository at this point in the history
This patch implement the instruction for `vp_merge`, which will generate
similar instruction sequence to the `select` instruction.
  • Loading branch information
ElvisWang123 authored Oct 16, 2024
1 parent 1834660 commit 566012a
Show file tree
Hide file tree
Showing 2 changed files with 185 additions and 1 deletion.
6 changes: 5 additions & 1 deletion llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,10 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
return getCmpSelInstrCost(*FOp, ICA.getReturnType(), ICA.getArgTypes()[0],
CmpInst::BAD_ICMP_PREDICATE, CostKind);
}
case Intrinsic::vp_merge:
return getCmpSelInstrCost(Instruction::Select, ICA.getReturnType(),
ICA.getArgTypes()[0], CmpInst::BAD_ICMP_PREDICATE,
CostKind);
}

if (ST->hasVInstructions() && RetTy->isVectorTy()) {
Expand Down Expand Up @@ -2429,4 +2433,4 @@ bool RISCVTTIImpl::isProfitableToSinkOperands(
Ops.push_back(&OpIdx.value());
}
return true;
}
}
Loading

0 comments on commit 566012a

Please sign in to comment.