[llvm] [clang] [RISCV] Add MC layer support for Zicfiss. (PR #66043)

Wang Pengcheng via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 26 05:19:29 PST 2023


================
@@ -0,0 +1,71 @@
+//===------ RISCVInstrInfoZicfiss.td - RISC-V Zicfiss -*- tablegen -*------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+//===----------------------------------------------------------------------===//
+// Instruction class templates
+//===----------------------------------------------------------------------===//
+
+class RVC_SSInst<bits<5> rs1val, RegisterClass reg_class, string opcodestr> :
+  RVInst16<(outs), (ins reg_class:$rs1), opcodestr, "$rs1", [], InstFormatOther> {
+  let Inst{15-13} = 0b011;
+  let Inst{12} = 0;
+  let Inst{11-7} = rs1val;
+  let Inst{6-2} = 0b00000;
+  let Inst{1-0} = 0b01;
+  let DecoderMethod = "decodeCSSPushPopchk";
+}
+
+//===----------------------------------------------------------------------===//
+// Instructions
+//===----------------------------------------------------------------------===//
+
+let Predicates = [HasStdExtZicfiss] in {
+let Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
+def SSPOPCHK : RVInstI<0b100, OPC_SYSTEM, (outs), (ins GPRX1X5:$rs1), "sspopchk",
----------------
wangpc-pp wrote:

I think I don't find any mistake, `sspush` uses `mop.rr` and `sspopchk` uses `mop.r`.
> The 25th bit of sspopchk is 0 but but the 25th bit of all mop.r is 1.

This is wrong as it's `{ bits:  4, name: 0x7 }`, so its value is `0b0111`.

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


More information about the cfe-commits mailing list