Skip to content

【DEBUG: DO NOT REVIEW】Fp test on go1263 - #147

Draft
lxq015 wants to merge 4 commits into
go1.26.3-zte-devfrom
fp_test_on_go1263
Draft

lxq015 wants to merge 4 commits into
go1.26.3-zte-devfrom
fp_test_on_go1263

Conversation

@lxq015

@lxq015 lxq015 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

…ts on riscv64

On RISC-V the JAL and JALR instructions provide Return Address
Stack(RAS) prediction hints based on the registers used (as per section
2.5.1 of the RISC-V ISA manual). When a JALR instruction uses X1 or X5
as the source register, it hints that a pop should occur.

When making a function call, avoid the use of X5 as a source register
since this results in the RAS performing a pop-then-push instead of a
push, breaking call/return pairing and significantly degrading front-end
branch prediction performance.

Based on test result of golang.org/x/benchmarks/json on SpacemiT K1, fix
version has a performance improvement of about 7%

Fixes golang#76654

Change-Id: I867c8d7cfb54f5decbe176f3ab3bb3d78af1cf64
Reviewed-on: https://go-review.googlesource.com/c/go/+/726760
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
This CL implements hardware frame pointer support for riscv64.

The stack layout is similar to arm64, but with the following specifics:
- The FP register points to SP+8.
- The return address (LR) is stored at SP.
- The caller's FP is stored at SP-8.

Change-Id: I3bc7af2abb024ea0b0e3432ed517641c6707f7a2
@lxq015
lxq015 marked this pull request as draft June 29, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants