Skip to content

Commit 4c0ea47

Browse files
authored
[RISCV] Report error if Zilsd is used on RV64. (#136577)
Fixes #136564.
1 parent 0900661 commit 4c0ea47

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

llvm/lib/TargetParser/RISCVISAInfo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,9 @@ Error RISCVISAInfo::checkDependency() {
789789
return getIncompatibleError("zclsd", "zcf");
790790
}
791791

792+
if (XLen != 32 && Exts.count("zilsd") != 0)
793+
return getError("'zilsd' is only supported for 'rv32'");
794+
792795
for (auto Ext : XqciExts)
793796
if (Exts.count(Ext.str()) && (XLen != 32))
794797
return getError("'" + Twine(Ext) + "'" + " is only supported for 'rv32'");

llvm/unittests/TargetParser/RISCVISAInfoTest.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,16 @@ TEST(ParseArchString, RejectsConflictingExtensions) {
658658
"'xwchc' and 'zcb' extensions are incompatible");
659659
}
660660

661+
for (StringRef Input : {"rv64i_zilsd"}) {
662+
EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
663+
"'zilsd' is only supported for 'rv32'");
664+
}
665+
666+
for (StringRef Input : {"rv64i_zclsd"}) {
667+
EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
668+
"'zclsd' is only supported for 'rv32'");
669+
}
670+
661671
for (StringRef Input : {"rv32i_zcf_zclsd"}) {
662672
EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
663673
"'zclsd' and 'zcf' extensions are incompatible");

0 commit comments

Comments
 (0)