go/analysis/passes/asmdecl: define register-ABI result registers for RISCV64

Change-Id: I7f88d31186704a7d83637acdf127e0522d725289
Reviewed-on: https://go-review.googlesource.com/c/tools/+/443575
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
wdvxdr 2022-10-18 11:39:53 +08:00 committed by Meng Zhuo
parent 2dcdbd43ac
commit 8166dca1ce
3 changed files with 20 additions and 6 deletions

View File

@ -92,7 +92,7 @@ var (
asmArchMips64LE = asmArch{name: "mips64le", bigEndian: false, stack: "R29", lr: true}
asmArchPpc64 = asmArch{name: "ppc64", bigEndian: true, stack: "R1", lr: true, retRegs: []string{"R3", "F1"}}
asmArchPpc64LE = asmArch{name: "ppc64le", bigEndian: false, stack: "R1", lr: true, retRegs: []string{"R3", "F1"}}
asmArchRISCV64 = asmArch{name: "riscv64", bigEndian: false, stack: "SP", lr: true}
asmArchRISCV64 = asmArch{name: "riscv64", bigEndian: false, stack: "SP", lr: true, retRegs: []string{"X10", "F10"}}
asmArchS390X = asmArch{name: "s390x", bigEndian: true, stack: "R15", lr: true}
asmArchWasm = asmArch{name: "wasm", bigEndian: false, stack: "SP", lr: false}

View File

@ -19,11 +19,12 @@ var goosarches = []string{
"linux/arm", // asm3.s
// TODO: skip test on loong64 until go toolchain supported loong64.
// "linux/loong64", // asm10.s
"linux/mips64", // asm5.s
"linux/s390x", // asm6.s
"linux/ppc64", // asm7.s
"linux/mips", // asm8.s,
"js/wasm", // asm9.s
"linux/mips64", // asm5.s
"linux/s390x", // asm6.s
"linux/ppc64", // asm7.s
"linux/mips", // asm8.s,
"js/wasm", // asm9.s
"linux/riscv64", // asm11.s
}
func Test(t *testing.T) {

View File

@ -0,0 +1,13 @@
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build riscv64
// writing to result in ABIInternal function
TEXT ·returnABIInternal<ABIInternal>(SB), NOSPLIT, $8
MOV $123, X10
RET
TEXT ·returnmissingABIInternal<ABIInternal>(SB), NOSPLIT, $8
MOV $123, X20
RET // want `RET without writing to result register`