summaryrefslogtreecommitdiff
path: root/deps/v8/src/codegen/riscv/constant-riscv-zicsr.h
blob: 0b3d25454164c82869ab9ddcdb635bc85654bfe6 (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
// 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.
#ifndef V8_CODEGEN_RISCV_CONSTANT_RISCV_ZICSR_H_
#define V8_CODEGEN_RISCV_CONSTANT_RISCV_ZICSR_H_

#include "src/codegen/riscv/base-constants-riscv.h"
namespace v8 {
namespace internal {
// RISCV CSR related bit mask and shift
const int kFcsrFlagsBits = 5;
const uint32_t kFcsrFlagsMask = (1 << kFcsrFlagsBits) - 1;
const int kFcsrFrmBits = 3;
const int kFcsrFrmShift = kFcsrFlagsBits;
const uint32_t kFcsrFrmMask = ((1 << kFcsrFrmBits) - 1) << kFcsrFrmShift;
const int kFcsrBits = kFcsrFlagsBits + kFcsrFrmBits;
const uint32_t kFcsrMask = kFcsrFlagsMask | kFcsrFrmMask;

// RV32/RV64 Zicsr Standard Extension
constexpr Opcode RO_CSRRW = SYSTEM | (0b001 << kFunct3Shift);
constexpr Opcode RO_CSRRS = SYSTEM | (0b010 << kFunct3Shift);
constexpr Opcode RO_CSRRC = SYSTEM | (0b011 << kFunct3Shift);
constexpr Opcode RO_CSRRWI = SYSTEM | (0b101 << kFunct3Shift);
constexpr Opcode RO_CSRRSI = SYSTEM | (0b110 << kFunct3Shift);
constexpr Opcode RO_CSRRCI = SYSTEM | (0b111 << kFunct3Shift);
}  // namespace internal
}  // namespace v8
#endif  // V8_CODEGEN_RISCV_CONSTANT_RISCV_ZICSR_H_