cmd/asm,cmd/internal/obj/riscv: provide branch pseudo-instructions

Implement various branch pseudo-instructions for riscv64. These make it easier
to read/write assembly and will also make it easier for the compiler to generate
optimised code.

Change-Id: Ic31a7748c0e1495522ebecf34b440842b8d12c04
Reviewed-on: https://go-review.googlesource.com/c/go/+/226397
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Joel Sing 2020-03-31 01:57:52 +11:00
parent d98023ebb5
commit a3d8c210ad
8 changed files with 311 additions and 12 deletions

View file

@ -12,6 +12,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"testing"
)
@ -131,3 +132,20 @@ TEXT _stub(SB),$0-0
t.Errorf("%v\n%s", err, out)
}
}
func TestBranch(t *testing.T) {
if testing.Short() {
t.Skip("Skipping in short mode")
}
if runtime.GOARCH != "riscv64" {
t.Skip("Requires riscv64 to run")
}
testenv.MustHaveGoBuild(t)
cmd := exec.Command(testenv.GoToolPath(t), "test")
cmd.Dir = "testdata/testbranch"
if out, err := testenv.CleanCmdEnv(cmd).CombinedOutput(); err != nil {
t.Errorf("Branch test failed: %v\n%s", err, out)
}
}