Skip to content

Commit 85c60bd

Browse files
committed
cmd/internal/obj/riscv: fix up instruction groupings
Some of the instructions were incorrectly grouped - untangle this and separate the RV64I instructions, which are under separate sections of the RISC-V specification. Change-Id: I232962ab4054bf0b4745887506f51e74ea73f73d Reviewed-on: https://go-review.googlesource.com/c/go/+/194238 Reviewed-by: Cherry Zhang <[email protected]>
1 parent 6f1667e commit 85c60bd

File tree

2 files changed

+66
-61
lines changed

2 files changed

+66
-61
lines changed

src/cmd/internal/obj/riscv/anames.go

+30-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/internal/obj/riscv/cpu.go

+36-31
Original file line numberDiff line numberDiff line change
@@ -211,27 +211,7 @@ const (
211211
// Unprivileged ISA (Document Version 20190608-Base-Ratified)
212212

213213
// 2.4: Integer Computational Instructions
214-
ASLLIRV32 = obj.ABaseRISCV + obj.A_ARCHSPECIFIC + iota
215-
ASRLIRV32
216-
ASRAIRV32
217-
218-
// 2.5: Control Transfer Instructions
219-
AJAL
220-
AJALR
221-
ABEQ
222-
ABNE
223-
ABLT
224-
ABLTU
225-
ABGE
226-
ABGEU
227-
228-
// 2.7: Memory Ordering Instructions
229-
AFENCE
230-
AFENCEI
231-
AFENCETSO
232-
233-
// 5.2: Integer Computational Instructions
234-
AADDI
214+
AADDI = obj.ABaseRISCV + obj.A_ARCHSPECIFIC + iota
235215
ASLTI
236216
ASLTIU
237217
AANDI
@@ -252,6 +232,40 @@ const (
252232
ASRL
253233
ASUB
254234
ASRA
235+
236+
// The SLL/SRL/SRA instructions differ slightly between RV32 and RV64,
237+
// hence there are pseudo-opcodes for the RV32 specific versions.
238+
ASLLIRV32
239+
ASRLIRV32
240+
ASRAIRV32
241+
242+
// 2.5: Control Transfer Instructions
243+
AJAL
244+
AJALR
245+
ABEQ
246+
ABNE
247+
ABLT
248+
ABLTU
249+
ABGE
250+
ABGEU
251+
252+
// 2.6: Load and Store Instructions
253+
ALW
254+
ALWU
255+
ALH
256+
ALHU
257+
ALB
258+
ALBU
259+
ASW
260+
ASH
261+
ASB
262+
263+
// 2.7: Memory Ordering Instructions
264+
AFENCE
265+
AFENCEI
266+
AFENCETSO
267+
268+
// 5.2: Integer Computational Instructions (RV64I)
255269
AADDIW
256270
ASLLIW
257271
ASRLIW
@@ -262,18 +276,9 @@ const (
262276
ASUBW
263277
ASRAW
264278

265-
// 5.3: Load and Store Instructions
279+
// 5.3: Load and Store Instructions (RV64I)
266280
ALD
267-
ALW
268-
ALWU
269-
ALH
270-
ALHU
271-
ALB
272-
ALBU
273281
ASD
274-
ASW
275-
ASH
276-
ASB
277282

278283
// 7.1: Multiplication Operations
279284
AMUL

0 commit comments

Comments
 (0)