v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
base-assembler-riscv.cc
Go to the documentation of this file.
1// Copyright (c) 1994-2006 Sun Microsystems Inc.
2// All Rights Reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met:
7//
8// - Redistributions of source code must retain the above copyright notice,
9// this list of conditions and the following disclaimer.
10//
11// - Redistribution in binary form must reproduce the above copyright
12// notice, this list of conditions and the following disclaimer in the
13// documentation and/or other materials provided with the distribution.
14//
15// - Neither the name of Sun Microsystems or the names of contributors may
16// be used to endorse or promote products derived from this software without
17// specific prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31// The original source code covered by the above license above has been
32// modified significantly by Google Inc.
33// Copyright 2021 the V8 project authors. All rights reserved.
34
36
37#include "src/base/cpu.h"
38
39namespace v8 {
40namespace internal {
41
42// ----- Top-level instruction formats match those in the ISA manual
43// (R, I, S, B, U, J). These match the formats defined in the compiler
44void AssemblerRiscvBase::GenInstrR(uint8_t funct7, uint8_t funct3,
45 BaseOpcode opcode, Register rd, Register rs1,
46 Register rs2) {
47 DCHECK(is_uint7(funct7) && is_uint3(funct3) && rd.is_valid() &&
48 rs1.is_valid() && rs2.is_valid());
49 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
50 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
51 (funct7 << kFunct7Shift);
52 emit(instr);
53}
54
55void AssemblerRiscvBase::GenInstrR(uint8_t funct7, uint8_t funct3,
56 BaseOpcode opcode, FPURegister rd,
57 FPURegister rs1, FPURegister rs2) {
58 DCHECK(is_uint7(funct7) && is_uint3(funct3) && rd.is_valid() &&
59 rs1.is_valid() && rs2.is_valid());
60 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
61 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
62 (funct7 << kFunct7Shift);
63 emit(instr);
64}
65
66void AssemblerRiscvBase::GenInstrR(uint8_t funct7, uint8_t funct3,
67 BaseOpcode opcode, Register rd,
68 FPURegister rs1, Register rs2) {
69 DCHECK(is_uint7(funct7) && is_uint3(funct3) && rd.is_valid() &&
70 rs1.is_valid() && rs2.is_valid());
71 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
72 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
73 (funct7 << kFunct7Shift);
74 emit(instr);
75}
76
77void AssemblerRiscvBase::GenInstrR(uint8_t funct7, uint8_t funct3,
78 BaseOpcode opcode, FPURegister rd,
79 Register rs1, Register rs2) {
80 DCHECK(is_uint7(funct7) && is_uint3(funct3) && rd.is_valid() &&
81 rs1.is_valid() && rs2.is_valid());
82 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
83 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
84 (funct7 << kFunct7Shift);
85 emit(instr);
86}
87
88void AssemblerRiscvBase::GenInstrR(uint8_t funct7, uint8_t funct3,
89 BaseOpcode opcode, FPURegister rd,
90 FPURegister rs1, Register rs2) {
91 DCHECK(is_uint7(funct7) && is_uint3(funct3) && rd.is_valid() &&
92 rs1.is_valid() && rs2.is_valid());
93 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
94 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
95 (funct7 << kFunct7Shift);
96 emit(instr);
97}
98
99void AssemblerRiscvBase::GenInstrR(uint8_t funct7, uint8_t funct3,
100 BaseOpcode opcode, Register rd,
101 FPURegister rs1, FPURegister rs2) {
102 DCHECK(is_uint7(funct7) && is_uint3(funct3) && rd.is_valid() &&
103 rs1.is_valid() && rs2.is_valid());
104 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
105 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
106 (funct7 << kFunct7Shift);
107 emit(instr);
108}
109
110void AssemblerRiscvBase::GenInstrR4(uint8_t funct2, BaseOpcode opcode,
111 Register rd, Register rs1, Register rs2,
112 Register rs3, FPURoundingMode frm) {
113 DCHECK(is_uint2(funct2) && rd.is_valid() && rs1.is_valid() &&
114 rs2.is_valid() && rs3.is_valid() && is_uint3(frm));
115 Instr instr = opcode | (rd.code() << kRdShift) | (frm << kFunct3Shift) |
116 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
117 (funct2 << kFunct2Shift) | (rs3.code() << kRs3Shift);
118 emit(instr);
119}
120
121void AssemblerRiscvBase::GenInstrR4(uint8_t funct2, BaseOpcode opcode,
122 FPURegister rd, FPURegister rs1,
123 FPURegister rs2, FPURegister rs3,
124 FPURoundingMode frm) {
125 DCHECK(is_uint2(funct2) && rd.is_valid() && rs1.is_valid() &&
126 rs2.is_valid() && rs3.is_valid() && is_uint3(frm));
127 Instr instr = opcode | (rd.code() << kRdShift) | (frm << kFunct3Shift) |
128 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
129 (funct2 << kFunct2Shift) | (rs3.code() << kRs3Shift);
130 emit(instr);
131}
132
133void AssemblerRiscvBase::GenInstrRAtomic(uint8_t funct5, bool aq, bool rl,
134 uint8_t funct3, Register rd,
135 Register rs1, Register rs2) {
136 DCHECK(is_uint5(funct5) && is_uint3(funct3) && rd.is_valid() &&
137 rs1.is_valid() && rs2.is_valid());
138 Instr instr = AMO | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
139 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
140 (rl << kRlShift) | (aq << kAqShift) | (funct5 << kFunct5Shift);
141 emit(instr);
142}
143
145 Register rd, Register rs1, Register rs2,
146 FPURoundingMode frm) {
147 DCHECK(rd.is_valid() && rs1.is_valid() && rs2.is_valid() && is_uint3(frm));
148 Instr instr = opcode | (rd.code() << kRdShift) | (frm << kFunct3Shift) |
149 (rs1.code() << kRs1Shift) | (rs2.code() << kRs2Shift) |
150 (funct7 << kFunct7Shift);
151 emit(instr);
152}
153
154void AssemblerRiscvBase::GenInstrI(uint8_t funct3, BaseOpcode opcode,
155 Register rd, Register rs1, int16_t imm12) {
156 DCHECK(is_uint3(funct3) && rd.is_valid() && rs1.is_valid() &&
157 (is_uint12(imm12) || is_int12(imm12)));
158 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
159 (rs1.code() << kRs1Shift) | (imm12 << kImm12Shift);
160 emit(instr);
161}
162
163void AssemblerRiscvBase::GenInstrI(uint8_t funct3, BaseOpcode opcode,
164 FPURegister rd, Register rs1,
165 int16_t imm12) {
166 DCHECK(is_uint3(funct3) && rd.is_valid() && rs1.is_valid() &&
167 (is_uint12(imm12) || is_int12(imm12)));
168 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
169 (rs1.code() << kRs1Shift) | (imm12 << kImm12Shift);
170 emit(instr);
171}
172
173void AssemblerRiscvBase::GenInstrIShift(uint8_t funct6, uint8_t funct3,
174 BaseOpcode opcode, Register rd,
175 Register rs1, uint8_t shamt) {
176 DCHECK(is_uint3(funct3) && rd.is_valid() && rs1.is_valid() &&
177 is_uint6(shamt));
178 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
179 (rs1.code() << kRs1Shift) | (shamt << kShamtShift) |
180 (funct6 << kFunct6Shift);
181 emit(instr);
182}
183
184void AssemblerRiscvBase::GenInstrIShiftW(uint8_t funct7, uint8_t funct3,
185 BaseOpcode opcode, Register rd,
186 Register rs1, uint8_t shamt) {
187 DCHECK(is_uint3(funct3) && rd.is_valid() && rs1.is_valid() &&
188 is_uint5(shamt));
189 Instr instr = opcode | (rd.code() << kRdShift) | (funct3 << kFunct3Shift) |
190 (rs1.code() << kRs1Shift) | (shamt << kShamtWShift) |
191 (funct7 << kFunct7Shift);
192 emit(instr);
193}
194
195void AssemblerRiscvBase::GenInstrS(uint8_t funct3, BaseOpcode opcode,
196 Register rs1, Register rs2, int16_t imm12) {
197 DCHECK(is_uint3(funct3) && rs1.is_valid() && rs2.is_valid() &&
198 is_int12(imm12));
199 Instr instr = opcode | ((imm12 & 0x1f) << 7) | // bits 4-0
200 (funct3 << kFunct3Shift) | (rs1.code() << kRs1Shift) |
201 (rs2.code() << kRs2Shift) |
202 ((imm12 & 0xfe0) << 20); // bits 11-5
203 emit(instr);
204}
205
206void AssemblerRiscvBase::GenInstrS(uint8_t funct3, BaseOpcode opcode,
207 Register rs1, FPURegister rs2,
208 int16_t imm12) {
209 DCHECK(is_uint3(funct3) && rs1.is_valid() && rs2.is_valid() &&
210 is_int12(imm12));
211 Instr instr = opcode | ((imm12 & 0x1f) << 7) | // bits 4-0
212 (funct3 << kFunct3Shift) | (rs1.code() << kRs1Shift) |
213 (rs2.code() << kRs2Shift) |
214 ((imm12 & 0xfe0) << 20); // bits 11-5
215 emit(instr);
216}
217
218void AssemblerRiscvBase::GenInstrB(uint8_t funct3, BaseOpcode opcode,
219 Register rs1, Register rs2, int16_t imm13) {
220 DCHECK(is_uint3(funct3) && rs1.is_valid() && rs2.is_valid() &&
221 is_int13(imm13) && ((imm13 & 1) == 0));
222 Instr instr = opcode | ((imm13 & 0x800) >> 4) | // bit 11
223 ((imm13 & 0x1e) << 7) | // bits 4-1
224 (funct3 << kFunct3Shift) | (rs1.code() << kRs1Shift) |
225 (rs2.code() << kRs2Shift) |
226 ((imm13 & 0x7e0) << 20) | // bits 10-5
227 ((imm13 & 0x1000) << 19); // bit 12
228 emit(instr);
229}
230
232 int32_t imm20) {
233 DCHECK(rd.is_valid() && (is_int20(imm20) || is_uint20(imm20)));
234 Instr instr = opcode | (rd.code() << kRdShift) | (imm20 << kImm20Shift);
235 emit(instr);
236}
237
239 int32_t imm21) {
240 DCHECK(rd.is_valid() && is_int21(imm21) && ((imm21 & 1) == 0));
241 Instr instr = opcode | (rd.code() << kRdShift) |
242 (imm21 & 0xff000) | // bits 19-12
243 ((imm21 & 0x800) << 9) | // bit 11
244 ((imm21 & 0x7fe) << 20) | // bits 10-1
245 ((imm21 & 0x100000) << 11); // bit 20
246 emit(instr);
247}
248
249void AssemblerRiscvBase::GenInstrCR(uint8_t funct4, BaseOpcode opcode,
250 Register rd, Register rs2) {
251 DCHECK(is_uint4(funct4) && rd.is_valid() && rs2.is_valid());
252 ShortInstr instr = opcode | (rs2.code() << kRvcRs2Shift) |
253 (rd.code() << kRvcRdShift) | (funct4 << kRvcFunct4Shift);
254 emit(instr);
255}
256
257void AssemblerRiscvBase::GenInstrCA(uint8_t funct6, BaseOpcode opcode,
258 Register rd, uint8_t funct, Register rs2) {
259 DCHECK(is_uint6(funct6) && rd.is_valid() && rs2.is_valid() &&
260 is_uint2(funct));
261 ShortInstr instr = opcode | ((rs2.code() & 0x7) << kRvcRs2sShift) |
262 ((rd.code() & 0x7) << kRvcRs1sShift) |
263 (funct6 << kRvcFunct6Shift) | (funct << kRvcFunct2Shift);
264 emit(instr);
265}
266
267void AssemblerRiscvBase::GenInstrCI(uint8_t funct3, BaseOpcode opcode,
268 Register rd, int8_t imm6) {
269 DCHECK(is_uint3(funct3) && rd.is_valid() && is_int6(imm6));
270 ShortInstr instr = opcode | ((imm6 & 0x1f) << 2) |
271 (rd.code() << kRvcRdShift) | ((imm6 & 0x20) << 7) |
272 (funct3 << kRvcFunct3Shift);
273 emit(instr);
274}
275
276void AssemblerRiscvBase::GenInstrCIU(uint8_t funct3, BaseOpcode opcode,
277 Register rd, uint8_t uimm6) {
278 DCHECK(is_uint3(funct3) && rd.is_valid() && is_uint6(uimm6));
279 ShortInstr instr = opcode | ((uimm6 & 0x1f) << 2) |
280 (rd.code() << kRvcRdShift) | ((uimm6 & 0x20) << 7) |
281 (funct3 << kRvcFunct3Shift);
282 emit(instr);
283}
284
285void AssemblerRiscvBase::GenInstrCIU(uint8_t funct3, BaseOpcode opcode,
286 FPURegister rd, uint8_t uimm6) {
287 DCHECK(is_uint3(funct3) && rd.is_valid() && is_uint6(uimm6));
288 ShortInstr instr = opcode | ((uimm6 & 0x1f) << 2) |
289 (rd.code() << kRvcRdShift) | ((uimm6 & 0x20) << 7) |
290 (funct3 << kRvcFunct3Shift);
291 emit(instr);
292}
293
294void AssemblerRiscvBase::GenInstrCIW(uint8_t funct3, BaseOpcode opcode,
295 Register rd, uint8_t uimm8) {
296 DCHECK(is_uint3(funct3) && rd.is_valid() && is_uint8(uimm8));
297 ShortInstr instr = opcode | ((uimm8) << 5) |
298 ((rd.code() & 0x7) << kRvcRs2sShift) |
299 (funct3 << kRvcFunct3Shift);
300 emit(instr);
301}
302
303void AssemblerRiscvBase::GenInstrCSS(uint8_t funct3, BaseOpcode opcode,
304 Register rs2, uint8_t uimm6) {
305 DCHECK(is_uint3(funct3) && rs2.is_valid() && is_uint6(uimm6));
306 ShortInstr instr = opcode | (uimm6 << 7) | (rs2.code() << kRvcRs2Shift) |
307 (funct3 << kRvcFunct3Shift);
308 emit(instr);
309}
310
311void AssemblerRiscvBase::GenInstrCSS(uint8_t funct3, BaseOpcode opcode,
312 FPURegister rs2, uint8_t uimm6) {
313 DCHECK(is_uint3(funct3) && rs2.is_valid() && is_uint6(uimm6));
314 ShortInstr instr = opcode | (uimm6 << 7) | (rs2.code() << kRvcRs2Shift) |
315 (funct3 << kRvcFunct3Shift);
316 emit(instr);
317}
318
319void AssemblerRiscvBase::GenInstrCL(uint8_t funct3, BaseOpcode opcode,
320 Register rd, Register rs1, uint8_t uimm5) {
321 DCHECK(is_uint3(funct3) && rd.is_valid() && rs1.is_valid() &&
322 is_uint5(uimm5));
323 ShortInstr instr = opcode | ((uimm5 & 0x3) << 5) |
324 ((rd.code() & 0x7) << kRvcRs2sShift) |
325 ((uimm5 & 0x1c) << 8) | (funct3 << kRvcFunct3Shift) |
326 ((rs1.code() & 0x7) << kRvcRs1sShift);
327 emit(instr);
328}
329
330void AssemblerRiscvBase::GenInstrCL(uint8_t funct3, BaseOpcode opcode,
331 FPURegister rd, Register rs1,
332 uint8_t uimm5) {
333 DCHECK(is_uint3(funct3) && rd.is_valid() && rs1.is_valid() &&
334 is_uint5(uimm5));
335 ShortInstr instr = opcode | ((uimm5 & 0x3) << 5) |
336 ((rd.code() & 0x7) << kRvcRs2sShift) |
337 ((uimm5 & 0x1c) << 8) | (funct3 << kRvcFunct3Shift) |
338 ((rs1.code() & 0x7) << kRvcRs1sShift);
339 emit(instr);
340}
341void AssemblerRiscvBase::GenInstrCJ(uint8_t funct3, BaseOpcode opcode,
342 uint16_t uint11) {
343 DCHECK(is_uint11(uint11));
344 ShortInstr instr = opcode | (funct3 << kRvcFunct3Shift) | (uint11 << 2);
345 emit(instr);
346}
347
348void AssemblerRiscvBase::GenInstrCS(uint8_t funct3, BaseOpcode opcode,
349 Register rs2, Register rs1, uint8_t uimm5) {
350 DCHECK(is_uint3(funct3) && rs2.is_valid() && rs1.is_valid() &&
351 is_uint5(uimm5));
352 ShortInstr instr = opcode | ((uimm5 & 0x3) << 5) |
353 ((rs2.code() & 0x7) << kRvcRs2sShift) |
354 ((uimm5 & 0x1c) << 8) | (funct3 << kRvcFunct3Shift) |
355 ((rs1.code() & 0x7) << kRvcRs1sShift);
356 emit(instr);
357}
358
359void AssemblerRiscvBase::GenInstrCS(uint8_t funct3, BaseOpcode opcode,
360 FPURegister rs2, Register rs1,
361 uint8_t uimm5) {
362 DCHECK(is_uint3(funct3) && rs2.is_valid() && rs1.is_valid() &&
363 is_uint5(uimm5));
364 ShortInstr instr = opcode | ((uimm5 & 0x3) << 5) |
365 ((rs2.code() & 0x7) << kRvcRs2sShift) |
366 ((uimm5 & 0x1c) << 8) | (funct3 << kRvcFunct3Shift) |
367 ((rs1.code() & 0x7) << kRvcRs1sShift);
368 emit(instr);
369}
370
371void AssemblerRiscvBase::GenInstrCB(uint8_t funct3, BaseOpcode opcode,
372 Register rs1, uint8_t uimm8) {
373 DCHECK(is_uint3(funct3) && is_uint8(uimm8));
374 ShortInstr instr = opcode | ((uimm8 & 0x1f) << 2) | ((uimm8 & 0xe0) << 5) |
375 ((rs1.code() & 0x7) << kRvcRs1sShift) |
376 (funct3 << kRvcFunct3Shift);
377 emit(instr);
378}
379
380void AssemblerRiscvBase::GenInstrCBA(uint8_t funct3, uint8_t funct2,
381 BaseOpcode opcode, Register rs1,
382 int8_t imm6) {
383 DCHECK(is_uint3(funct3) && is_uint2(funct2) && is_int6(imm6));
384 ShortInstr instr = opcode | ((imm6 & 0x1f) << 2) | ((imm6 & 0x20) << 7) |
385 ((rs1.code() & 0x7) << kRvcRs1sShift) |
386 (funct3 << kRvcFunct3Shift) | (funct2 << 10);
387 emit(instr);
388}
389// ----- Instruction class templates match those in the compiler
390
392 Register rs2, int16_t imm13) {
393 GenInstrB(funct3, BRANCH, rs1, rs2, imm13);
394}
395
397 Register rs1, int16_t imm12) {
398 GenInstrI(funct3, LOAD, rd, rs1, imm12);
399}
400
402 Register rs2, int16_t imm12) {
403 GenInstrS(funct3, STORE, rs1, rs2, imm12);
404}
405
407 Register rs1, int16_t imm12) {
408 GenInstrI(funct3, OP_IMM, rd, rs1, imm12);
409}
410
411void AssemblerRiscvBase::GenInstrShift_ri(bool arithshift, uint8_t funct3,
412 Register rd, Register rs1,
413 uint8_t shamt) {
414 DCHECK(is_uint6(shamt));
415 GenInstrIShift(arithshift << (kArithShiftShift - kFunct6Shift), funct3,
416 OP_IMM, rd, rs1, shamt);
417}
418
419void AssemblerRiscvBase::GenInstrALU_rr(uint8_t funct7, uint8_t funct3,
420 Register rd, Register rs1,
421 Register rs2) {
422 GenInstrR(funct7, funct3, OP, rd, rs1, rs2);
423}
424
426 ControlStatusReg csr, Register rs1) {
427 GenInstrI(funct3, SYSTEM, rd, rs1, csr);
428}
429
431 ControlStatusReg csr, uint8_t imm5) {
432 GenInstrI(funct3, SYSTEM, rd, ToRegister(imm5), csr);
433}
434
435void AssemblerRiscvBase::GenInstrShiftW_ri(bool arithshift, uint8_t funct3,
436 Register rd, Register rs1,
437 uint8_t shamt) {
438 GenInstrIShiftW(arithshift << (kArithShiftShift - kFunct7Shift), funct3,
439 OP_IMM_32, rd, rs1, shamt);
440}
441
442void AssemblerRiscvBase::GenInstrALUW_rr(uint8_t funct7, uint8_t funct3,
443 Register rd, Register rs1,
444 Register rs2) {
445 GenInstrR(funct7, funct3, OP_32, rd, rs1, rs2);
446}
447
449 Register rs2) {
450 GenInstrR(funct7, 0b000, SYSTEM, ToRegister(0), rs1, rs2);
451}
452
454 Register rs1, int16_t imm12) {
455 GenInstrI(funct3, LOAD_FP, rd, rs1, imm12);
456}
457
459 FPURegister rs2, int16_t imm12) {
460 GenInstrS(funct3, STORE_FP, rs1, rs2, imm12);
461}
462
463void AssemblerRiscvBase::GenInstrALUFP_rr(uint8_t funct7, uint8_t funct3,
464 FPURegister rd, FPURegister rs1,
465 FPURegister rs2) {
466 GenInstrR(funct7, funct3, OP_FP, rd, rs1, rs2);
467}
468
469void AssemblerRiscvBase::GenInstrALUFP_rr(uint8_t funct7, uint8_t funct3,
470 FPURegister rd, Register rs1,
471 Register rs2) {
472 GenInstrR(funct7, funct3, OP_FP, rd, rs1, rs2);
473}
474
475void AssemblerRiscvBase::GenInstrALUFP_rr(uint8_t funct7, uint8_t funct3,
476 FPURegister rd, FPURegister rs1,
477 Register rs2) {
478 GenInstrR(funct7, funct3, OP_FP, rd, rs1, rs2);
479}
480
481void AssemblerRiscvBase::GenInstrALUFP_rr(uint8_t funct7, uint8_t funct3,
482 Register rd, FPURegister rs1,
483 Register rs2) {
484 GenInstrR(funct7, funct3, OP_FP, rd, rs1, rs2);
485}
486
487void AssemblerRiscvBase::GenInstrALUFP_rr(uint8_t funct7, uint8_t funct3,
488 Register rd, FPURegister rs1,
489 FPURegister rs2) {
490 GenInstrR(funct7, funct3, OP_FP, rd, rs1, rs2);
491}
492
493} // namespace internal
494} // namespace v8
void GenInstrIShiftW(uint8_t funct7, uint8_t funct3, BaseOpcode opcode, Register rd, Register rs1, uint8_t shamt)
void GenInstrR(uint8_t funct7, uint8_t funct3, BaseOpcode opcode, Register rd, Register rs1, Register rs2)
void GenInstrCI(uint8_t funct3, BaseOpcode opcode, Register rd, int8_t imm6)
void GenInstrBranchCC_rri(uint8_t funct3, Register rs1, Register rs2, int16_t imm12)
virtual void emit(Instr x)=0
void GenInstrRFrm(uint8_t funct7, BaseOpcode opcode, Register rd, Register rs1, Register rs2, FPURoundingMode frm)
void GenInstrJ(BaseOpcode opcode, Register rd, int32_t imm20)
void GenInstrLoad_ri(uint8_t funct3, Register rd, Register rs1, int16_t imm12)
void GenInstrALU_ri(uint8_t funct3, Register rd, Register rs1, int16_t imm12)
void GenInstrR4(uint8_t funct2, BaseOpcode opcode, Register rd, Register rs1, Register rs2, Register rs3, FPURoundingMode frm)
void GenInstrShift_ri(bool arithshift, uint8_t funct3, Register rd, Register rs1, uint8_t shamt)
void GenInstrALUW_rr(uint8_t funct7, uint8_t funct3, Register rd, Register rs1, Register rs2)
void GenInstrCR(uint8_t funct4, BaseOpcode opcode, Register rd, Register rs2)
void GenInstrCB(uint8_t funct3, BaseOpcode opcode, Register rs1, uint8_t uimm8)
void GenInstrCSR_ir(uint8_t funct3, Register rd, ControlStatusReg csr, Register rs1)
void GenInstrALU_rr(uint8_t funct7, uint8_t funct3, Register rd, Register rs1, Register rs2)
void GenInstrCIU(uint8_t funct3, BaseOpcode opcode, Register rd, uint8_t uimm6)
void GenInstrPriv(uint8_t funct7, Register rs1, Register rs2)
void GenInstrCJ(uint8_t funct3, BaseOpcode opcode, uint16_t uint11)
void GenInstrCSR_ii(uint8_t funct3, Register rd, ControlStatusReg csr, uint8_t rs1)
void GenInstrStore_rri(uint8_t funct3, Register rs1, Register rs2, int16_t imm12)
void GenInstrStoreFP_rri(uint8_t funct3, Register rs1, FPURegister rs2, int16_t imm12)
void GenInstrCL(uint8_t funct3, BaseOpcode opcode, Register rd, Register rs1, uint8_t uimm5)
void GenInstrALUFP_rr(uint8_t funct7, uint8_t funct3, FPURegister rd, FPURegister rs1, FPURegister rs2)
void GenInstrS(uint8_t funct3, BaseOpcode opcode, Register rs1, Register rs2, int16_t imm12)
void GenInstrCBA(uint8_t funct3, uint8_t funct2, BaseOpcode opcode, Register rs1, int8_t imm6)
void GenInstrI(uint8_t funct3, BaseOpcode opcode, Register rd, Register rs1, int16_t imm12)
void GenInstrRAtomic(uint8_t funct5, bool aq, bool rl, uint8_t funct3, Register rd, Register rs1, Register rs2)
void GenInstrU(BaseOpcode opcode, Register rd, int32_t imm20)
void GenInstrB(uint8_t funct3, BaseOpcode opcode, Register rs1, Register rs2, int16_t imm12)
void GenInstrCA(uint8_t funct6, BaseOpcode opcode, Register rd, uint8_t funct, Register rs2)
void GenInstrCS(uint8_t funct3, BaseOpcode opcode, Register rs2, Register rs1, uint8_t uimm5)
void GenInstrCIW(uint8_t funct3, BaseOpcode opcode, Register rd, uint8_t uimm8)
void GenInstrLoadFP_ri(uint8_t funct3, FPURegister rd, Register rs1, int16_t imm12)
void GenInstrShiftW_ri(bool arithshift, uint8_t funct3, Register rd, Register rs1, uint8_t shamt)
void GenInstrCSS(uint8_t funct3, BaseOpcode opcode, FPURegister rs2, uint8_t uimm6)
void GenInstrIShift(uint8_t funct7, uint8_t funct3, BaseOpcode opcode, Register rd, Register rs1, uint8_t shamt)
constexpr bool is_valid() const
constexpr int8_t code() const
Instruction * instr
const int kImm12Shift
Register ToRegister(int num)
#define DCHECK(condition)
Definition logging.h:482