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>
// (or ppc64le.power8, ppc64le.power9, and ppc64le.power10)
// feature build tags.
// - For GOARCH=riscv64,
-// GORISCV64=rva20u64 and rva22u64 correspond to the riscv64.rva20u64
-// and riscv64.rva22u64 build tags.
+// GORISCV64=rva20u64, rva22u64 and rva23u64 correspond to the riscv64.rva20u64,
+// riscv64.rva22u64 and riscv64.rva23u64 build tags.
// - For GOARCH=wasm, GOWASM=satconv and signext
// correspond to the wasm.satconv and wasm.signext feature build tags.
//
// Valid values are power8 (default), power9, power10.
// GORISCV64
// 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
+// and https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
// GOWASM
// For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use.
// Valid values are satconv, signext.
Valid values are power8 (default), power9, power10.
GORISCV64
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
+ and https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
GOWASM
For GOARCH=wasm, comma-separated list of experimental WebAssembly features to use.
Valid values are satconv, signext.
(or ppc64le.power8, ppc64le.power9, and ppc64le.power10)
feature build tags.
- For GOARCH=riscv64,
- GORISCV64=rva20u64 and rva22u64 correspond to the riscv64.rva20u64
- and riscv64.rva22u64 build tags.
+ GORISCV64=rva20u64, rva22u64 and rva23u64 correspond to the riscv64.rva20u64,
+ riscv64.rva22u64 and riscv64.rva23u64 build tags.
- For GOARCH=wasm, GOWASM=satconv and signext
correspond to the wasm.satconv and wasm.signext feature build tags.
go list -f '{{context.ToolTags}}'
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 GORISCV64=rva22
! 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 GORISCV64=
"ppc64x": {}, // A pseudo-arch representing both ppc64 and ppc64le
"s390x": {},
"wasm": {},
- "riscv64": {"GORISCV64", "rva20u64", "rva22u64"},
+ "riscv64": {"GORISCV64", "rva20u64", "rva22u64", "rva23u64"},
}
)
return 20
case "rva22u64":
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"):]
i := strings.IndexFunc(v, func(r rune) bool {
return r < '0' || r > '9'
if GORISCV64 >= 22 {
list = append(list, GOARCH+"."+"rva22u64")
}
+ if GORISCV64 >= 23 {
+ list = append(list, GOARCH+"."+"rva23u64")
+ }
return list
case "wasm":
var list []string
if goriscv64() != 22 {
t.Errorf("Wrong parsing of RISCV64=rva22u64")
}
+ os.Setenv("GORISCV64", "rva23u64")
+ if goriscv64() != 23 {
+ t.Errorf("Wrong parsing of RISCV64=rva23u64")
+ }
Error = nil
os.Setenv("GORISCV64", "rva22")
if _ = goriscv64(); Error == nil {
#define hasZbb
#define hasZbs
#endif
+
+#ifdef GORISCV64_rva23u64
+#define hasV
+#define hasZba
+#define hasZbb
+#define hasZbs
+#define hasZfa
+#define hasZicond
+#endif