1*700637cbSDimitry Andric//===-- RISCVInstrInfoZclsd.td -----------------------------*- tablegen -*-===// 2*700637cbSDimitry Andric// 3*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*700637cbSDimitry Andric// 7*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 8*700637cbSDimitry Andric// 9*700637cbSDimitry Andric// This file describes the RISC-V instructions from the standard 'Zclsd', 10*700637cbSDimitry Andric// Compressed Load/Store pair instructions extension. 11*700637cbSDimitry Andric// 12*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 13*700637cbSDimitry Andric 14*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 15*700637cbSDimitry Andric// Instruction Class Templates 16*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 17*700637cbSDimitry Andric 18*700637cbSDimitry Andricdef GPRPairNoX0RV32Operand : AsmOperandClass { 19*700637cbSDimitry Andric let Name = "GPRPairNoX0RV32"; 20*700637cbSDimitry Andric let ParserMethod = "parseGPRPair<false>"; 21*700637cbSDimitry Andric let PredicateMethod = "isGPRPairNoX0"; 22*700637cbSDimitry Andric let RenderMethod = "addRegOperands"; 23*700637cbSDimitry Andric} 24*700637cbSDimitry Andric 25*700637cbSDimitry Andricdef GPRPairNoX0RV32 : RegisterOperand<GPRPairNoX0> { 26*700637cbSDimitry Andric let ParserMatchClass = GPRPairNoX0RV32Operand; 27*700637cbSDimitry Andric} 28*700637cbSDimitry Andric 29*700637cbSDimitry Andricdef GPRPairCRV32Operand : AsmOperandClass { 30*700637cbSDimitry Andric let Name = "GPRPairCRV32"; 31*700637cbSDimitry Andric let ParserMethod = "parseGPRPair<false>"; 32*700637cbSDimitry Andric let PredicateMethod = "isGPRPairC"; 33*700637cbSDimitry Andric let RenderMethod = "addRegOperands"; 34*700637cbSDimitry Andric} 35*700637cbSDimitry Andric 36*700637cbSDimitry Andricdef GPRPairCRV32 : RegisterOperand<GPRPairC> { 37*700637cbSDimitry Andric let ParserMatchClass = GPRPairCRV32Operand; 38*700637cbSDimitry Andric} 39*700637cbSDimitry Andric 40*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 41*700637cbSDimitry Andric// Instructions 42*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 43*700637cbSDimitry Andric 44*700637cbSDimitry Andriclet Predicates = [HasStdExtZclsd, IsRV32], DecoderNamespace = "ZcOverlap" in { 45*700637cbSDimitry Andricdef C_LDSP_RV32 : CStackLoad<0b011, "c.ldsp", GPRPairNoX0RV32, uimm9_lsb000>, 46*700637cbSDimitry Andric Sched<[WriteLDD, ReadMemBase]> { 47*700637cbSDimitry Andric let Inst{4-2} = imm{8-6}; 48*700637cbSDimitry Andric} 49*700637cbSDimitry Andric 50*700637cbSDimitry Andricdef C_SDSP_RV32 : CStackStore<0b111, "c.sdsp", GPRPairRV32, uimm9_lsb000>, 51*700637cbSDimitry Andric Sched<[WriteSTD, ReadStoreData, ReadMemBase]> { 52*700637cbSDimitry Andric let Inst{9-7} = imm{8-6}; 53*700637cbSDimitry Andric} 54*700637cbSDimitry Andric 55*700637cbSDimitry Andricdef C_LD_RV32 : CLoad_ri<0b011, "c.ld", GPRPairCRV32, uimm8_lsb000>, 56*700637cbSDimitry Andric Sched<[WriteLDD, ReadMemBase]> { 57*700637cbSDimitry Andric bits<8> imm; 58*700637cbSDimitry Andric let Inst{12-10} = imm{5-3}; 59*700637cbSDimitry Andric let Inst{6-5} = imm{7-6}; 60*700637cbSDimitry Andric} 61*700637cbSDimitry Andric 62*700637cbSDimitry Andricdef C_SD_RV32 : CStore_rri<0b111, "c.sd", GPRPairCRV32, uimm8_lsb000>, 63*700637cbSDimitry Andric Sched<[WriteSTD, ReadStoreData, ReadMemBase]> { 64*700637cbSDimitry Andric bits<8> imm; 65*700637cbSDimitry Andric let Inst{12-10} = imm{5-3}; 66*700637cbSDimitry Andric let Inst{6-5} = imm{7-6}; 67*700637cbSDimitry Andric} 68*700637cbSDimitry Andric}// Predicates = [HasStdExtZclsd, IsRV32], DecoderNamespace = "ZcOverlap" 69*700637cbSDimitry Andric 70*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 71*700637cbSDimitry Andric// Assembler Pseudo Instructions 72*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 73*700637cbSDimitry Andric 74*700637cbSDimitry Andriclet Predicates = [HasStdExtZclsd, IsRV32] in { 75*700637cbSDimitry Andricdef : InstAlias<"c.ld $rd, (${rs1})", 76*700637cbSDimitry Andric (C_LD_RV32 GPRPairCRV32:$rd, GPRCMem:$rs1, 0), 0>; 77*700637cbSDimitry Andricdef : InstAlias<"c.sd $rs2, (${rs1})", 78*700637cbSDimitry Andric (C_SD_RV32 GPRPairCRV32:$rs2, GPRCMem:$rs1, 0), 0>; 79*700637cbSDimitry Andricdef : InstAlias<"c.ldsp $rd, (${rs1})", 80*700637cbSDimitry Andric (C_LDSP_RV32 GPRPairNoX0RV32:$rd, SPMem:$rs1, 0), 0>; 81*700637cbSDimitry Andricdef : InstAlias<"c.sdsp $rs2, (${rs1})", 82*700637cbSDimitry Andric (C_SDSP_RV32 GPRPairRV32:$rs2, SPMem:$rs1, 0), 0>; 83*700637cbSDimitry Andric} 84*700637cbSDimitry Andric 85*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 86*700637cbSDimitry Andric// Compress Instruction tablegen backend. 87*700637cbSDimitry Andric//===----------------------------------------------------------------------===// 88*700637cbSDimitry Andric 89*700637cbSDimitry Andriclet Predicates = [HasStdExtZclsd, IsRV32] in { 90*700637cbSDimitry Andricdef : CompressPat<(LD_RV32 GPRPairNoX0RV32:$rd, SPMem:$rs1, uimm9_lsb000:$imm), 91*700637cbSDimitry Andric (C_LDSP_RV32 GPRPairNoX0RV32:$rd, SPMem:$rs1, uimm9_lsb000:$imm)>; 92*700637cbSDimitry Andricdef : CompressPat<(SD_RV32 GPRPairRV32:$rs2, SPMem:$rs1, uimm9_lsb000:$imm), 93*700637cbSDimitry Andric (C_SDSP_RV32 GPRPairRV32:$rs2, SPMem:$rs1, uimm9_lsb000:$imm)>; 94*700637cbSDimitry Andricdef : CompressPat<(LD_RV32 GPRPairCRV32:$rd, GPRCMem:$rs1, uimm8_lsb000:$imm), 95*700637cbSDimitry Andric (C_LD_RV32 GPRPairCRV32:$rd, GPRCMem:$rs1, uimm8_lsb000:$imm)>; 96*700637cbSDimitry Andricdef : CompressPat<(SD_RV32 GPRPairCRV32:$rs2, GPRCMem:$rs1, uimm8_lsb000:$imm), 97*700637cbSDimitry Andric (C_SD_RV32 GPRPairCRV32:$rs2, GPRCMem:$rs1, uimm8_lsb000:$imm)>; 98*700637cbSDimitry Andric} // Predicates = [HasStdExtZclsd, IsRV32] 99