[PATCH] D140460: [RISCV][MC] Add support for experimental zfa extension

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 00:48:53 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h:385
+
+  static std::map<std::pair<int, int>, int> LoadFPImmMap = {
+      {{0b00000001, 0b000}, 1},  {{0b01101111, 0b000}, 2},
----------------
joshua-arch1 wrote:
> joshua-arch1 wrote:
> > craig.topper wrote:
> > > All of the values are in order. Can we use a constexpr array of std::pair<uint8_t, uint8_t> and look it up with std::lower_bound? Once we have the iterator we can use std::distance+1 to convert to 1-31.
> > I'm afraid not. The values in the pair are not in order. 
> > 
> > ```
> > std::lower_bound returns an iterator pointing to the first element in the range [first, last) that is not less than (i.e. greater or equal to) value, or last if no such element is found.
> > ```
> > We cannot choose a value that can help us get the index.
> > 
> I use an array of std::pair<uint8_t, uint8_t> with std::find and std::distance to simplify this function. Thank you for your suggestion.
I thought I checked them which ones aren’t in order?


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

https://reviews.llvm.org/D140460



More information about the llvm-commits mailing list