mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 20:23:39 +08:00
[RISCV][test] Add test for RISCVISAInfo::OrderedExtensionMap ordering
This commit is contained in:
@@ -473,3 +473,22 @@ TEST(ToFeatureVector, UnsupportedExtensionsAreDropped) {
|
||||
ASSERT_THAT_EXPECTED(MaybeISAInfo, Succeeded());
|
||||
EXPECT_THAT((*MaybeISAInfo)->toFeatureVector(), ElementsAre("+m"));
|
||||
}
|
||||
|
||||
TEST(OrderedExtensionMap, ExtensionsAreCorrectlyOrdered) {
|
||||
RISCVISAInfo::OrderedExtensionMap Exts;
|
||||
for (auto ExtName : {"y", "l", "m", "c", "i", "xfoo", "xbar", "sfoo", "sbar",
|
||||
"zmfoo", "zzfoo", "zfinx", "zicsr"})
|
||||
Exts[ExtName] = {1, 0};
|
||||
|
||||
std::vector<std::string> ExtNames;
|
||||
for (const auto &Ext : Exts)
|
||||
ExtNames.push_back(Ext.first);
|
||||
|
||||
// FIXME: z* extensions should be ordered before s* extensions. The current
|
||||
// ordering matches what is documented in RISCVISAInfo, but this doesn't
|
||||
// match the ISA manual.
|
||||
// FIXME: 'l' and 'y' should be ordered after 'i', 'm', 'c'.
|
||||
EXPECT_THAT(ExtNames,
|
||||
ElementsAre("i", "m", "l", "c", "y", "sbar", "sfoo", "zicsr",
|
||||
"zmfoo", "zfinx", "zzfoo", "xbar", "xfoo"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user