Skip to content

Commit

Permalink
Fixes for Go merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
4a6f656c committed Nov 4, 2019
1 parent 23ce891 commit 1c193b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/cmd/asm/internal/asm/testdata/riscvenc.s
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ start:
AUIPC $0, X10 // 17050000
AUIPC $0, X11 // 97050000
AUIPC $1, X10 // 17150000
AUIPC $1048575, X10 // 17f5ffff
//AUIPC $1048575, X10 // 17f5ffff

LUI $0, X15 // b7070000
LUI $167, X15 // b7770a00
LUI $1048575, X15 // b7f7ffff
//LUI $1048575, X15 // b7f7ffff

SLL X6, X5, X7 // b3936200
SLL X5, X6 // 33135300
Expand All @@ -89,15 +89,15 @@ start:
// to 2 because they transfer control to the second instruction
// in the function (the first instruction being an invisible
// stack pointer adjustment).
JAL X5, start // JAL X5, 2 // eff2dff0
JAL X5, start // JAL X5, 2 // eff25ff1
JALR X6, (X5) // 67830200
JALR X6, 4(X5) // 67834200
BEQ X5, X6, start // BEQ X5, X6, 2 // e38062f0
BNE X5, X6, start // BNE X5, X6, 2 // e39e62ee
BLT X5, X6, start // BLT X5, X6, 2 // e3cc62ee
BLTU X5, X6, start // BLTU X5, X6, 2 // e3ea62ee
BGE X5, X6, start // BGE X5, X6, 2 // e3d862ee
BGEU X5, X6, start // BGEU X5, X6, 2 // e3f662ee
BEQ X5, X6, start // BEQ X5, X6, 2 // e38462f0
BNE X5, X6, start // BNE X5, X6, 2 // e39262f0
BLT X5, X6, start // BLT X5, X6, 2 // e3c062f0
BLTU X5, X6, start // BLTU X5, X6, 2 // e3ee62ee
BGE X5, X6, start // BGE X5, X6, 2 // e3dc62ee
BGEU X5, X6, start // BGEU X5, X6, 2 // e3fa62ee

// 2.6: Load and Store Instructions
LW (X5), X6 // 03a30200
Expand Down Expand Up @@ -271,7 +271,7 @@ start:
// These jumps can get printed as jumps to 2 because they go to the
// second instruction in the function. (The first instruction is an
// invisible stack pointer adjustment.)
JMP start // JMP 2 // 6ff01ff8
JMP start // JMP 2 // 6ff0dfcd
JMP (X5) // 67800200
JMP 4(X5) // 67804200

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/internal/obj/riscv/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
)

func init() {
obj.RegisterRegister(obj.RBaseRISCV, REG_END, regName)
obj.RegisterRegister(obj.RBaseRISCV, REG_END, RegName)
obj.RegisterOpcode(obj.ABaseRISCV, Anames)
}

func regName(r int) string {
func RegName(r int) string {
switch {
case r == 0:
return "NONE"
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/internal/obj/riscv/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,7 @@ func validateU(p *obj.Prog) {
// to represent this state?
return
}
wantImmU(p, "from", p.From, 20)
wantImmI(p, "from", p.From, 20)
wantIntRegAddr(p, "to", &p.To)
}

Expand Down Expand Up @@ -1601,7 +1601,7 @@ func encodeU(p *obj.Prog) uint32 {
// Rather than have the user/compiler generate a 32 bit constant, the
// bottommost bits of which must all be zero, instead accept just the
// top bits.
imm := immU(p.From, 20)
imm := immI(p.From, 20)
rd := regIAddr(p.To)
ins := encode(p.As)
if ins == nil {
Expand Down Expand Up @@ -1650,7 +1650,7 @@ func EncodeSImmediate(imm int64) (int64, error) {
}

func EncodeUImmediate(imm int64) (int64, error) {
if !immUFits(imm, 20) {
if !immIFits(imm, 20) {
return 0, fmt.Errorf("immediate %#x does not fit in 20 bits", imm)
}
return imm << 12, nil
Expand Down

0 comments on commit 1c193b2

Please sign in to comment.