[PATCH] D98388: [RISCV][Clang] Add RVV vle/vse intrinsic functions.
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 15 14:02:31 PDT 2021
craig.topper added inline comments.
================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:687
+
+ unsigned Skew = 0;
+ if (HasMaskedOffOperand)
----------------
```
unsigned Skew = HasMaskedOffOperand ? 1 : 0;
```
unless this needs to get more complicated in a future patch?
================
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())
----------------
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.
================
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(
----------------
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.
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