-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[RISCV] Allocate feature bits for Zifencei and Zmmul #143306
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Luke Wren <[email protected]>
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-backend-risc-v Author: Luke Wren (Wren6991) ChangesAs proposed in riscv-non-isa/riscv-c-api-doc#110. No real compiler-rt implementation as Linux does not list these extensions in hwprobe. Full diff: https://github.com/llvm/llvm-project/pull/143306.diff 2 Files Affected:
diff --git a/compiler-rt/lib/builtins/cpu_model/riscv.c b/compiler-rt/lib/builtins/cpu_model/riscv.c
index 4d0fda473c87e..5a334a122583a 100644
--- a/compiler-rt/lib/builtins/cpu_model/riscv.c
+++ b/compiler-rt/lib/builtins/cpu_model/riscv.c
@@ -134,6 +134,10 @@ struct {
#define ZCLSD_BITMASK (1ULL << 9)
#define ZCMP_GROUPID 1
#define ZCMP_BITMASK (1ULL << 10)
+#define ZIFENCEI_GROUPID 1
+#define ZIFENCEI_BITMASK (1ULL << 11)
+#define ZMMUL_GROUPID 1
+#define ZMMUL_BITMASK (1ULL << 12)
#if defined(__linux__)
diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td
index 690068d05aaab..c756d5cb76eee 100644
--- a/llvm/lib/Target/RISCV/RISCVFeatures.td
+++ b/llvm/lib/Target/RISCV/RISCVFeatures.td
@@ -134,7 +134,8 @@ def HasStdExtZicond : Predicate<"Subtarget->hasStdExtZicond()">,
"(Integer Conditional Operations)">;
def FeatureStdExtZifencei
- : RISCVExtension<2, 0, "fence.i">;
+ : RISCVExtension<2, 0, "fence.i">,
+ RISCVExtensionBitmask<1, 11>;
def HasStdExtZifencei : Predicate<"Subtarget->hasStdExtZifencei()">,
AssemblerPredicate<(all_of FeatureStdExtZifencei),
"'Zifencei' (fence.i)">;
@@ -192,7 +193,8 @@ def NoHasStdExtZilsd : Predicate<"!Subtarget->hasStdExtZilsd()">;
// Multiply Extensions
def FeatureStdExtZmmul
- : RISCVExtension<1, 0, "Integer Multiplication">;
+ : RISCVExtension<1, 0, "Integer Multiplication">,
+ RISCVExtensionBitmask<1, 12>;
def HasStdExtZmmul : Predicate<"Subtarget->hasStdExtZmmul()">,
AssemblerPredicate<(all_of FeatureStdExtZmmul),
"'Zmmul' (Integer Multiplication)">;
|
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 assuming the c-api-doc PR is approved
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
As proposed in riscv-non-isa/riscv-c-api-doc#110.
No real compiler-rt implementation as Linux does not list these extensions in hwprobe.