[clang] da201aa - [RISCV][NFC] Remove `*=` operator for LMULType

via cfe-commits cfe-commits at lists.llvm.org
Thu May 19 23:47:49 PDT 2022


Author: eopXD
Date: 2022-05-19T23:47:44-07:00
New Revision: da201aa4242ebb06209296962a28f89297d0c9a1

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

LOG: [RISCV][NFC] Remove `*=` operator for LMULType

LMULType always manipulate on Log2LMUL, let all manipulations go
through LMULType::MulLog2LMUL.

Reviewed By: khchen

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

Added: 
    

Modified: 
    clang/include/clang/Support/RISCVVIntrinsicUtils.h
    clang/lib/Support/RISCVVIntrinsicUtils.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
index f1f06ba60786f..2de7f855559f0 100644
--- a/clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -156,7 +156,6 @@ struct LMULType {
   std::string str() const;
   llvm::Optional<unsigned> getScale(unsigned ElementBitwidth) const;
   void MulLog2LMUL(int Log2LMUL);
-  LMULType &operator*=(uint32_t RHS);
 };
 
 class RVVType;

diff  --git a/clang/lib/Support/RISCVVIntrinsicUtils.cpp b/clang/lib/Support/RISCVVIntrinsicUtils.cpp
index 9f5c1ffe20221..43189f6cf9f50 100644
--- a/clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ b/clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -77,12 +77,6 @@ VScaleVal LMULType::getScale(unsigned ElementBitwidth) const {
 
 void LMULType::MulLog2LMUL(int log2LMUL) { Log2LMUL += log2LMUL; }
 
-LMULType &LMULType::operator*=(uint32_t RHS) {
-  assert(isPowerOf2_32(RHS));
-  this->Log2LMUL = this->Log2LMUL + Log2_32(RHS);
-  return *this;
-}
-
 RVVType::RVVType(BasicType BT, int Log2LMUL,
                  const PrototypeDescriptor &prototype)
     : BT(BT), LMUL(LMULType(Log2LMUL)) {
@@ -628,17 +622,17 @@ void RVVType::applyModifier(const PrototypeDescriptor &Transformer) {
   switch (static_cast<VectorTypeModifier>(Transformer.VTM)) {
   case VectorTypeModifier::Widening2XVector:
     ElementBitwidth *= 2;
-    LMUL *= 2;
+    LMUL.MulLog2LMUL(1);
     Scale = LMUL.getScale(ElementBitwidth);
     break;
   case VectorTypeModifier::Widening4XVector:
     ElementBitwidth *= 4;
-    LMUL *= 4;
+    LMUL.MulLog2LMUL(2);
     Scale = LMUL.getScale(ElementBitwidth);
     break;
   case VectorTypeModifier::Widening8XVector:
     ElementBitwidth *= 8;
-    LMUL *= 8;
+    LMUL.MulLog2LMUL(3);
     Scale = LMUL.getScale(ElementBitwidth);
     break;
   case VectorTypeModifier::MaskVector:


        


More information about the cfe-commits mailing list