[PATCH] D116333: [RISCV] Initial support for scalable vectorization

Alex via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 28 11:08:12 PST 2021


alextsao1999 updated this revision to Diff 396414.
alextsao1999 added a comment.

fix CI


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116333/new/

https://reviews.llvm.org/D116333

Files:
  llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
  llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h


Index: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
===================================================================
--- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -56,7 +56,6 @@
 
   bool shouldExpandReduction(const IntrinsicInst *II) const;
   bool supportsScalableVectors() const { return ST->hasVInstructions(); }
-  bool enableScalableVectorization() const { return ST->hasVInstructions(); }
   Optional<unsigned> getMaxVScale() const;
 
   TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const {
Index: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -164,10 +164,10 @@
 }
 
 InstructionCost RISCVTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
-                                                 Type *Src,
-                                                 TTI::CastContextHint CCH,
-                                                 TTI::TargetCostKind CostKind,
-                                                 const Instruction *I) {
+                                               Type *Src,
+                                               TTI::CastContextHint CCH,
+                                               TTI::TargetCostKind CostKind,
+                                               const Instruction *I) {
   int ISD = TLI->InstructionOpcodeToISD(Opcode);
   assert(ISD && "Invalid opcode");
 
@@ -187,7 +187,8 @@
 
   if (ISD == ISD::ZERO_EXTEND && SrcTy.isScalableVector() &&
       DstTy.isScalableVector()) {
-    if (SrcTy.isInteger() && DstTy.isInteger()) {
+    if (SrcTy.isInteger() && DstTy.isInteger() &&
+        SrcTy.getVectorElementCount() == DstTy.getVectorElementCount()) {
       if (SrcTy.getScalarSizeInBits() <= DstTy.getScalarSizeInBits()) {
         return 0;
       }
@@ -196,7 +197,6 @@
 
   return AdjustCost(
       BaseT::getCastInstrCost(Opcode, Dst, Src, CCH, CostKind, I));
-
 }
 
 void RISCVTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116333.396414.patch
Type: text/x-patch
Size: 2181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211228/ad119403/attachment.bin>


More information about the llvm-commits mailing list