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

Yueh-Ting (eop) Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 19 23:24:02 PDT 2022


eopXD created this revision.
eopXD added reviewers: khchen, kito.cheng.
Herald added subscribers: sunshaoce, VincentWu, luke957, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126042

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


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===================================================================
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -77,12 +77,6 @@
 
 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 @@
   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:
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===================================================================
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -156,7 +156,6 @@
   std::string str() const;
   llvm::Optional<unsigned> getScale(unsigned ElementBitwidth) const;
   void MulLog2LMUL(int Log2LMUL);
-  LMULType &operator*=(uint32_t RHS);
 };
 
 class RVVType;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126042.430884.patch
Type: text/x-patch
Size: 1690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220520/f7d8ddc5/attachment.bin>


More information about the cfe-commits mailing list