]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add rva23u64 as a valid value for GORISCV64
authorMark Ryan <markdryan@rivosinc.com>
Mon, 2 Dec 2024 14:47:25 +0000 (15:47 +0100)
committerJoel Sing <joel@sing.id.au>
Wed, 5 Feb 2025 11:44:40 +0000 (03:44 -0800)
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>
src/cmd/go/alldocs.go
src/cmd/go/internal/help/helpdoc.go
src/cmd/go/testdata/script/tooltags.txt
src/cmd/internal/testdir/testdir_test.go
src/internal/buildcfg/cfg.go
src/internal/buildcfg/cfg_test.go
src/runtime/asm_riscv64.h

index b9cf7202c22337ae9786f4cee0210959ce68d96e..e28f68df6a0b526fa483ae825271f76dd4de9000 100644 (file)
 //     (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.
index d2f0fd173beef9c1965207b97730e5fc831f1445..e96849521525d62ff47c6b8344d1a488d91639d0 100644 (file)
@@ -646,8 +646,9 @@ Architecture-specific environment variables:
                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.
@@ -951,8 +952,8 @@ The defined architecture feature build tags are:
          (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.
 
index 1f6f54563ca97a52b4aade3d5a713007eb9dff03..a69b7a5c37b7463cb5d8d04a507296fe8116f078 100644 (file)
@@ -50,10 +50,15 @@ env GORISCV64=rva22u64
 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=
index 7469a6491aa4bbb9e3f2dc36ea7df5f87a71c497..29bd1f7cf81cb86c7abe98586d462d08dc8018c0 100644 (file)
@@ -1489,7 +1489,7 @@ var (
                "ppc64x":  {}, // A pseudo-arch representing both ppc64 and ppc64le
                "s390x":   {},
                "wasm":    {},
-               "riscv64": {"GORISCV64", "rva20u64", "rva22u64"},
+               "riscv64": {"GORISCV64", "rva20u64", "rva22u64", "rva23u64"},
        }
 )
 
index fca09bf8d3384a935582f6847af1389cfa204ba5..5ae4c0c7adc8fec633692cf20dd3254297fb55b4 100644 (file)
@@ -307,8 +307,10 @@ func goriscv64() int {
                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'
@@ -441,6 +443,9 @@ func gogoarchTags() []string {
                if GORISCV64 >= 22 {
                        list = append(list, GOARCH+"."+"rva22u64")
                }
+               if GORISCV64 >= 23 {
+                       list = append(list, GOARCH+"."+"rva23u64")
+               }
                return list
        case "wasm":
                var list []string
index 757270b7788f27c8805ba695dc4ddb49f977aac6..2bbd478280241ed0aa53175f8e540b9d28bb3354 100644 (file)
@@ -32,6 +32,10 @@ func TestConfigFlags(t *testing.T) {
        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 {
index d4deb093a66164a564f821f8c1f59d8a8ad2f06a..2414b9f067675af94fe72aa61a8e3b2fb03040b6 100644 (file)
 #define hasZbb
 #define hasZbs
 #endif
+
+#ifdef GORISCV64_rva23u64
+#define hasV
+#define hasZba
+#define hasZbb
+#define hasZbs
+#define hasZfa
+#define hasZicond
+#endif