Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/cmd/asm/internal/asm/testdata/riscv64.s
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ start:
RDTIME X5 // f32210c0
RDINSTRET X5 // f32220c0

// 12.3: Integer Conditional Operations (Zicond)
CZEROEQZ X5, X6, X7 // b353530e
CZEROEQZ X5, X7 // b3d3530e
CZERONEZ X5, X6, X7 // b373530e
CZERONEZ X5, X7 // b3f3530e
// 9: Zihintntl Extension
NTLP1 // 33002000
NTLPALL // 33003000
NTLS1 // 33004000
NTLALL // 33005000

// 13.1: Multiplication Operations
MUL X5, X6, X7 // b3035302
Expand Down
4 changes: 4 additions & 0 deletions src/cmd/internal/obj/riscv/anames.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/cmd/internal/obj/riscv/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,12 @@ const (
ACSRRSI
ACSRRCI

// 9: Zihintntl Extension
ANTLP1
ANTLPALL
ANTLS1
ANTLALL

// 12.3: Integer Conditional Operations (Zicond)
ACZEROEQZ
ACZERONEZ
Expand Down
20 changes: 20 additions & 0 deletions src/cmd/internal/obj/riscv/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,26 @@ func jalToSym(ctxt *obj.Link, p *obj.Prog, lr int16) {
// progedit is called individually for each *obj.Prog. It normalizes instruction
// formats and eliminates as many pseudo-instructions as possible.
func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
// Convert pseudo instructions into real riscv64 instructions.
switch p.As {
case ANTLP1, ANTLPALL, ANTLS1, ANTLALL:
switch p.As {
case ANTLP1:
p.From.Reg = REG_X2
case ANTLPALL:
p.From.Reg = REG_X3
case ANTLS1:
p.From.Reg = REG_X4
case ANTLALL:
p.From.Reg = REG_X5
}
p.As = AADD
p.From.Type = obj.TYPE_REG
p.Reg = REG_ZERO
p.To.Reg = REG_ZERO
p.To.Type = obj.TYPE_REG
}

insData, err := instructionDataForAs(p.As)
if err != nil {
panic(fmt.Sprintf("failed to lookup instruction data for %v: %v", p.As, err))
Expand Down