[llvm] 267711e - [RISCV] Fix support of vlen = 64.

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 00:31:40 PST 2022


Author: jacquesguan
Date: 2022-01-26T16:31:21+08:00
New Revision: 267711e38bc7522abd2488a76e998a3a494d51d6

URL: https://github.com/llvm/llvm-project/commit/267711e38bc7522abd2488a76e998a3a494d51d6
DIFF: https://github.com/llvm/llvm-project/commit/267711e38bc7522abd2488a76e998a3a494d51d6.diff

LOG: [RISCV] Fix support of vlen = 64.

In the Zve* extensions, the vlen could be 64. This patch change the vlen constraint of low bound to 64.

Differential Revision: https://reviews.llvm.org/D118217

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVSubtarget.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
index de6b0df2df8a8..976e4ccb14228 100644
--- a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
+++ b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
@@ -149,15 +149,16 @@ unsigned RISCVSubtarget::getMaxRVVVectorSizeInBits() const {
                        "than the Zvl*b limitation");
 
   // FIXME: Change to >= 32 when VLEN = 32 is supported
-  assert(RVVVectorBitsMax >= 64 && RVVVectorBitsMax <= 65536 &&
-         isPowerOf2_32(RVVVectorBitsMax) &&
-         "V extension requires vector length to be in the range of 128 to "
-         "65536 and a power of 2!");
+  assert(
+      RVVVectorBitsMax >= 64 && RVVVectorBitsMax <= 65536 &&
+      isPowerOf2_32(RVVVectorBitsMax) &&
+      "V or Zve* extension requires vector length to be in the range of 64 to "
+      "65536 and a power of 2!");
   assert(RVVVectorBitsMax >= RVVVectorBitsMin &&
          "Minimum V extension vector length should not be larger than its "
          "maximum!");
   unsigned Max = std::max(RVVVectorBitsMin, RVVVectorBitsMax);
-  return PowerOf2Floor((Max < 128 || Max > 65536) ? 0 : Max);
+  return PowerOf2Floor((Max < 64 || Max > 65536) ? 0 : Max);
 }
 
 unsigned RISCVSubtarget::getMinRVVVectorSizeInBits() const {
@@ -170,18 +171,19 @@ unsigned RISCVSubtarget::getMinRVVVectorSizeInBits() const {
   assert(hasVInstructions() &&
          "Tried to get vector length without Zve or V extension support!");
   // FIXME: Change to >= 32 when VLEN = 32 is supported
-  assert((RVVVectorBitsMin == 0 ||
-          (RVVVectorBitsMin >= 64 && RVVVectorBitsMax <= 65536 &&
-           isPowerOf2_32(RVVVectorBitsMin))) &&
-         "V extension requires vector length to be in the range of 128 to "
-         "65536 and a power of 2!");
+  assert(
+      (RVVVectorBitsMin == 0 ||
+       (RVVVectorBitsMin >= 64 && RVVVectorBitsMin <= 65536 &&
+        isPowerOf2_32(RVVVectorBitsMin))) &&
+      "V or Zve* extension requires vector length to be in the range of 64 to "
+      "65536 and a power of 2!");
   assert((RVVVectorBitsMax >= RVVVectorBitsMin || RVVVectorBitsMax == 0) &&
          "Minimum V extension vector length should not be larger than its "
          "maximum!");
   unsigned Min = RVVVectorBitsMin;
   if (RVVVectorBitsMax != 0)
     Min = std::min(RVVVectorBitsMin, RVVVectorBitsMax);
-  return PowerOf2Floor((Min < 128 || Min > 65536) ? 0 : Min);
+  return PowerOf2Floor((Min < 64 || Min > 65536) ? 0 : Min);
 }
 
 unsigned RISCVSubtarget::getMaxLMULForFixedLengthVectors() const {


        


More information about the llvm-commits mailing list