v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
constant-riscv-c.h
Go to the documentation of this file.
1// Copyright 2022 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_CODEGEN_RISCV_CONSTANT_RISCV_C_H_
6#define V8_CODEGEN_RISCV_CONSTANT_RISCV_C_H_
7
9namespace v8 {
10namespace internal {
11
12constexpr Opcode RO_C_ADDI4SPN = C0 | (0b000 << kRvcFunct3Shift);
13constexpr Opcode RO_C_ADDI16SP = C1 | (0b011 << kRvcFunct3Shift);
14constexpr Opcode RO_C_LW = C0 | (0b010 << kRvcFunct3Shift);
15constexpr Opcode RO_C_SW = C0 | (0b110 << kRvcFunct3Shift);
16constexpr Opcode RO_C_NOP_ADDI = C1 | (0b000 << kRvcFunct3Shift);
17constexpr Opcode RO_C_LI = C1 | (0b010 << kRvcFunct3Shift);
18constexpr Opcode RO_C_SUB =
19 C1 | (0b100011 << kRvcFunct6Shift) | (FUNCT2_0 << kRvcFunct2Shift);
20constexpr Opcode RO_C_XOR =
21 C1 | (0b100011 << kRvcFunct6Shift) | (FUNCT2_1 << kRvcFunct2Shift);
22constexpr Opcode RO_C_OR =
23 C1 | (0b100011 << kRvcFunct6Shift) | (FUNCT2_2 << kRvcFunct2Shift);
24constexpr Opcode RO_C_AND =
25 C1 | (0b100011 << kRvcFunct6Shift) | (FUNCT2_3 << kRvcFunct2Shift);
26constexpr Opcode RO_C_LUI_ADD = C1 | (0b011 << kRvcFunct3Shift);
27constexpr Opcode RO_C_MISC_ALU = C1 | (0b100 << kRvcFunct3Shift);
28constexpr Opcode RO_C_J = C1 | (0b101 << kRvcFunct3Shift);
29constexpr Opcode RO_C_BEQZ = C1 | (0b110 << kRvcFunct3Shift);
30constexpr Opcode RO_C_BNEZ = C1 | (0b111 << kRvcFunct3Shift);
31constexpr Opcode RO_C_SLLI = C2 | (0b000 << kRvcFunct3Shift);
32constexpr Opcode RO_C_LWSP = C2 | (0b010 << kRvcFunct3Shift);
33constexpr Opcode RO_C_JR_MV_ADD = C2 | (0b100 << kRvcFunct3Shift);
34constexpr Opcode RO_C_JR = C2 | (0b1000 << kRvcFunct4Shift);
35constexpr Opcode RO_C_MV = C2 | (0b1000 << kRvcFunct4Shift);
36constexpr Opcode RO_C_EBREAK = C2 | (0b1001 << kRvcFunct4Shift);
37constexpr Opcode RO_C_JALR = C2 | (0b1001 << kRvcFunct4Shift);
38constexpr Opcode RO_C_ADD = C2 | (0b1001 << kRvcFunct4Shift);
39constexpr Opcode RO_C_SWSP = C2 | (0b110 << kRvcFunct3Shift);
40
41constexpr Opcode RO_C_FSD = C0 | (0b101 << kRvcFunct3Shift);
42constexpr Opcode RO_C_FLD = C0 | (0b001 << kRvcFunct3Shift);
43constexpr Opcode RO_C_FLDSP = C2 | (0b001 << kRvcFunct3Shift);
44constexpr Opcode RO_C_FSDSP = C2 | (0b101 << kRvcFunct3Shift);
45#ifdef V8_TARGET_ARCH_RISCV64
46constexpr Opcode RO_C_LD = C0 | (0b011 << kRvcFunct3Shift);
47constexpr Opcode RO_C_SD = C0 | (0b111 << kRvcFunct3Shift);
48constexpr Opcode RO_C_LDSP = C2 | (0b011 << kRvcFunct3Shift);
49constexpr Opcode RO_C_SDSP = C2 | (0b111 << kRvcFunct3Shift);
50constexpr Opcode RO_C_ADDIW = C1 | (0b001 << kRvcFunct3Shift);
51constexpr Opcode RO_C_SUBW =
52 C1 | (0b100111 << kRvcFunct6Shift) | (FUNCT2_0 << kRvcFunct2Shift);
53constexpr Opcode RO_C_ADDW =
54 C1 | (0b100111 << kRvcFunct6Shift) | (FUNCT2_1 << kRvcFunct2Shift);
55#endif
56#ifdef V8_TARGET_ARCH_RISCV32
57constexpr Opcode RO_C_FLWSP = C2 | (0b011 << kRvcFunct3Shift);
58constexpr Opcode RO_C_FSWSP = C2 | (0b111 << kRvcFunct3Shift);
59constexpr Opcode RO_C_FLW = C0 | (0b011 << kRvcFunct3Shift);
60constexpr Opcode RO_C_FSW = C0 | (0b111 << kRvcFunct3Shift);
61#endif
62// clang-format on
63} // namespace internal
64} // namespace v8
65#endif // V8_CODEGEN_RISCV_CONSTANT_RISCV_C_H_
constexpr Opcode RO_C_AND
constexpr Opcode RO_C_SUB
constexpr Opcode RO_C_MISC_ALU
constexpr Opcode RO_C_OR
constexpr Opcode RO_C_NOP_ADDI
constexpr Opcode RO_C_MV
constexpr Opcode RO_C_ADD
constexpr Opcode RO_C_LWSP
constexpr Opcode RO_C_ADDI4SPN
constexpr Opcode RO_C_FLD
constexpr Opcode RO_C_XOR
constexpr Opcode RO_C_LI
constexpr Opcode RO_C_JR_MV_ADD
constexpr Opcode RO_C_LW
constexpr Opcode RO_C_SW
constexpr Opcode RO_C_FSDSP
constexpr Opcode RO_C_BEQZ
constexpr Opcode RO_C_SWSP
constexpr Opcode RO_C_BNEZ
constexpr Opcode RO_C_JR
constexpr Opcode RO_C_J
constexpr Opcode RO_C_FSD
constexpr Opcode RO_C_FLDSP
constexpr Opcode RO_C_LUI_ADD
constexpr Opcode RO_C_SLLI
constexpr Opcode RO_C_ADDI16SP
constexpr Opcode RO_C_JALR
constexpr Opcode RO_C_EBREAK