Commit 85c60bd0 authored by Joel Sing's avatar Joel Sing

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/+/194238Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
parent 6f1667ea
...@@ -5,21 +5,7 @@ package riscv ...@@ -5,21 +5,7 @@ package riscv
import "cmd/internal/obj" import "cmd/internal/obj"
var Anames = []string{ var Anames = []string{
obj.A_ARCHSPECIFIC: "SLLIRV32", obj.A_ARCHSPECIFIC: "ADDI",
"SRLIRV32",
"SRAIRV32",
"JAL",
"JALR",
"BEQ",
"BNE",
"BLT",
"BLTU",
"BGE",
"BGEU",
"FENCE",
"FENCEI",
"FENCETSO",
"ADDI",
"SLTI", "SLTI",
"SLTIU", "SLTIU",
"ANDI", "ANDI",
...@@ -40,6 +26,29 @@ var Anames = []string{ ...@@ -40,6 +26,29 @@ var Anames = []string{
"SRL", "SRL",
"SUB", "SUB",
"SRA", "SRA",
"SLLIRV32",
"SRLIRV32",
"SRAIRV32",
"JAL",
"JALR",
"BEQ",
"BNE",
"BLT",
"BLTU",
"BGE",
"BGEU",
"LW",
"LWU",
"LH",
"LHU",
"LB",
"LBU",
"SW",
"SH",
"SB",
"FENCE",
"FENCEI",
"FENCETSO",
"ADDIW", "ADDIW",
"SLLIW", "SLLIW",
"SRLIW", "SRLIW",
...@@ -50,22 +59,7 @@ var Anames = []string{ ...@@ -50,22 +59,7 @@ var Anames = []string{
"SUBW", "SUBW",
"SRAW", "SRAW",
"LD", "LD",
"LW",
"LWU",
"LH",
"LHU",
"LB",
"LBU",
"SD", "SD",
"SW",
"SH",
"SB",
"RDCYCLE",
"RDCYCLEH",
"RDTIME",
"RDTIMEH",
"RDINSTRET",
"RDINSTRETH",
"MUL", "MUL",
"MULH", "MULH",
"MULHU", "MULHU",
...@@ -101,6 +95,12 @@ var Anames = []string{ ...@@ -101,6 +95,12 @@ var Anames = []string{
"AMOMAXUW", "AMOMAXUW",
"AMOMINW", "AMOMINW",
"AMOMINUW", "AMOMINUW",
"RDCYCLE",
"RDCYCLEH",
"RDTIME",
"RDTIMEH",
"RDINSTRET",
"RDINSTRETH",
"FRCSR", "FRCSR",
"FSCSR", "FSCSR",
"FRRM", "FRRM",
......
...@@ -211,27 +211,7 @@ const ( ...@@ -211,27 +211,7 @@ const (
// Unprivileged ISA (Document Version 20190608-Base-Ratified) // Unprivileged ISA (Document Version 20190608-Base-Ratified)
// 2.4: Integer Computational Instructions // 2.4: Integer Computational Instructions
ASLLIRV32 = obj.ABaseRISCV + obj.A_ARCHSPECIFIC + iota AADDI = obj.ABaseRISCV + obj.A_ARCHSPECIFIC + iota
ASRLIRV32
ASRAIRV32
// 2.5: Control Transfer Instructions
AJAL
AJALR
ABEQ
ABNE
ABLT
ABLTU
ABGE
ABGEU
// 2.7: Memory Ordering Instructions
AFENCE
AFENCEI
AFENCETSO
// 5.2: Integer Computational Instructions
AADDI
ASLTI ASLTI
ASLTIU ASLTIU
AANDI AANDI
...@@ -252,6 +232,40 @@ const ( ...@@ -252,6 +232,40 @@ const (
ASRL ASRL
ASUB ASUB
ASRA ASRA
// The SLL/SRL/SRA instructions differ slightly between RV32 and RV64,
// hence there are pseudo-opcodes for the RV32 specific versions.
ASLLIRV32
ASRLIRV32
ASRAIRV32
// 2.5: Control Transfer Instructions
AJAL
AJALR
ABEQ
ABNE
ABLT
ABLTU
ABGE
ABGEU
// 2.6: Load and Store Instructions
ALW
ALWU
ALH
ALHU
ALB
ALBU
ASW
ASH
ASB
// 2.7: Memory Ordering Instructions
AFENCE
AFENCEI
AFENCETSO
// 5.2: Integer Computational Instructions (RV64I)
AADDIW AADDIW
ASLLIW ASLLIW
ASRLIW ASRLIW
...@@ -262,18 +276,9 @@ const ( ...@@ -262,18 +276,9 @@ const (
ASUBW ASUBW
ASRAW ASRAW
// 5.3: Load and Store Instructions // 5.3: Load and Store Instructions (RV64I)
ALD ALD
ALW
ALWU
ALH
ALHU
ALB
ALBU
ASD ASD
ASW
ASH
ASB
// 7.1: Multiplication Operations // 7.1: Multiplication Operations
AMUL AMUL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment