Skip to content

Commit 26aa8d6

Browse files
markdryangopherbot
authored andcommitted
runtime: add asm_riscv64.h
asm_riscv64.h will be used to define macros for each riscv64 extension that is not part of the rva20u64 base profile but that the _riscv64.s assembly files are allowed to use because the user has specified a more capable profile in the GORISCV64 variable. This will allow us, for example, to test for the hasZba macro in those assembly files instead of the GORISCV64_rva22u64 macro before using a Zba instruction. This is important as it means that in the future when we add support for new profiles that support Zba, e.g., rva23u64, we only need to update asm_riscv64.h to indicate rva23u64 supports Zba. We will not need to update every assembly language file that already uses Zba instructions. Updates #61476 Change-Id: I83abfeb20d08a87ac8ea88f4d8a93437f0631353 Reviewed-on: https://go-review.googlesource.com/c/go/+/608255 Auto-Submit: Tim King <[email protected]> Reviewed-by: Tim King <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Meng Zhuo <[email protected]> Reviewed-by: Joel Sing <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 5d06d16 commit 26aa8d6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/cmd/dist/build.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,8 @@ func runInstall(pkg string, ch chan struct{}) {
845845
pathf("%s/src/runtime/asm_ppc64x.h", goroot), 0)
846846
copyfile(pathf("%s/pkg/include/asm_amd64.h", goroot),
847847
pathf("%s/src/runtime/asm_amd64.h", goroot), 0)
848+
copyfile(pathf("%s/pkg/include/asm_riscv64.h", goroot),
849+
pathf("%s/src/runtime/asm_riscv64.h", goroot), 0)
848850
}
849851

850852
// Generate any missing files; regenerate existing ones.

src/runtime/asm_riscv64.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2024 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// Define features that are guaranteed to be supported by setting the GORISCV64 variable.
6+
// If a feature is supported, there's no need to check it at runtime every time.
7+
8+
#ifdef GORISCV64_rva22u64
9+
#define hasZba
10+
#define hasZbb
11+
#define hasZbs
12+
#endif

0 commit comments

Comments
 (0)