[PATCH] D98388: [RISCV][Clang] Add RVV vle/vse intrinsic functions.

Zakk Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 17 08:59:28 PDT 2021


khchen added inline comments.


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:687
+
+    unsigned Skew = 0;
+    if (HasMaskedOffOperand)
----------------
craig.topper wrote:
> ```
> unsigned Skew = HasMaskedOffOperand ? 1 : 0;
> ```
> 
> unless this needs to get more complicated in a future patch?
> 
No. thanks.


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:695
+    // Verify the result of CTypeOrder has legal value.
+    if (std::upper_bound(CTypeOrder.begin(), CTypeOrder.end(),
+                         CTypeOrder.size() - 1) != CTypeOrder.end())
----------------
craig.topper wrote:
> std::upper_bound requires a list to be sorted. It tells you the upper location of where the value belongs in the sorted sequence. std::max_element can tell you the largest value in an unsorted range.
thanks for point out my error.


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:699
+          "The index of PermuteOperand is bigger than the operand number");
+    if (std::unique(CTypeOrder.begin(), CTypeOrder.end()) != CTypeOrder.end())
+      PrintFatalError(
----------------
craig.topper wrote:
> std::unique only compares adjacent values. As far it is concerned "[1, 0, 1]" is unique because the adjacent values are different. To check for duplicates I think you need to sort it first and then you want std::adjacent_find rather than std::unique. std::unique modifies the range and shifts them down. std::adjacent_find just tells you were the duplicate is. Another option is to iterate and use a set to keep track of values you already saw.
thanks, I prefer the latter.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98388



More information about the cfe-commits mailing list