v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
extension-riscv-a.cc
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.
5
6namespace v8 {
7namespace internal {
8
9// RV32A Standard Extension
10void AssemblerRISCVA::lr_w(bool aq, bool rl, Register rd, Register rs1) {
11 GenInstrRAtomic(0b00010, aq, rl, 0b010, rd, rs1, zero_reg);
12}
13
14void AssemblerRISCVA::sc_w(bool aq, bool rl, Register rd, Register rs1,
15 Register rs2) {
16 GenInstrRAtomic(0b00011, aq, rl, 0b010, rd, rs1, rs2);
17}
18
19void AssemblerRISCVA::amoswap_w(bool aq, bool rl, Register rd, Register rs1,
20 Register rs2) {
21 GenInstrRAtomic(0b00001, aq, rl, 0b010, rd, rs1, rs2);
22}
23
24void AssemblerRISCVA::amoadd_w(bool aq, bool rl, Register rd, Register rs1,
25 Register rs2) {
26 GenInstrRAtomic(0b00000, aq, rl, 0b010, rd, rs1, rs2);
27}
28
29void AssemblerRISCVA::amoxor_w(bool aq, bool rl, Register rd, Register rs1,
30 Register rs2) {
31 GenInstrRAtomic(0b00100, aq, rl, 0b010, rd, rs1, rs2);
32}
33
34void AssemblerRISCVA::amoand_w(bool aq, bool rl, Register rd, Register rs1,
35 Register rs2) {
36 GenInstrRAtomic(0b01100, aq, rl, 0b010, rd, rs1, rs2);
37}
38
39void AssemblerRISCVA::amoor_w(bool aq, bool rl, Register rd, Register rs1,
40 Register rs2) {
41 GenInstrRAtomic(0b01000, aq, rl, 0b010, rd, rs1, rs2);
42}
43
44void AssemblerRISCVA::amomin_w(bool aq, bool rl, Register rd, Register rs1,
45 Register rs2) {
46 GenInstrRAtomic(0b10000, aq, rl, 0b010, rd, rs1, rs2);
47}
48
49void AssemblerRISCVA::amomax_w(bool aq, bool rl, Register rd, Register rs1,
50 Register rs2) {
51 GenInstrRAtomic(0b10100, aq, rl, 0b010, rd, rs1, rs2);
52}
53
54void AssemblerRISCVA::amominu_w(bool aq, bool rl, Register rd, Register rs1,
55 Register rs2) {
56 GenInstrRAtomic(0b11000, aq, rl, 0b010, rd, rs1, rs2);
57}
58
59void AssemblerRISCVA::amomaxu_w(bool aq, bool rl, Register rd, Register rs1,
60 Register rs2) {
61 GenInstrRAtomic(0b11100, aq, rl, 0b010, rd, rs1, rs2);
62}
63
64// RV64A Standard Extension (in addition to RV32A)
65#ifdef V8_TARGET_ARCH_RISCV64
66void AssemblerRISCVA::lr_d(bool aq, bool rl, Register rd, Register rs1) {
67 GenInstrRAtomic(0b00010, aq, rl, 0b011, rd, rs1, zero_reg);
68}
69
70void AssemblerRISCVA::sc_d(bool aq, bool rl, Register rd, Register rs1,
71 Register rs2) {
72 GenInstrRAtomic(0b00011, aq, rl, 0b011, rd, rs1, rs2);
73}
74
75void AssemblerRISCVA::amoswap_d(bool aq, bool rl, Register rd, Register rs1,
76 Register rs2) {
77 GenInstrRAtomic(0b00001, aq, rl, 0b011, rd, rs1, rs2);
78}
79
80void AssemblerRISCVA::amoadd_d(bool aq, bool rl, Register rd, Register rs1,
81 Register rs2) {
82 GenInstrRAtomic(0b00000, aq, rl, 0b011, rd, rs1, rs2);
83}
84
85void AssemblerRISCVA::amoxor_d(bool aq, bool rl, Register rd, Register rs1,
86 Register rs2) {
87 GenInstrRAtomic(0b00100, aq, rl, 0b011, rd, rs1, rs2);
88}
89
90void AssemblerRISCVA::amoand_d(bool aq, bool rl, Register rd, Register rs1,
91 Register rs2) {
92 GenInstrRAtomic(0b01100, aq, rl, 0b011, rd, rs1, rs2);
93}
94
95void AssemblerRISCVA::amoor_d(bool aq, bool rl, Register rd, Register rs1,
96 Register rs2) {
97 GenInstrRAtomic(0b01000, aq, rl, 0b011, rd, rs1, rs2);
98}
99
100void AssemblerRISCVA::amomin_d(bool aq, bool rl, Register rd, Register rs1,
101 Register rs2) {
102 GenInstrRAtomic(0b10000, aq, rl, 0b011, rd, rs1, rs2);
103}
104
105void AssemblerRISCVA::amomax_d(bool aq, bool rl, Register rd, Register rs1,
106 Register rs2) {
107 GenInstrRAtomic(0b10100, aq, rl, 0b011, rd, rs1, rs2);
108}
109
110void AssemblerRISCVA::amominu_d(bool aq, bool rl, Register rd, Register rs1,
111 Register rs2) {
112 GenInstrRAtomic(0b11000, aq, rl, 0b011, rd, rs1, rs2);
113}
114
115void AssemblerRISCVA::amomaxu_d(bool aq, bool rl, Register rd, Register rs1,
116 Register rs2) {
117 GenInstrRAtomic(0b11100, aq, rl, 0b011, rd, rs1, rs2);
118}
119#endif
120} // namespace internal
121} // namespace v8
void amomax_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void amomaxu_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void amominu_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void amoand_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void amoxor_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void amoadd_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void amoswap_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void amomin_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void amoor_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void sc_w(bool aq, bool rl, Register rd, Register rs1, Register rs2)
void lr_w(bool aq, bool rl, Register rd, Register rs1)
void GenInstrRAtomic(uint8_t funct5, bool aq, bool rl, uint8_t funct3, Register rd, Register rs1, Register rs2)