summaryrefslogtreecommitdiffstats
path: root/js/src/jit/riscv64/extension/extension-riscv-a.cc
blob: ead355fc0aad1fad7d85817b03cfe72b32ee9cd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// Copyright 2022 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "jit/riscv64/extension/extension-riscv-a.h"
#include "jit/riscv64/Assembler-riscv64.h"
#include "jit/riscv64/constant/Constant-riscv64.h"
#include "jit/riscv64/Architecture-riscv64.h"
namespace js {
namespace jit {

// RV32A Standard Extension
void AssemblerRISCVA::lr_w(bool aq, bool rl, Register rd, Register rs1) {
  GenInstrRAtomic(0b00010, aq, rl, 0b010, rd, rs1, zero_reg);
}

void AssemblerRISCVA::sc_w(bool aq, bool rl, Register rd, Register rs1,
                           Register rs2) {
  GenInstrRAtomic(0b00011, aq, rl, 0b010, rd, rs1, rs2);
}

void AssemblerRISCVA::amoswap_w(bool aq, bool rl, Register rd, Register rs1,
                                Register rs2) {
  GenInstrRAtomic(0b00001, aq, rl, 0b010, rd, rs1, rs2);
}

void AssemblerRISCVA::amoadd_w(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b00000, aq, rl, 0b010, rd, rs1, rs2);
}

void AssemblerRISCVA::amoxor_w(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b00100, aq, rl, 0b010, rd, rs1, rs2);
}

void AssemblerRISCVA::amoand_w(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b01100, aq, rl, 0b010, rd, rs1, rs2);
}

void AssemblerRISCVA::amoor_w(bool aq, bool rl, Register rd, Register rs1,
                              Register rs2) {
  GenInstrRAtomic(0b01000, aq, rl, 0b010, rd, rs1, rs2);
}

void AssemblerRISCVA::amomin_w(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b10000, aq, rl, 0b010, rd, rs1, rs2);
}

void AssemblerRISCVA::amomax_w(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b10100, aq, rl, 0b010, rd, rs1, rs2);
}

void AssemblerRISCVA::amominu_w(bool aq, bool rl, Register rd, Register rs1,
                                Register rs2) {
  GenInstrRAtomic(0b11000, aq, rl, 0b010, rd, rs1, rs2);
}

void AssemblerRISCVA::amomaxu_w(bool aq, bool rl, Register rd, Register rs1,
                                Register rs2) {
  GenInstrRAtomic(0b11100, aq, rl, 0b010, rd, rs1, rs2);
}

// RV64A Standard Extension (in addition to RV32A)
#ifdef JS_CODEGEN_RISCV64
void AssemblerRISCVA::lr_d(bool aq, bool rl, Register rd, Register rs1) {
  GenInstrRAtomic(0b00010, aq, rl, 0b011, rd, rs1, zero_reg);
}

void AssemblerRISCVA::sc_d(bool aq, bool rl, Register rd, Register rs1,
                           Register rs2) {
  GenInstrRAtomic(0b00011, aq, rl, 0b011, rd, rs1, rs2);
}

void AssemblerRISCVA::amoswap_d(bool aq, bool rl, Register rd, Register rs1,
                                Register rs2) {
  GenInstrRAtomic(0b00001, aq, rl, 0b011, rd, rs1, rs2);
}

void AssemblerRISCVA::amoadd_d(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b00000, aq, rl, 0b011, rd, rs1, rs2);
}

void AssemblerRISCVA::amoxor_d(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b00100, aq, rl, 0b011, rd, rs1, rs2);
}

void AssemblerRISCVA::amoand_d(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b01100, aq, rl, 0b011, rd, rs1, rs2);
}

void AssemblerRISCVA::amoor_d(bool aq, bool rl, Register rd, Register rs1,
                              Register rs2) {
  GenInstrRAtomic(0b01000, aq, rl, 0b011, rd, rs1, rs2);
}

void AssemblerRISCVA::amomin_d(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b10000, aq, rl, 0b011, rd, rs1, rs2);
}

void AssemblerRISCVA::amomax_d(bool aq, bool rl, Register rd, Register rs1,
                               Register rs2) {
  GenInstrRAtomic(0b10100, aq, rl, 0b011, rd, rs1, rs2);
}

void AssemblerRISCVA::amominu_d(bool aq, bool rl, Register rd, Register rs1,
                                Register rs2) {
  GenInstrRAtomic(0b11000, aq, rl, 0b011, rd, rs1, rs2);
}

void AssemblerRISCVA::amomaxu_d(bool aq, bool rl, Register rd, Register rs1,
                                Register rs2) {
  GenInstrRAtomic(0b11100, aq, rl, 0b011, rd, rs1, rs2);
}
#endif
}  // namespace jit
}  // namespace js