xref: /freebsd/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoZicfiss.td (revision 1db9f3b21e39176dd5b67cf8ac378633b172463e)
1//===------ RISCVInstrInfoZicfiss.td - RISC-V Zicfiss -*- tablegen -*------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Instruction class templates
11//===----------------------------------------------------------------------===//
12
13class 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;
16  let Inst{12} = 0;
17  let Inst{11-7} = rs1val;
18  let Inst{6-2} = 0b00000;
19  let Inst{1-0} = 0b01;
20  let DecoderMethod = "decodeCSSPushPopchk";
21}
22
23//===----------------------------------------------------------------------===//
24// Instructions
25//===----------------------------------------------------------------------===//
26
27let Predicates = [HasStdExtZicfiss] in {
28let Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
29def SSPOPCHK : RVInstI<0b100, OPC_SYSTEM, (outs), (ins GPRX1X5:$rs1), "sspopchk",
30                       "$rs1"> {
31  let rd = 0;
32  let imm12 = 0b110011011100;
33} // Uses = [SSP],  Defs = [SSP], hasSideEffects = 0, mayLoad = 1, mayStore = 0
34
35let Uses = [SSP], hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
36def SSRDP : RVInstI<0b100, OPC_SYSTEM, (outs GPRNoX0:$rd), (ins), "ssrdp", "$rd"> {
37  let imm12 = 0b110011011100;
38  let rs1 = 0b00000;
39}
40} // Uses = [SSP], hasSideEffects = 0, mayLoad = 0, mayStore = 0
41
42let Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
43def SSPUSH : RVInstR<0b1100111, 0b100, OPC_SYSTEM, (outs), (ins GPRX1X5:$rs2),
44                     "sspush", "$rs2"> {
45  let rd = 0b00000;
46  let rs1 = 0b00000;
47}
48} // Predicates = [HasStdExtZicfiss]
49
50let Predicates = [HasStdExtZicfiss, HasStdExtZcmop],
51    DecoderNamespace = "Zicfiss" in {
52let Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
53def C_SSPUSH : RVC_SSInst<0b00001, GPRX1, "c.sspush">;
54
55let Uses = [SSP], Defs = [SSP], hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
56def C_SSPOPCHK : RVC_SSInst<0b00101, GPRX5, "c.sspopchk">;
57} // Predicates = [HasStdExtZicfiss, HasStdExtZcmop]
58
59let Predicates = [HasStdExtZicfiss] in
60defm SSAMOSWAP_W  : AMO_rr_aq_rl<0b01001, 0b010, "ssamoswap.w">;
61
62let Predicates = [HasStdExtZicfiss, IsRV64] in
63defm SSAMOSWAP_D  : AMO_rr_aq_rl<0b01001, 0b011, "ssamoswap.d">;
64
65//===----------------------------------------------------------------------===/
66// Compress Instruction tablegen backend.
67//===----------------------------------------------------------------------===//
68
69let Predicates = [HasStdExtZicfiss, HasStdExtZcmop] in {
70def : CompressPat<(SSPUSH X1), (C_SSPUSH X1)>;
71def : CompressPat<(SSPOPCHK X5), (C_SSPOPCHK X5)>;
72} // Predicates = [HasStdExtZicfiss, HasStdExtZcmop]
73