[llvm] [RISCV] Re-implement Zacas MC layer support to make it usable for CodeGen. (PR #77418)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 00:13:28 PST 2024


================
@@ -2222,6 +2234,48 @@ ParseStatus RISCVAsmParser::parseGPRAsFPR(OperandVector &Operands) {
   return ParseStatus::Success;
 }
 
+template <bool IsRV64>
+ParseStatus RISCVAsmParser::parseGPRPair(OperandVector &Operands) {
+  return parseGPRPair(Operands, IsRV64);
+}
+
+ParseStatus RISCVAsmParser::parseGPRPair(OperandVector &Operands,
+                                         bool IsRV64Inst) {
+  // If this is not an RV64 GPRPair instruction, don't parse as a GPRPair on
+  // RV64 as it will prevent matching the RV64 version of the same instruction
+  // that doesn't use a GPRPair.
+  // If this is an RV64 GPRPair instruction, there is no RV32 version so we can
+  // still parse as a pair.
+  if (!IsRV64Inst && isRV64())
----------------
topperc wrote:

There is an entry for `amocas.w` in the table used by `MatchOperandParserImpl`. The features are not checked before `ParseGPRPair` is called because we pass `ParseForAllFeatures` to `MatchOperandParserImpl`. The IsRV64Inst flag is false when `MatchOperandParserImpl`/`ParseGPRPair` is called for `amocas.w` and true for `amocas.q`. We need to disable this custom parser for `amocas.w` on RV64 so that the regular GPR parsing will happen.

https://github.com/llvm/llvm-project/pull/77418


More information about the llvm-commits mailing list