[clang] [compiler-rt] [llvm] [RISCV] Support new groupid/bitmask for cpu_model (PR #101632)
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 7 09:46:25 PDT 2024
================
@@ -1056,24 +1056,12 @@ constexpr static RISCVExtBit RISCVBitPositions[] = {
{"zcf", 1, 5}, {"zcmop", 1, 6},
{"zawrs", 1, 7}};
-int RISCVISAInfo::getRISCVFeaturesBitPosition(StringRef Ext) {
+std::pair<int, int> RISCVISAInfo::getRISCVFeaturesBitsInfo(StringRef Ext) {
// Note that this code currently accepts mixed case extension names, but
// does not handle extension versions at all. That's probably fine because
// there's only one extension version in the __riscv_feature_bits vector.
for (auto E : RISCVBitPositions)
if (E.ext.equals_insensitive(Ext))
- return E.bitpos;
- return -1;
-}
-
-// TODO: merge getRISCVFeaturesBitPosition and getRISCVFeaturesGroupID into
-// single function.
-int RISCVISAInfo::getRISCVFeaturesGroupID(StringRef Ext) {
- // Note that this code currently accepts mixed case extension names, but
- // does not handle extension versions at all. That's probably fine because
- // there's only one extension version in the __riscv_feature_bits vector.
- for (auto E : RISCVBitPositions)
- if (E.ext.equals_insensitive(Ext))
- return E.groupid;
- return -1;
+ return std::make_pair<int, int>(E.groupid, E.bitpos);
----------------
topperc wrote:
Does `std::make_pair(E.groupid, E.bitpos)` work? If you have to write `<int, int>` then make_pair isn't doing its job.
https://github.com/llvm/llvm-project/pull/101632
More information about the cfe-commits
mailing list