mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
cmd/go: add rva23u64 as a valid value for GORISCV64
The RVA23 profile was ratified on the 21st of October 2024. https://riscv.org/announcements/2024/10/risc-v-announces-ratification-of-the-rva23-profile-standard/ Now that it's ratified we can add rva23u64 as a valid value for the GORISCV64 environment variable. This will allow the compiler and assembler to generate instructions made mandatory by the new profile without a runtime check. Examples of such instructions include those introduced by the Vector and Zicond extensions. Setting GORISCV64=rva23u64 defines the riscv64.rva20u64, riscv64.rva22u64 and riscv64.rva23u64 build tags, sets the internal variable buildcfg.GORISCV64 to 23 and defines the macros GORISCV64_rva23u64, hasV, hasZba, hasZbb, hasZbs, hasZfa, and hasZicond for use in assembly language code. Updates #61476 Change-Id: I7641c23084fa52891c9a18df58f4013cb6597d88 Reviewed-on: https://go-review.googlesource.com/c/go/+/633417 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
This commit is contained in:
parent
842e4b5207
commit
664aebab7d
@ -2100,8 +2100,8 @@
|
|||||||
// (or ppc64le.power8, ppc64le.power9, and ppc64le.power10)
|
// (or ppc64le.power8, ppc64le.power9, and ppc64le.power10)
|
||||||
// feature build tags.
|
// feature build tags.
|
||||||
// - For GOARCH=riscv64,
|
// - For GOARCH=riscv64,
|
||||||
// GORISCV64=rva20u64 and rva22u64 correspond to the riscv64.rva20u64
|
// GORISCV64=rva20u64, rva22u64 and rva23u64 correspond to the riscv64.rva20u64,
|
||||||
// and riscv64.rva22u64 build tags.
|
// riscv64.rva22u64 and riscv64.rva23u64 build tags.
|
||||||
// - For GOARCH=wasm, GOWASM=satconv and signext
|
// - For GOARCH=wasm, GOWASM=satconv and signext
|
||||||
// correspond to the wasm.satconv and wasm.signext feature build tags.
|
// correspond to the wasm.satconv and wasm.signext feature build tags.
|
||||||
//
|
//
|
||||||
@ -2473,8 +2473,9 @@
|
|||||||
// Valid values are power8 (default), power9, power10.
|
// Valid values are power8 (default), power9, power10.
|
||||||
// GORISCV64
|
// GORISCV64
|
||||||
// For GOARCH=riscv64, the RISC-V user-mode application profile for which
|
// For GOARCH=riscv64, the RISC-V user-mode application profile for which
|
||||||
// to compile. Valid values are rva20u64 (default), rva22u64.
|
// to compile. Valid values are rva20u64 (default), rva22u64, rva23u64.
|
||||||
// See https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc
|
// See https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc
|
||||||
|
// and https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
|
||||||
// GOWASM
|
// GOWASM
|
||||||
// For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use.
|
// For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use.
|
||||||
// Valid values are satconv, signext.
|
// Valid values are satconv, signext.
|
||||||
|
@ -646,8 +646,9 @@ Architecture-specific environment variables:
|
|||||||
Valid values are power8 (default), power9, power10.
|
Valid values are power8 (default), power9, power10.
|
||||||
GORISCV64
|
GORISCV64
|
||||||
For GOARCH=riscv64, the RISC-V user-mode application profile for which
|
For GOARCH=riscv64, the RISC-V user-mode application profile for which
|
||||||
to compile. Valid values are rva20u64 (default), rva22u64.
|
to compile. Valid values are rva20u64 (default), rva22u64, rva23u64.
|
||||||
See https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc
|
See https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc
|
||||||
|
and https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
|
||||||
GOWASM
|
GOWASM
|
||||||
For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use.
|
For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use.
|
||||||
Valid values are satconv, signext.
|
Valid values are satconv, signext.
|
||||||
@ -951,8 +952,8 @@ The defined architecture feature build tags are:
|
|||||||
(or ppc64le.power8, ppc64le.power9, and ppc64le.power10)
|
(or ppc64le.power8, ppc64le.power9, and ppc64le.power10)
|
||||||
feature build tags.
|
feature build tags.
|
||||||
- For GOARCH=riscv64,
|
- For GOARCH=riscv64,
|
||||||
GORISCV64=rva20u64 and rva22u64 correspond to the riscv64.rva20u64
|
GORISCV64=rva20u64, rva22u64 and rva23u64 correspond to the riscv64.rva20u64,
|
||||||
and riscv64.rva22u64 build tags.
|
riscv64.rva22u64 and riscv64.rva23u64 build tags.
|
||||||
- For GOARCH=wasm, GOWASM=satconv and signext
|
- For GOARCH=wasm, GOWASM=satconv and signext
|
||||||
correspond to the wasm.satconv and wasm.signext feature build tags.
|
correspond to the wasm.satconv and wasm.signext feature build tags.
|
||||||
|
|
||||||
|
7
src/cmd/go/testdata/script/tooltags.txt
vendored
7
src/cmd/go/testdata/script/tooltags.txt
vendored
@ -50,10 +50,15 @@ env GORISCV64=rva22u64
|
|||||||
go list -f '{{context.ToolTags}}'
|
go list -f '{{context.ToolTags}}'
|
||||||
stdout 'riscv64.rva20u64 riscv64.rva22u64'
|
stdout 'riscv64.rva20u64 riscv64.rva22u64'
|
||||||
|
|
||||||
|
env GOARCH=riscv64
|
||||||
|
env GORISCV64=rva23u64
|
||||||
|
go list -f '{{context.ToolTags}}'
|
||||||
|
stdout 'riscv64.rva20u64 riscv64.rva22u64 riscv64.rva23u64'
|
||||||
|
|
||||||
env GOARCH=riscv64
|
env GOARCH=riscv64
|
||||||
env GORISCV64=rva22
|
env GORISCV64=rva22
|
||||||
! go list -f '{{context.ToolTags}}'
|
! go list -f '{{context.ToolTags}}'
|
||||||
stderr 'go: invalid GORISCV64: must be rva20u64, rva22u64'
|
stderr 'go: invalid GORISCV64: must be rva20u64, rva22u64, rva23u64'
|
||||||
|
|
||||||
env GOARCH=riscv64
|
env GOARCH=riscv64
|
||||||
env GORISCV64=
|
env GORISCV64=
|
||||||
|
@ -1489,7 +1489,7 @@ var (
|
|||||||
"ppc64x": {}, // A pseudo-arch representing both ppc64 and ppc64le
|
"ppc64x": {}, // A pseudo-arch representing both ppc64 and ppc64le
|
||||||
"s390x": {},
|
"s390x": {},
|
||||||
"wasm": {},
|
"wasm": {},
|
||||||
"riscv64": {"GORISCV64", "rva20u64", "rva22u64"},
|
"riscv64": {"GORISCV64", "rva20u64", "rva22u64", "rva23u64"},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -307,8 +307,10 @@ func goriscv64() int {
|
|||||||
return 20
|
return 20
|
||||||
case "rva22u64":
|
case "rva22u64":
|
||||||
return 22
|
return 22
|
||||||
|
case "rva23u64":
|
||||||
|
return 23
|
||||||
}
|
}
|
||||||
Error = fmt.Errorf("invalid GORISCV64: must be rva20u64, rva22u64")
|
Error = fmt.Errorf("invalid GORISCV64: must be rva20u64, rva22u64, rva23u64")
|
||||||
v := DefaultGORISCV64[len("rva"):]
|
v := DefaultGORISCV64[len("rva"):]
|
||||||
i := strings.IndexFunc(v, func(r rune) bool {
|
i := strings.IndexFunc(v, func(r rune) bool {
|
||||||
return r < '0' || r > '9'
|
return r < '0' || r > '9'
|
||||||
@ -441,6 +443,9 @@ func gogoarchTags() []string {
|
|||||||
if GORISCV64 >= 22 {
|
if GORISCV64 >= 22 {
|
||||||
list = append(list, GOARCH+"."+"rva22u64")
|
list = append(list, GOARCH+"."+"rva22u64")
|
||||||
}
|
}
|
||||||
|
if GORISCV64 >= 23 {
|
||||||
|
list = append(list, GOARCH+"."+"rva23u64")
|
||||||
|
}
|
||||||
return list
|
return list
|
||||||
case "wasm":
|
case "wasm":
|
||||||
var list []string
|
var list []string
|
||||||
|
@ -32,6 +32,10 @@ func TestConfigFlags(t *testing.T) {
|
|||||||
if goriscv64() != 22 {
|
if goriscv64() != 22 {
|
||||||
t.Errorf("Wrong parsing of RISCV64=rva22u64")
|
t.Errorf("Wrong parsing of RISCV64=rva22u64")
|
||||||
}
|
}
|
||||||
|
os.Setenv("GORISCV64", "rva23u64")
|
||||||
|
if goriscv64() != 23 {
|
||||||
|
t.Errorf("Wrong parsing of RISCV64=rva23u64")
|
||||||
|
}
|
||||||
Error = nil
|
Error = nil
|
||||||
os.Setenv("GORISCV64", "rva22")
|
os.Setenv("GORISCV64", "rva22")
|
||||||
if _ = goriscv64(); Error == nil {
|
if _ = goriscv64(); Error == nil {
|
||||||
|
@ -10,3 +10,12 @@
|
|||||||
#define hasZbb
|
#define hasZbb
|
||||||
#define hasZbs
|
#define hasZbs
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GORISCV64_rva23u64
|
||||||
|
#define hasV
|
||||||
|
#define hasZba
|
||||||
|
#define hasZbb
|
||||||
|
#define hasZbs
|
||||||
|
#define hasZfa
|
||||||
|
#define hasZicond
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user