-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RISCV] Make Zcmt imply Zicsr. #75464
Conversation
This patch fixes build attributes w/r to Zcmt extension dependency on Zicsr.
@llvm/pr-subscribers-llvm-support @llvm/pr-subscribers-backend-risc-v Author: None (yroux) ChangesThis patch fixes build attributes w/r to Zcmt extension dependency on Zicsr. Full diff: https://github.com/llvm/llvm-project/pull/75464.diff 3 Files Affected:
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 85c34dd6206307..5b06d790f83644 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -1006,7 +1006,7 @@ static const char *ImpliedExtsZcd[] = {"d", "zca"};
static const char *ImpliedExtsZce[] = {"zcb", "zcmp", "zcmt"};
static const char *ImpliedExtsZcf[] = {"f", "zca"};
static const char *ImpliedExtsZcmp[] = {"zca"};
-static const char *ImpliedExtsZcmt[] = {"zca"};
+static const char *ImpliedExtsZcmt[] = {"zca", "zicsr"};
static const char *ImpliedExtsZdinx[] = {"zfinx"};
static const char *ImpliedExtsZfa[] = {"f"};
static const char *ImpliedExtsZfbfmin[] = {"f"};
diff --git a/llvm/test/MC/RISCV/attribute-arch.s b/llvm/test/MC/RISCV/attribute-arch.s
index 3ed48401e43fc8..66311c8c1e6df4 100644
--- a/llvm/test/MC/RISCV/attribute-arch.s
+++ b/llvm/test/MC/RISCV/attribute-arch.s
@@ -244,7 +244,7 @@
# CHECK: attribute 5, "rv32i2p1_zca1p0_zcmp1p0"
.attribute arch, "rv32izcmt1p0"
-# CHECK: attribute 5, "rv32i2p1_zca1p0_zcmt1p0"
+# CHECK: attribute 5, "rv32i2p1_zicsr2p0_zca1p0_zcmt1p0"
.attribute arch, "rv64i_xsfvcp"
# CHECK: attribute 5, "rv64i2p1_zicsr2p0_zve32x1p0_zvl32b1p0_xsfvcp1p0"
diff --git a/llvm/unittests/Support/RISCVISAInfoTest.cpp b/llvm/unittests/Support/RISCVISAInfoTest.cpp
index 3de14907899eb6..ef83c3f7ef6b24 100644
--- a/llvm/unittests/Support/RISCVISAInfoTest.cpp
+++ b/llvm/unittests/Support/RISCVISAInfoTest.cpp
@@ -519,8 +519,9 @@ TEST(ParseArchString, ZceImplication) {
ASSERT_THAT_EXPECTED(MaybeRV32IZce, Succeeded());
RISCVISAInfo::OrderedExtensionMap ExtsRV32IZce =
(*MaybeRV32IZce)->getExtensions();
- EXPECT_EQ(ExtsRV32IZce.size(), 6UL);
+ EXPECT_EQ(ExtsRV32IZce.size(), 7UL);
EXPECT_EQ(ExtsRV32IZce.count("i"), 1U);
+ EXPECT_EQ(ExtsRV32IZce.count("zicsr"), 1U);
EXPECT_EQ(ExtsRV32IZce.count("zca"), 1U);
EXPECT_EQ(ExtsRV32IZce.count("zcb"), 1U);
EXPECT_EQ(ExtsRV32IZce.count("zce"), 1U);
@@ -562,8 +563,9 @@ TEST(ParseArchString, ZceImplication) {
ASSERT_THAT_EXPECTED(MaybeRV64IZce, Succeeded());
RISCVISAInfo::OrderedExtensionMap ExtsRV64IZce =
(*MaybeRV64IZce)->getExtensions();
- EXPECT_EQ(ExtsRV64IZce.size(), 6UL);
+ EXPECT_EQ(ExtsRV64IZce.size(), 7UL);
EXPECT_EQ(ExtsRV64IZce.count("i"), 1U);
+ EXPECT_EQ(ExtsRV64IZce.count("zicsr"), 1U);
EXPECT_EQ(ExtsRV64IZce.count("zca"), 1U);
EXPECT_EQ(ExtsRV64IZce.count("zcb"), 1U);
EXPECT_EQ(ExtsRV64IZce.count("zce"), 1U);
|
LGTM But I'm curious why Zcmt depends on Zicsr, does register jvt need to be defined in Zicsr? Because I'm not familiar with Zicsr |
I'm not really familiar with Zicsr either, but yes it is written in the Zcmt JVT CSR description that:
which implies that Zicsr is required. The full discussion on the relationship between Zcmt and Zicsr is available in this issue: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This patch fixes build attributes w/r to Zcmt extension dependency on Zicsr.