RISCVInstrInfoZicbo.td 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //===-- RISCVInstrInfoZicbo.td - RISC-V CMO instructions ---*- 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. // This file describes the RISC-V instructions from the standard Base Cache
  10. // Management Operation ISA Extensions document (Zicbom, Zicboz, and Zicbop).
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //===----------------------------------------------------------------------===//
  14. // Operand definitions.
  15. //===----------------------------------------------------------------------===//
  16. // A 12-bit signed immediate where the least significant five bits are zero.
  17. def simm12_lsb00000 : Operand<XLenVT>,
  18. ImmLeaf<XLenVT, [{return isShiftedInt<7, 5>(Imm);}]> {
  19. let ParserMatchClass = SImmAsmOperand<12, "Lsb00000">;
  20. let EncoderMethod = "getImmOpValue";
  21. let DecoderMethod = "decodeSImmOperand<12>";
  22. let MCOperandPredicate = [{
  23. int64_t Imm;
  24. if (MCOp.evaluateAsConstantImm(Imm))
  25. return isShiftedInt<7, 5>(Imm);
  26. return MCOp.isBareSymbolRef();
  27. }];
  28. let OperandType = "OPERAND_SIMM12_LSB00000";
  29. let OperandNamespace = "RISCVOp";
  30. }
  31. //===----------------------------------------------------------------------===//
  32. // Instruction Class Templates
  33. //===----------------------------------------------------------------------===//
  34. let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
  35. class CBO_r<bits<12> optype, string opcodestr>
  36. : RVInstI<0b010, OPC_MISC_MEM, (outs), (ins GPRMemZeroOffset:$rs1),
  37. opcodestr, "$rs1"> {
  38. let imm12 = optype;
  39. let rd = 0b00000;
  40. }
  41. let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
  42. class Prefetch_ri<bits<5> optype, string opcodestr>
  43. : RVInstS<0b110, OPC_OP_IMM, (outs), (ins GPR:$rs1, simm12_lsb00000:$imm12),
  44. opcodestr, "${imm12}(${rs1})"> {
  45. let Inst{11-7} = 0b00000;
  46. let rs2 = optype;
  47. }
  48. //===----------------------------------------------------------------------===//
  49. // Instructions
  50. //===----------------------------------------------------------------------===//
  51. let Predicates = [HasStdExtZicbom] in {
  52. def CBO_CLEAN : CBO_r<0b000000000001, "cbo.clean">, Sched<[]>;
  53. def CBO_FLUSH : CBO_r<0b000000000010, "cbo.flush">, Sched<[]>;
  54. def CBO_INVAL : CBO_r<0b000000000000, "cbo.inval">, Sched<[]>;
  55. } // Predicates = [HasStdExtZicbom]
  56. let Predicates = [HasStdExtZicboz] in {
  57. def CBO_ZERO : CBO_r<0b000000000100, "cbo.zero">, Sched<[]>;
  58. } // Predicates = [HasStdExtZicboz]
  59. let Predicates = [HasStdExtZicbop] in {
  60. def PREFETCH_I : Prefetch_ri<0b00000, "prefetch.i">, Sched<[]>;
  61. def PREFETCH_R : Prefetch_ri<0b00001, "prefetch.r">, Sched<[]>;
  62. def PREFETCH_W : Prefetch_ri<0b00011, "prefetch.w">, Sched<[]>;
  63. } // Predicates = [HasStdExtZicbop]