@@ -73,6 +73,22 @@ def frmarg : Operand<XLenVT> {
73
73
// Instruction class templates
74
74
//===----------------------------------------------------------------------===//
75
75
76
+ let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
77
+ class FPLoad_r<bits<3> funct3, string opcodestr, RegisterClass rty,
78
+ SchedWrite sw>
79
+ : RVInstI<funct3, OPC_LOAD_FP, (outs rty:$rd),
80
+ (ins GPR:$rs1, simm12:$imm12),
81
+ opcodestr, "$rd, ${imm12}(${rs1})">,
82
+ Sched<[sw, ReadFMemBase]>;
83
+
84
+ let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
85
+ class FPStore_r<bits<3> funct3, string opcodestr, RegisterClass rty,
86
+ SchedWrite sw>
87
+ : RVInstS<funct3, OPC_STORE_FP, (outs),
88
+ (ins rty:$rs2, GPR:$rs1, simm12:$imm12),
89
+ opcodestr, "$rs2, ${imm12}(${rs1})">,
90
+ Sched<[sw, ReadStoreData, ReadFMemBase]>;
91
+
76
92
let hasSideEffects = 0, mayLoad = 0, mayStore = 0, mayRaiseFPException = 1,
77
93
UseNamedOperandTable = 1, hasPostISelHook = 1 in
78
94
class FPFMA_rrr_frm<RISCVOpcode opcode, bits<2> funct2, string opcodestr,
@@ -138,20 +154,12 @@ class FPCmp_rr<bits<7> funct7, bits<3> funct3, string opcodestr,
138
154
//===----------------------------------------------------------------------===//
139
155
140
156
let Predicates = [HasStdExtF] in {
141
- let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
142
- def FLW : RVInstI<0b010, OPC_LOAD_FP, (outs FPR32:$rd),
143
- (ins GPR:$rs1, simm12:$imm12),
144
- "flw", "$rd, ${imm12}(${rs1})">,
145
- Sched<[WriteFLD32, ReadFMemBase]>;
157
+ def FLW : FPLoad_r<0b010, "flw", FPR32, WriteFLD32>;
146
158
147
159
// Operands for stores are in the order srcreg, base, offset rather than
148
160
// reflecting the order these fields are specified in the instruction
149
161
// encoding.
150
- let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
151
- def FSW : RVInstS<0b010, OPC_STORE_FP, (outs),
152
- (ins FPR32:$rs2, GPR:$rs1, simm12:$imm12),
153
- "fsw", "$rs2, ${imm12}(${rs1})">,
154
- Sched<[WriteFST32, ReadStoreData, ReadFMemBase]>;
162
+ def FSW : FPStore_r<0b010, "fsw", FPR32, WriteFST32>;
155
163
156
164
let SchedRW = [WriteFMA32, ReadFMA32, ReadFMA32, ReadFMA32] in {
157
165
def FMADD_S : FPFMA_rrr_frm<OPC_MADD, 0b00, "fmadd.s", FPR32>;
0 commit comments