1 //===------ RISCVInstrInfoZicfiss.td - RISC-V Zicfiss -*- tablegen -*------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
10 // Instruction class templates
11 //===----------------------------------------------------------------------===//
13 class RVC_SSInst<bits<5> rs1val, RegisterClass reg_class, string opcodestr> :
14 RVInst16<(outs), (ins reg_class:$rs1), opcodestr, "$rs1", [], InstFormatOther> {
15 let Inst{15-13} = 0b011;
17 let Inst{11-7} = rs1val;
18 let Inst{6-2} = 0b00000;
20 let DecoderMethod = "decodeCSSPushPopchk";
23 //===----------------------------------------------------------------------===//
25 //===----------------------------------------------------------------------===//
27 let Predicates = [HasStdExtZicfiss] in {
28 let Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
29 def SSPOPCHK : RVInstI<0b100, OPC_SYSTEM, (outs), (ins GPRX1X5:$rs1), "sspopchk",
32 let imm12 = 0b110011011100;
33 } // Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 1, mayStore = 0
35 let Uses = [SSP], hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
36 def SSRDP : RVInstI<0b100, OPC_SYSTEM, (outs GPRNoX0:$rd), (ins), "ssrdp", "$rd"> {
37 let imm12 = 0b110011011100;
40 } // Uses = [SSP], hasSideEffects = 0, mayLoad = 0, mayStore = 0
42 let Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
43 def SSPUSH : RVInstR<0b1100111, 0b100, OPC_SYSTEM, (outs), (ins GPRX1X5:$rs2),
48 } // Predicates = [HasStdExtZicfiss]
50 let Predicates = [HasStdExtZicfiss, HasStdExtZcmop],
51 DecoderNamespace = "Zicfiss" in {
52 let Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
53 def C_SSPUSH : RVC_SSInst<0b00001, GPRX1, "c.sspush">;
55 let Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
56 def C_SSPOPCHK : RVC_SSInst<0b00101, GPRX5, "c.sspopchk">;
57 } // Predicates = [HasStdExtZicfiss, HasStdExtZcmop]
59 let Predicates = [HasStdExtZicfiss] in
60 defm SSAMOSWAP_W : AMO_rr_aq_rl<0b01001, 0b010, "ssamoswap.w">;
62 let Predicates = [HasStdExtZicfiss, IsRV64] in
63 defm SSAMOSWAP_D : AMO_rr_aq_rl<0b01001, 0b011, "ssamoswap.d">;
65 //===----------------------------------------------------------------------===/
66 // Compress Instruction tablegen backend.
67 //===----------------------------------------------------------------------===//
69 let Predicates = [HasStdExtZicfiss, HasStdExtZcmop] in {
70 def : CompressPat<(SSPUSH X1), (C_SSPUSH X1)>;
71 def : CompressPat<(SSPOPCHK X5), (C_SSPOPCHK X5)>;
72 } // Predicates = [HasStdExtZicfiss, HasStdExtZcmop]