[llvm] a98f374 - [RISCV] Fix rlist grammar for cm.push, cm.popret, cm.popretz and cm.pop in RISCV zcmp Extension
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 14 10:06:47 PDT 2023
Author: imkiva
Date: 2023-08-15T01:06:41+08:00
New Revision: a98f374eea3135f82da439dbf730012a55c02918
URL: https://github.com/llvm/llvm-project/commit/a98f374eea3135f82da439dbf730012a55c02918
DIFF: https://github.com/llvm/llvm-project/commit/a98f374eea3135f82da439dbf730012a55c02918.diff
LOG: [RISCV] Fix rlist grammar for cm.push, cm.popret, cm.popretz and cm.pop in RISCV zcmp Extension
The register list in the arg string is declared as `{$rlist}`. This patch removes the wrapping curly brackets because of the following:
- Curly brackets are the syntax for variant selection, e.g. given `X = {v0 | v1}`, the result after `CodeGenInstruction::FlattenAsmStringVariants` should be `X[AsmVariantNo]`.
- ARM also supports the register list, and they do not use the bracket wrapper.
- Parse of curly brackets are handled by `RISCVAsmParser::parseReglist`, the brackets in the td file do not correspond to asm syntax. Thus no testcase is affected.
So the curly brackets here are redundant and will become dangerous if RISCV needs more asm parser variants (took me several hours to figure out some wired assertion failures in a downstream fork)
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D157472
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
index b6f1ec7ca74e48..319cd598e54554 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
@@ -131,7 +131,7 @@ class RVZcArith_r<bits<5> funct5, string OpcodeStr> :
class RVInstZcCPPP<bits<5> funct5, string opcodestr>
: RVInst16<(outs), (ins rlist:$rlist, spimm:$spimm),
- opcodestr, "{$rlist}, $spimm", [], InstFormatOther> {
+ opcodestr, "$rlist, $spimm", [], InstFormatOther> {
bits<4> rlist;
bits<16> spimm;
More information about the llvm-commits
mailing list