-
Notifications
You must be signed in to change notification settings - Fork 18.7k
cmd/compile/internal/ssa: add codegen for Zicond extension on riscv64 #75577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
This PR (HEAD: f5f9d07) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/705996. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Mark Ryan: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
2f5ba88 to
58e1e0c
Compare
|
This PR (HEAD: 58e1e0c) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/705996. Important tips:
|
|
Message from Xueqi Luo: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Xueqi Luo: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Joel Sing: Patch Set 2: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Gopher Robot: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Gopher Robot: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Dmitri Shuralyov: Patch Set 2: Commit-Queue+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Go LUCI: Patch Set 2: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-10-17T20:47:34Z","revision":"a7132c18e5acb55b578bd3cbdeb82ffcd9700498"} Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Dmitri Shuralyov: Patch Set 2: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Go LUCI: Patch Set 2: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Go LUCI: Patch Set 2: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Michael Munday: Patch Set 2: (5 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
This PR (HEAD: 00604c6) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/705996. Important tips:
|
|
Message from Michael Munday: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
This PR (HEAD: 9e3f91a) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/705996. Important tips:
|
|
Message from Xueqi Luo: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Joel Sing: Patch Set 5: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Go LUCI: Patch Set 5: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-10-22T15:27:55Z","revision":"a78d7cefbf4d1e3b2df625c9389c8fa01f7aef09"} Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Joel Sing: Patch Set 5: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Go LUCI: Patch Set 5: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Go LUCI: Patch Set 5: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Michael Munday: Patch Set 5: (9 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
9e3f91a to
cd67025
Compare
|
This PR (HEAD: cd67025) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/705996. Important tips:
|
|
Message from Xueqi Luo: Patch Set 6: (15 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Michael Munday: Patch Set 6: Code-Review+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
f87591b to
29e37a3
Compare
|
Message from Xueqi Luo: Patch Set 22: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
This PR (HEAD: 29e37a3) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/705996. Important tips:
|
|
Message from Meng Zhuo: Patch Set 23: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Joel Sing: Patch Set 22: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
This PR (HEAD: 7a61508) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/705996. Important tips:
|
|
Message from Xueqi Luo: Patch Set 27: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Joel Sing: Patch Set 27: Commit-Queue+1 (6 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Go LUCI: Patch Set 27: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-12-09T14:13:58Z","revision":"508280f1378d92be12d2466089e8f9904467054d"} Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Joel Sing: Patch Set 27: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Go LUCI: Patch Set 27: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
|
Message from Go LUCI: Patch Set 27: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/705996. |
Zicond is a mandatory extension in rva23u64. This patch converts
branches to CondSelect and optimizes them to Zicond instructions
on RISC-V, along with additional optimization rules.
Zicond can provide performance benefits on unpredictable branches by
avoiding branch misprediction penalties. However, on simple predictable
branches, zicond uses 4 instructions vs 2 for traditional branches,
which can cause performance regressions.
To avoid regressions, we keep CondSelect globally disabled for riscv64
and only enable it for the ConstantTimeSelect intrinsic,
which has been shown to benefit from zicond:
goos: linux
goarch: riscv64
pkg: crypto/subtle
CPU: SG2044
│ nozicond.txt │ zicond.txt │
│ sec/op │ sec/op vs base │
ConstantTimeSelect-44 2.325n ± 4% 1.750n ± 2% -24.69% (p=0.000 n=10)
Future work can explore enabling zicond for other cases that can benefit
from zicond.
Follow-up to CL 631595
Updates #75350
Co-authored-by: wangpengcheng.pp@bytedance.com
mengzhuo1203@gmail.com