-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathriscv64.go
47 lines (41 loc) · 987 Bytes
/
riscv64.go
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
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package asmgen
var ArchRISCV64 = &Arch{
Name: "riscv64",
WordBits: 64,
WordBytes: 8,
CarrySafeLoop: true,
regs: []string{
// X0 is zero.
// X1 is LR.
// X2 is SP.
// X3 is SB.
// X4 is TP.
// X27 is g.
// X28 and X29 are our virtual carry flags.
// X31 is the assembler/linker temporary (which we use too).
"X5", "X6", "X7", "X8", "X9",
"X10", "X11", "X12", "X13", "X14", "X15", "X16", "X17", "X18", "X19",
"X20", "X21", "X22", "X23", "X24", "X25", "X26",
"X30",
},
reg0: "X0",
regCarry: "X28",
regAltCarry: "X29",
regTmp: "X31",
mov: "MOV",
add: "ADD",
sub: "SUB",
mul: "MUL",
mulhi: "MULHU",
lsh: "SLL",
rsh: "SRL",
and: "AND",
or: "OR",
xor: "XOR",
sltu: "SLTU",
jmpZero: "BEQZ %s, %s",
jmpNonZero: "BNEZ %s, %s",
}