-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[RISCV] Only allow up to e64 in vsetvli #92010
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
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be 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 If you have received no comments on your PR for a week, you can request a review 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-mc @llvm/pr-subscribers-backend-risc-v Author: Palmer Dabbelt (palmer-dabbelt) ChangesThese larger SEWs aren't in the ratified V spec. Thanks to dzaima and sorear on IRC for pointing this one out. Full diff: https://github.com/llvm/llvm-project/pull/92010.diff 2 Files Affected:
diff --git a/llvm/include/llvm/TargetParser/RISCVTargetParser.h b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
index cdd19189f8dc7..5b1494efe7bdc 100644
--- a/llvm/include/llvm/TargetParser/RISCVTargetParser.h
+++ b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
@@ -61,7 +61,7 @@ enum {
namespace RISCVVType {
// Is this a SEW value that can be encoded into the VTYPE format.
inline static bool isValidSEW(unsigned SEW) {
- return isPowerOf2_32(SEW) && SEW >= 8 && SEW <= 1024;
+ return isPowerOf2_32(SEW) && SEW >= 8 && SEW <= 64;
}
// Is this a LMUL value that can be encoded into the VTYPE format.
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index 123b37442329f..6bdd038bd07e9 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -2227,7 +2227,7 @@ bool RISCVAsmParser::generateVTypeError(SMLoc ErrorLoc) {
return Error(
ErrorLoc,
"operand must be "
- "e[8|16|32|64|128|256|512|1024],m[1|2|4|8|f2|f4|f8],[ta|tu],[ma|mu]");
+ "e[8|16|32|64],m[1|2|4|8|f2|f4|f8],[ta|tu],[ma|mu]");
}
ParseStatus RISCVAsmParser::parseMaskReg(OperandVector &Operands) {
|
66da87d is the commit that first introduced this check which was committed just after V 0.9 (haven't checked if it implemented 0.9 or stuck with 0.8), and up until 1.0 64 < SEW <= 1024 was reserved (see riscvarchive/riscv-v-spec@c32b714). |
Can you add tests to test/MC/RISCV/rvv/invalid.s? I see a test for e2048 in there. I guess we didn't have any tests for e128-e1024. |
These larger SEWs aren't in the ratified V spec. Thanks to dzaima and sorear on IRC for pointing this one out. Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Done. Also I fixed up the errors in those tests (I'm no building/testing this locally, I figured some CI would do it for me). |
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
@palmer-dabbelt I assume you need someone to commit this? |
@palmer-dabbelt Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
These larger SEWs aren't in the ratified V spec. Thanks to dzaima and sorear on IRC for pointing this one out.