aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
AgeCommit message (Collapse)Author
2026-03-06cmd/compile: use the correct const when flagging indirect map elem typesKirill Primak
Currently both MapMaxKeyBytes and MapMaxElemBytes are 128 so there's no functional change. Change-Id: If687739104717ac5d0d7210fb64ae5e50b80ea95 GitHub-Last-Rev: fb099ebc0e239ea6c0d14fa3059821d0c839a1b8 GitHub-Pull-Request: golang/go#77979 Reviewed-on: https://go-review.googlesource.com/c/go/+/752240 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-05cmd/go/internal/vet: add missing newlines to log messagesAlan Donovan
Change-Id: I56e0f025655699e3d71769376d1996852cf35038 Reviewed-on: https://go-review.googlesource.com/c/go/+/742380 Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Alan Donovan <adonovan@google.com>
2026-03-04cmd/compile: fix ICE when indexing zero-sized arrays of non-SSAable typesMateusz Poliwczak
Fixes #77868 Change-Id: I3348825e24a71595c514113497db365a6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/749881 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com>
2026-03-04runtime, cmd/compile: use preemptible memclr for large pointer-free clears“Muhammad
Large memory clearing operations (via clear() or large slice allocation) currently use non-preemptible assembly loops. This blocks the Garbage Collector from performing a Stop The World (STW) event, leading to significant tail latency or even indefinite hangs in tight loops. This change introduces memclrNoHeapPointersPreemptible, which chunks clears into 256KB blocks with preemption checks. The compiler's walk phase is updated to emit this call for large pointer-free clears. To prevent regressions, SSA rewrite rules are added to ensure that constant-size clears (which are common and small) continue to be inlined into OpZero assembly. Benchmarks on darwin/arm64: - STW with 50MB clear: Improved from 'Hung' to ~500µs max pause. - Small clears (5-64B): No measurable regression. - Large clears (1M-64M): No measurable regression. Fixes #69327 Change-Id: Ide14d6bcdca1f60d6ac95443acb57da9a8822538 Reviewed-on: https://go-review.googlesource.com/c/go/+/750480 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-04cmd/go: update go help entries to focus on modulesMichael Matloob
Some of the go help entries, especially go help packages, primarily explained GOPATH mode behavior. While building legacy projects in GOPATH mode will continue to be supported by the go command, it is now a very niche use case, and the docs should focus on modules. This CL updates go help to focus on modules primarily. Fixes #57655 Fixes #57355 Fixes #30131 Fixes #37227 Fixes #27957 Change-Id: I6b33ed920b0ce233301fe8b9bd21bfc35f9a79b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/664235 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Auto-Submit: Michael Matloob <matloob@google.com>
2026-03-04cmd/go: revert update default go directive in mod or work initMichael Matloob
This restores the previous behavior of setting go directive to the toolchain's version as per #77653. Fixes #77653 Change-Id: Ie9d2de025a75f39fd8d6d01776d0cf4e5da954f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/749980 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Alexander <jitsu@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Cherry Mui <cherryyz@google.com>
2026-03-04cmd/link: support Mach-O UNSIGNED relocations for dynamic imports on darwinGeorge Adams
When internally linking darwin binaries, the linker rejected Mach-O UNSIGNED (pointer) relocations targeting dynamic import symbols, producing errors like: unexpected reloc for dynamic symbol _swift_FORCE_LOAD_$_swiftIOKit These relocations are legitimate and appear in data sections (e.g. __DATA/__const) of object files that reference external symbols such as Swift force-load symbols. The dynamic linker (dyld) needs to bind these pointers at load time. Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64_15,gotip-darwin-amd64_14 Change-Id: I1cc759dec28b8aa076602a45062f403d0d9f45fe Reviewed-on: https://go-review.googlesource.com/c/go/+/745220 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2026-03-02cmd/compile: optimize sccp for faster convergenceYi Yang
While investigating other optimizations, I found several opportunities to accelerate sccp convergence: - Avoid adding duplicate uses to the re-visit worklist - Prevent queueing uses of values that have already reached the Bottom - Add an early exit when processing a value that is already Bottom These changes provide an overall speedup of ~9% for sccp phase during a full make.bash run. Also they does not change the number of constants found or the amount of dead code eliminated. Updates #77325 Change-Id: Iaf83f6ea355eed366c3d09fc38f85561634a5a16 GitHub-Last-Rev: 078c3d309cc1f1e4b7f7a40635ffc4506f2ac1c6 GitHub-Pull-Request: golang/go#77399 Reviewed-on: https://go-review.googlesource.com/c/go/+/740980 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org>
2026-03-02cmd/compile, simd/archsimd: add VPSRL immeidate peepholesJunyang Shao
Before this CL, the simdgen contains a sign check to selectively enable such rules for deduplication purposes. This left out `VPSRL` as it's only available in unsigned form. This CL fixes that. It looks like the previous documentation fix to SHA instruction might not had run go generate, so this CL also contains the generated code for that fix. There is also a weird phantom import in cmd/compile/internal/ssa/issue77582_test.go This CL also fixes that The trybot didn't complain? Change-Id: Ibbf9f789c1a67af1474f0285ab376bc07f17667e Reviewed-on: https://go-review.googlesource.com/c/go/+/748501 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-03-02cmd/compile: add concurrency-ok property to some compiler debug flagsDavid Chase
The property was missing from some flags that we potentially care about. This change only affects flags supplied in the command line (not explicitly changed within the compiler) but nonetheless it seems like a good idea to get them right -- we might adjust them on the command line, someone might read the code and wonder why they're unset. Change-Id: I44812ddea640b71c078594317ef3506ab055a37b Reviewed-on: https://go-review.googlesource.com/c/go/+/452876 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-03-02all: test: remove unneeded loop variablesAriel Otilibili
This CL follows from the abandoned CL 722961. Alan Donovan asked if modernize would catch these changes; it does in part. Here is how modernize was used: 1. Build the Go compiler from latest master 2. Clone x/tools and build modernize with the newest compiler 3. Then, do: PATH=PATH_TO_BIN:$PATH go list ./... | xargs env PATH=PATH_TO_BIN:$PATH GOMOD=off MODERNIZE -forvar -fix -test -debug fpstv 4. For assurance, move into a package directory (i.e, cmd), and redo Step 3. From the obtained result, it seems modernize did not remove the loop variable when: - the range notation was not used - the loop variable was not directly under the for directive. Which does happens here: # git ls-files | xargs -I {} perl -nE 'print "$ARGV:$.:$_" if /\s+(\w+) := \1$/' {} | grep _test [...] cmd/compile/internal/types2/api_test.go:2423: i := i md/go/internal/modload/query_test.go:182: tt := tt md/go/internal/web/url_test.go:17: tc := tc cmd/go/internal/web/url_test.go:49: tc := tc cmd/internal/par/queue_test.go:54: i := i runtime/syscall_windows_test.go:781: arglen := arglen Link: https://go-review.googlesource.com/c/go/+/722961/comments/e8d47866_fc399fa1 Co-authored-by: Plamerdi Makela <plamerdi447@gmail.com> Fixes #76411 Change-Id: I0c191cdca70dbea6efaf6796dca9c60e2afcd9ea GitHub-Last-Rev: 77c3e11fc21a4ede70b733b567a1690edb944dc1 GitHub-Pull-Request: golang/go#77694 Reviewed-on: https://go-review.googlesource.com/c/go/+/746502 Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2026-03-01cmd/compile: combine some generic AMD64 simplificationsJakub Ciolek
Saves a few lines. If applicable, we also directly rewrite to 32 bit MOVLconst, skipping the redundant transformation. Change-Id: I4c2f5e2bb480e798cbe373de608e19a951d168ff Reviewed-on: https://go-review.googlesource.com/c/go/+/640215 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-01cmd/compile: (wasm) optimize float32(round64(float64(x)))David Chase
Not a fix because there are other architectures still to be done. Updates #75463. Change-Id: Ia5233c2b6c5f4439e269950efdd851e72e8e7ff6 Reviewed-on: https://go-review.googlesource.com/c/go/+/730160 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-01cmd/compile: (arm64) optimize float32(round64(float64(x)))David Chase
Not a fix because there are other architectures still to be done. Updates #75463. Change-Id: Ifca03975023e4e5d0ffa98d1f877314a1a291be0 Reviewed-on: https://go-review.googlesource.com/c/go/+/729161 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-01cmd/compile: (amd64) optimize float32(round64(float64(x)))David Chase
Not a fix because there are other architectures still to be done. Updates #75463. Change-Id: I3d7754ce4a26af0f5c4ef0be1254d164e68f8442 Reviewed-on: https://go-review.googlesource.com/c/go/+/729160 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2026-03-01cmd/compile: cleanup downward counting loop codeJorropo
- tweak the comment a bit to remove repetition - hoist to it's own function; I needed to move it into the else clause for a future patch so if I'm moving all of this logic around might as well put it in a function. Change-Id: Id8d88c2c29a45427b025e0b7846412434f87853d Reviewed-on: https://go-review.googlesource.com/c/go/+/736021 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-28cmd/internal/obj/loong64: change to get the opcodes of assembly instructions ↵limeidan
from a map Change-Id: I0b481bea96d78d931070a96c392fb329195d17de Reviewed-on: https://go-review.googlesource.com/c/go/+/748380 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-27cmd/compile: canonicalize [0,1] == 1 & [0,1] != 1 → != 0 & == 0Jorropo
Here are all the hits while building go: archive/zip/reader.go:585:8: Rewrote v126 (Eq64) v37 argument is boolean-like; rewrote to Neq64 against 0 crypto/internal/fips140/aes/gcm/ghash.go:115:8: Rewrote v21 (Eq64) v11 argument is boolean-like; rewrote to Neq64 against 0 crypto/internal/fips140/mldsa/mldsa.go:68:86: Rewrote v89 (Eq64) v86 argument is boolean-like; rewrote to Neq64 against 0 crypto/internal/fips140/nistec/p256_asm.go:162:25: Rewrote v80 (Neq64) v76 argument is boolean-like; rewrote to Eq64 against 0 crypto/internal/fips140/nistec/p256_asm.go:266:22: Rewrote v113 (Neq64) v109 argument is boolean-like; rewrote to Eq64 against 0 crypto/internal/fips140/nistec/p256_asm.go:483:20: Rewrote v74 (Eq64) v69 argument is boolean-like; rewrote to Neq64 against 0 crypto/internal/fips140/nistec/p256_asm.go:521:20: Rewrote v76 (Eq64) v71 argument is boolean-like; rewrote to Neq64 against 0 crypto/internal/fips140/nistec/p256_asm.go:546:20: Rewrote v74 (Eq64) v69 argument is boolean-like; rewrote to Neq64 against 0 crypto/internal/fips140/rsa/keygen.go:22:27: Rewrote v45 (Eq64) v43 argument is boolean-like; rewrote to Neq64 against 0 crypto/internal/fips140/rsa/pkcs1v22.go:469:58: Rewrote v448 (Neq64) v447 argument is boolean-like; rewrote to Eq64 against 0 math/fma.go:170:55: Rewrote v349 (Eq64) v348 argument is boolean-like; rewrote to Neq64 against 0 net/http/h2_bundle.go:12020:11: Rewrote v233 (Eq64) v307 argument is boolean-like; rewrote to Neq64 against 0 time/time.go:1864:14: Rewrote v150 (Neq64) v149 argument is boolean-like; rewrote to Eq64 against 0 It optimize things like: if bits < 2048 || bits%2 == 1 { to: if bits < 2048 || bits%2 != 0 { Change-Id: Ic72e9212a44bf8b2d267bef0138249c66798dcba Reviewed-on: https://go-review.googlesource.com/c/go/+/727241 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-02-27cmd/compile: test that time.Duration.String is inlineableDaniel Martí
This matters for encodings supporting time.Duration, which cannot add an AppendText method due to the encoding package godoc: Adding encoding/decoding methods to existing types may constitute a breaking change, [...] The policy for packages maintained by the Go project is to only allow the addition of marshaling functions if no existing, reasonable marshaling exists. And indeed, time.Duration does have an existing marshaling today: as an integer, which encoding/json still uses to this day. Thankfully, with the String method being inlineable, we can rely on the following not allocating in the heap: var td time.Duration = ... b = append(b, td.String()...) Lock this in so that we can rely on this pattern going forward. For #77851. Change-Id: I57ce0bc099f293b0e36aa4c74b5410f8bda347a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/750100 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2026-02-27cmd/compile: fix internal compiler error: bad write barrier typeFrancisco Ferraz
This change fixes an issue where the compiler panics with 'bad write barrier type' for zero-sized arrays. The loops in storeTypeScalars and storeTypePtrs erroneously processed zero-sized arrays causing invalid operations. This ignores them. Fixes #77815 Change-Id: I0db1b924fc63a75f1bed7488e2dc54d2de5dc0b2 Reviewed-on: https://go-review.googlesource.com/c/go/+/749380 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-27cmd/compile: use OpMove instead of memmove more on loong64Guoqi Chen
OpMove is faster for small moves of fixed size. goos: linux goarch: loong64 pkg: runtime cpu: Loongson-3A6000 @ 2500.00MHz | old.txt | new.txt | | sec/op | sec/op vs base | Memmove/0 2.225n ± 2% 2.424n ± 1% +8.94% (p=0.000 n=8) Memmove/1 2.813n ± 0% 2.562n ± 1% -8.94% (p=0.000 n=8) Memmove/2 2.538n ± 3% 2.572n ± 1% +1.32% (p=0.001 n=8) Memmove/3 2.807n ± 0% 2.804n ± 0% -0.11% (p=0.024 n=8) Memmove/4 2.531n ± 2% 2.803n ± 0% +10.72% (p=0.000 n=8) Memmove/5 3.203n ± 0% 2.809n ± 0% -12.29% (p=0.000 n=8) Memmove/6 3.203n ± 0% 2.811n ± 0% -12.24% (p=0.000 n=8) Memmove/7 3.203n ± 0% 2.809n ± 0% -12.30% (p=0.000 n=8) Memmove/8 2.804n ± 0% 2.803n ± 0% ~ (p=0.321 n=8) Memmove/9 3.203n ± 0% 3.203n ± 0% ~ (p=1.000 n=8) Memmove/10 3.203n ± 0% 3.203n ± 0% ~ (p=1.000 n=8) Memmove/11 3.203n ± 0% 3.203n ± 0% ~ (p=1.000 n=8) Memmove/12 3.202n ± 0% 3.202n ± 0% ~ (p=0.282 n=8) Memmove/13 3.202n ± 0% 3.202n ± 0% ~ (p=1.000 n=8) Memmove/14 3.203n ± 0% 3.203n ± 0% ~ (p=0.318 n=8) Memmove/15 3.203n ± 0% 3.203n ± 0% ~ (p=1.000 n=8) Memmove/16 3.203n ± 0% 3.203n ± 0% ~ (p=1.000 n=8) Memmove/32 3.603n ± 0% 3.603n ± 0% ~ (p=1.000 n=8) Memmove/64 4.204n ± 0% 4.204n ± 0% ~ (p=1.000 n=8) MemmoveOverlap/32 4.004n ± 0% 4.004n ± 0% ~ (p=0.993 n=8) MemmoveOverlap/64 4.804n ± 0% 4.604n ± 0% -4.16% (p=0.000 n=8) MemmoveOverlap/128 8.007n ± 0% 7.607n ± 0% -5.00% (p=0.000 n=8) MemmoveUnalignedDst/0 2.805n ± 0% 2.426n ± 0% -13.53% (p=0.000 n=8) MemmoveUnalignedDst/1 3.603n ± 0% 2.554n ± 1% -29.13% (p=0.000 n=8) MemmoveUnalignedDst/2 3.203n ± 0% 3.145n ± 0% -1.83% (p=0.000 n=8) MemmoveUnalignedDst/3 3.603n ± 0% 2.807n ± 0% -22.10% (p=0.000 n=8) MemmoveUnalignedDst/4 3.203n ± 0% 2.865n ± 0% -10.57% (p=0.000 n=8) MemmoveUnalignedDst/5 4.004n ± 0% 2.845n ± 0% -28.96% (p=0.000 n=8) MemmoveUnalignedDst/6 4.004n ± 0% 2.841n ± 0% -29.06% (p=0.000 n=8) MemmoveUnalignedDst/7 4.003n ± 0% 2.840n ± 0% -29.06% (p=0.000 n=8) MemmoveUnalignedDst/8 3.603n ± 0% 3.203n ± 0% -11.10% (p=0.000 n=8) MemmoveUnalignedDst/9 4.004n ± 0% 3.204n ± 0% -19.98% (p=0.000 n=8) MemmoveUnalignedDst/10 4.003n ± 0% 3.204n ± 0% -19.97% (p=0.000 n=8) MemmoveUnalignedDst/11 4.004n ± 0% 3.204n ± 0% -19.98% (p=0.000 n=8) MemmoveUnalignedDst/12 4.004n ± 0% 3.203n ± 0% -20.00% (p=0.000 n=8) MemmoveUnalignedDst/13 4.003n ± 0% 3.202n ± 0% -20.01% (p=0.000 n=8) MemmoveUnalignedDst/14 4.003n ± 0% 3.204n ± 0% -19.97% (p=0.000 n=8) MemmoveUnalignedDst/15 4.003n ± 0% 3.204n ± 0% -19.97% (p=0.000 n=8) MemmoveUnalignedDst/16 4.003n ± 0% 3.204n ± 0% -19.97% (p=0.000 n=8) MemmoveUnalignedDst/32 4.004n ± 0% 4.004n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedDst/64 7.607n ± 0% 7.607n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedDstOverlap/32 4.805n ± 2% 4.636n ± 1% -3.51% (p=0.000 n=8) MemmoveUnalignedDstOverlap/64 8.007n ± 0% 8.007n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedDstOverlap/128 9.066n ± 0% 9.033n ± 1% -0.37% (p=0.014 n=8) MemmoveUnalignedSrc/0 2.803n ± 0% 2.418n ± 1% -13.74% (p=0.000 n=8) MemmoveUnalignedSrc/1 3.603n ± 0% 2.543n ± 0% -29.42% (p=0.000 n=8) MemmoveUnalignedSrc/2 3.203n ± 0% 2.478n ± 1% -22.65% (p=0.000 n=8) MemmoveUnalignedSrc/3 3.603n ± 0% 2.803n ± 0% -22.20% (p=0.000 n=8) MemmoveUnalignedSrc/4 3.203n ± 0% 2.804n ± 0% -12.47% (p=0.000 n=8) MemmoveUnalignedSrc/5 4.003n ± 0% 2.817n ± 0% -29.62% (p=0.000 n=8) MemmoveUnalignedSrc/6 4.004n ± 0% 2.817n ± 0% -29.66% (p=0.000 n=8) MemmoveUnalignedSrc/7 4.003n ± 0% 2.818n ± 0% -29.60% (p=0.000 n=8) MemmoveUnalignedSrc/8 3.603n ± 0% 3.202n ± 0% -11.13% (p=0.000 n=8) MemmoveUnalignedSrc/9 4.003n ± 0% 3.202n ± 0% -20.01% (p=0.000 n=8) MemmoveUnalignedSrc/10 4.004n ± 0% 3.203n ± 0% -20.00% (p=0.000 n=8) MemmoveUnalignedSrc/11 4.003n ± 0% 3.203n ± 0% -19.99% (p=0.000 n=8) MemmoveUnalignedSrc/12 4.003n ± 0% 3.203n ± 0% -19.99% (p=0.000 n=8) MemmoveUnalignedSrc/13 4.003n ± 0% 3.203n ± 0% -20.00% (p=0.000 n=8) MemmoveUnalignedSrc/14 4.004n ± 0% 3.203n ± 0% -20.00% (p=0.000 n=8) MemmoveUnalignedSrc/15 4.003n ± 0% 3.203n ± 0% -20.00% (p=0.000 n=8) MemmoveUnalignedSrc/16 4.004n ± 0% 3.203n ± 0% -20.00% (p=0.000 n=8) MemmoveUnalignedSrc/32 4.003n ± 0% 4.004n ± 0% ~ (p=0.432 n=8) MemmoveUnalignedSrc/64 4.804n ± 0% 4.417n ± 0% -8.06% (p=0.000 n=8) MemmoveUnalignedSrcDst/f_16_0 4.004n ± 0% 4.004n ± 0% ~ (p=0.533 n=8) MemmoveUnalignedSrcDst/b_16_0 4.004n ± 0% 4.004n ± 0% ~ (p=0.546 n=8) MemmoveUnalignedSrcDst/f_16_1 4.004n ± 0% 4.004n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedSrcDst/b_16_1 4.004n ± 0% 4.004n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedSrcDst/f_16_4 4.004n ± 0% 4.004n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedSrcDst/b_16_4 4.004n ± 0% 4.004n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedSrcDst/f_16_7 4.004n ± 0% 4.004n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedSrcDst/b_16_7 4.003n ± 0% 4.004n ± 0% ~ (p=0.641 n=8) MemmoveUnalignedSrcDst/f_64_0 5.245n ± 1% 5.269n ± 0% ~ (p=0.053 n=8) MemmoveUnalignedSrcDst/b_64_0 5.401n ± 0% 5.402n ± 0% ~ (p=0.194 n=8) MemmoveUnalignedSrcDst/f_64_1 7.210n ± 1% 7.174n ± 0% -0.49% (p=0.007 n=8) MemmoveUnalignedSrcDst/b_64_1 6.710n ± 0% 6.709n ± 0% ~ (p=0.542 n=8) MemmoveUnalignedSrcDst/f_64_4 7.208n ± 0% 7.182n ± 0% -0.36% (p=0.036 n=8) MemmoveUnalignedSrcDst/b_64_4 6.717n ± 0% 6.708n ± 0% -0.13% (p=0.001 n=8) MemmoveUnalignedSrcDst/f_64_7 7.246n ± 0% 7.192n ± 0% -0.75% (p=0.000 n=8) MemmoveUnalignedSrcDst/b_64_7 6.718n ± 0% 6.708n ± 0% -0.15% (p=0.001 n=8) MemmoveUnalignedSrcOverlap/32 6.806n ± 0% 6.806n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedSrcOverlap/64 10.01n ± 0% 10.01n ± 0% ~ (p=1.000 n=8) MemmoveUnalignedSrcOverlap/128 11.61n ± 0% 11.61n ± 0% ~ (p=1.000 n=8) MemmoveKnownSize112 4.070n ± 0% 4.070n ± 0% ~ (p=0.733 n=8) MemmoveKnownSize128 3.429n ± 0% 3.411n ± 0% -0.52% (p=0.000 n=8) MemmoveKnownSize192 6.686n ± 3% 5.285n ± 10% -20.96% (p=0.003 n=8) MemmoveKnownSize248 8.385n ± 4% 6.986n ± 0% -16.69% (p=0.000 n=8) MemmoveKnownSize256 9.354n ± 8% 7.895n ± 14% -15.60% (p=0.000 n=8) MemmoveKnownSize512 13.14n ± 1% 13.06n ± 0% ~ (p=0.623 n=8) MemmoveKnownSize1024 25.82n ± 0% 25.82n ± 0% ~ (p=0.713 n=8) geomean 4.355n 3.936n -9.63% Change-Id: I72e3b513447948223ebba0a5a091ff552068574d Reviewed-on: https://go-review.googlesource.com/c/go/+/749720 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: David Chase <drchase@google.com>
2026-02-27cmd/compile/internal/test: add benchmark for string comparison operand orderyongqijia
Add BenchmarkStringEqParamOrder to verify that the operand order of string equality comparisons (strs[i] == str vs str == strs[i]) does not affect performance when the comparand is a function parameter. This benchmark was written while investigating issue #74471. Extensive benchmarking on both amd64 (Intel Xeon Gold 6148, linux) and arm64 (Apple M1 Pro, darwin) with 30 samples each showed that on Go tip the compiler already generates equivalent code for both orderings, so no compiler change is needed. The benchmark is retained as a regression guard. Updates #74471 Change-Id: I257910bba0abb3dc738578d898e63ecfb261c3cc Reviewed-on: https://go-review.googlesource.com/c/go/+/742141 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-27cmd/go/internal/doc: support @version suffix on first argumentIan Alexander
This change allows `go doc` to display documentation for packages outside the workspace by explicitly providing a version (e.g., `go doc pkg@version`) or by inferring it from an installed command. Therefore, all of the following are now valid: ``` go doc txtar@v0.13.0 go doc txtar@v0.13.0 FS go doc txtar.FS@v0.13.0 go doc golang.org/x/tools/txtar@v0.13.0 go doc golang.org/x/tools/txtar@v0.13.0 FS go doc golang.org/x/tools/txtar.FS@v0.13.0 ``` Fixes #63696. Change-Id: I22fb68e29c7f62bbe0bb240b82e5b789edc653f2 Reviewed-on: https://go-review.googlesource.com/c/go/+/747380 Reviewed-by: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com>
2026-02-27cmd/compile: gate instrumentEnterExit on NoRaceFunc checkDerek Parker
The NoRaceFunc flag is meant to suppress racefuncenter/racefuncexit instrumentation for packages like internal/runtime/atomic. However, instrumentEnterExit was set unconditionally when -race was enabled, outside the NoRaceFunc guard. This caused generic functions from NoRaceFunc packages (e.g. atomic.(*Pointer[T]).Store) to receive racefuncenter calls when instantiated in other packages, leading to a segfault during early runtime init before the race runtime is ready. Move the instrumentEnterExit assignment inside the NoRaceFunc check so both memory and enter/exit instrumentation are suppressed together. Fixes #77597 Change-Id: Id03bb9c422d36e2e88ecdf165ad3b1a4700a935c Reviewed-on: https://go-review.googlesource.com/c/go/+/748260 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-27cmd/internal/obj: arm64 assembler support unshifted hi for large offsetsAlexander Musman
Extend splitImm24uScaled to support an unshifted hi value (hi <= 0xfff) in addition to the shifted hi value (hi & ^0xfff000 == 0). This allows load/store instructions to handle more offsets using ADD + load/store sequences instead of falling back to the literal pool. This will be used by a subsequent change to add FMOVQ support in SSA form. Change-Id: I78490f5b1a60d49c1d42ad4daefb5d4e6021c965 Reviewed-on: https://go-review.googlesource.com/c/go/+/737320 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-02-27cmd/link, cmd/internal: remove the R_JMPLOONG64 relocation of loong64limeidan
R_JMPLOONG64 and R_CALLLOONG64 have the same functionality, and R_JMPLOONG64 is not used. Change-Id: Id6ac0bfa67025de45f9c51349931142d945134d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/748340 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: David Chase <drchase@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-02-26cmd/compile: fix bloop testKeith Randall
Not 100% sure this is right, but it seems to fix the issue. Fixes #77832 Change-Id: Ifa6eae61a5444f4fd88b310536b1caf7144e7797 Reviewed-on: https://go-review.googlesource.com/c/go/+/749660 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Auto-Submit: Keith Randall <khr@google.com>
2026-02-26cmd/compile: ternary rewrite of rewrite should skip, not panicDavid Chase
The panic was unnecessary, if there's nothing to rewrite, just do nothing. Added a debug message for this to help with testing; it seems (from accidentally perturbing the test away from failure) to be somewhat rare, so likely okay to mingle with the other debugging output. Fixes #77582. Change-Id: I676396f4bb530cb6b55dfe543ad489f84710900d Reviewed-on: https://go-review.googlesource.com/c/go/+/749241 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-02-26cmd/go: fix ignored error check when sanitizing SwigCXXFilesNeal Patel
Change-Id: Icc78a16c1fd128b14e9113016abdfcd6e91f1c1c Reviewed-on: https://go-review.googlesource.com/c/go/+/746320 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-25cmd/compile: treat all zero-sized values as SSA-ablekhr@golang.org
Might as well, we don't need any registers for such values. Fixes #77635 Change-Id: Iedc1bc3f13662b043b183228bcc1dc4e6c91da81 Reviewed-on: https://go-review.googlesource.com/c/go/+/747780 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-02-25cmd/compile: handle zero-sized values more generallykhr@golang.org
Introduce a new zero-arg op, Empty, which builds a zero-sized value. This is like ArrayMake0 but can make more general zero-sized values, like those of type [2][0]int. Needed for the subsequent CL. Update #77635 Change-Id: If928e9677be5d40a4e2d7501dada66e062319711 Reviewed-on: https://go-review.googlesource.com/c/go/+/747761 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-02-25Revert "cmd/compile: avoid panic in ternary rewrite on checked instructions"David Chase
This reverts CL 745460. Reason for revert: This just disables the optimization, instead of fixing it. Change-Id: I26350d08c847f666d12450d484312d0baf5f1112 Reviewed-on: https://go-review.googlesource.com/c/go/+/749161 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-02-25Revert "test/simd: add test for issue 77582"Cherry Mui
This reverts CL 748760. Reason for revert: 1. the fix in CL 745460 is not really correct. 2. this test doesn't actually reproduce the failure. (It needs to actually use the result, instead of assigning to _.) Change-Id: Ifb3da8954c5e8774ac000ee3bbf92e5813705dd6 Reviewed-on: https://go-review.googlesource.com/c/go/+/749240 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Cherry Mui <cherryyz@google.com>
2026-02-25cmd/compile: ensure StructMake/ArrayMake1 of direct interfaces are unwrappedKeith Randall
Ensures that deeply nested structs that have the underlying shape of a pointer get unwrapped properly. Update #77534 Change-Id: I004f424d2c62ec7026281daded9b3d96c021e2e1 Reviewed-on: https://go-review.googlesource.com/c/go/+/747760 Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-02-25test/simd: add test for issue 77582Eyalcfish
This addresses post-merge feedback from Cherry regarding CL 745460. Updates #77582 Change-Id: I1165b8f499d2381b3d45e4a14f9d052d947b33c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/748760 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com>
2026-02-25Revert "cmd/compile: add loclist for removed DCL nodes"Cherry Mui
This reverts CL 696575. Reason for revert: break many builders. E.g. https://ci.chromium.org/b/8688888321314872289 Change-Id: I453b50fd0b731a6b3d1870f43fd7ed5937965bc1 Reviewed-on: https://go-review.googlesource.com/c/go/+/749020 Auto-Submit: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-02-25cmd/go: use 'gcloud storage cp' instead of 'gsutil cp'Russ Cox
In some misguided attempt at "cleanup", Google Cloud has decided to retire 'gsutil' in favor of 'gcloud storage' instead of leaving an entirely backwards-compatible wrapper so that client scripts and muscle memory keep working. In addition to breaking customers this way, they are also sending AI bots around "cleaning up" old usages with scary warnings that maybe the changes will break your entire world. This is even more misguided, of course, and resulted in us receiving CL 748820 (originally GitHub PR #77787) and then me receiving a private email asking for it to be merged. It was easier to recreate the 3-line CL myself than to enumerate everything that was wrong with that CL's commit message. I hope that only Google teams are being subjected to this. Fixes #77787. Change-Id: I624ad4aff7f488b191e195b72e564dbd78440883 Reviewed-on: https://go-review.googlesource.com/c/go/+/748900 TryBot-Bypass: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2026-02-24cmd/compile: rewriteFixedLoad: ensure AuxInt is sign-extendedRongrong
CL 701297 accidentailly broke the type casting behavior for Hash. Previously, the generated rules for Hash shared a common pattern: v.AuxInt = int32ToAuxInt(fixed32(config, sym, off)) which inherently equaled to a signed-extend: v.AuxInt = int64(int32(types.TypeHash(...))) The pattern in CL 701297 was however: v.AuxInt = int64(types.TypeHash(t)) Since types.TypeHash() returns a uint32, casting it to a wider integer implies zero-extend. This diverges from the definition of AuxInt, in which "Unused portions are filled by sign-extending the used portion, even if the represented value is unsigned." As a result, ssa.checkFunc(), where AuxInt is checked against the mentioned rule, is unhappy and shouts: internal compiler error: 'typeAsserts': bad int32 AuxInt value for v1317 Reproduce it with: GOARCH=mips go tool compile -m -d=ssa/check/on test/devirtualization.go This is only reproducible with GOARCH=mips/mipsle (cross and native). Probably the rewrite rules of other architectures prevent Hash from running into rewriteFixedLoad. Fix it by emit sign-extend properly. Additionally, do the same for Kind_ as reflectdata.ABIKindOfType() also returns a fragile unsigned interger (uint8). Updates #67304 Change-Id: Ib4f3c94c0e3908698868449db2fdcdf4541f2e7e Reviewed-on: https://go-review.googlesource.com/c/go/+/744860 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Jake Bailey <jacob.b.bailey@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-24cmd/asm/internal/asm/testdata: add SB testsRoland Shoemaker
Add tests for the SB instruction which were omitted in CL 729501. Change-Id: Ia71940b813563a418011914660ee0f1aeaa78444 Reviewed-on: https://go-review.googlesource.com/c/go/+/748580 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Roland Shoemaker <roland@golang.org>
2026-02-24cmd/compile: add loclist for removed DCL nodesDerek Parker
Certain return parameters which live in registers and end up pruned by earlier SSA passes will end up with a DWARF entry but no location list. This patch fixes this by ensuring those params have proper location lists generated for them. Change-Id: I4fff074e62c3010abdee85934fb286510b21c707 Reviewed-on: https://go-review.googlesource.com/c/go/+/696575 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Derek Parker <parkerderek86@gmail.com>
2026-02-24cmd/compile: avoid panic in ternary rewrite on checked instructionsEyalcfish
The replace function in rewritetern.go was panicing when encountering instructions that had already been processed. This adds a check to ensure we don't trigger a panic on these instructions. Fixes #77582 Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe Reviewed-on: https://go-review.googlesource.com/c/go/+/745460 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-02-24internal/cpu,cmd/internal/obj/arm64: add SBRoland Shoemaker
Add the SB (speculation barrier) instruction, and an internal/cpu feature bit to check its availability. Change-Id: I7c2d887ae75598f7c11cc875ec15ec3be76c09f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/729501 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-23cmd/internal/obj/loong64: remove getting 32-bits address optab entrylimeidan
Change-Id: I082a475179088627d68759e2aaac32472ded2ebe Reviewed-on: https://go-review.googlesource.com/c/go/+/744300 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2026-02-23cmd/internal/obj/loong64: merge MOVVF optab entries into ABSFlimeidan
These instructions are aliases for each other: ------------------------------------------------------------------------------- | MOVWF | MOVVF | MOVWD | MOVVD | MOVFW | MOVDW | MOVFV | MOVDV | ------------------------------------------------------------------------------- | FFINTFW | FFINTFV | FFINTDW | FFINTDV | FTINTWF | FTINTWD | FTINTVF | FTINTVD | ------------------------------------------------------------------------------- Change-Id: I435485d5be64a85904609dc8031b4cc88c4746eb Reviewed-on: https://go-review.googlesource.com/c/go/+/741844 Reviewed-by: abner chenc <chenguoqi@loongson.cn> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-02-23cmd/internal/obj/loong64: merge moving data operations into one caselimeidan
Change-Id: I036d4eadeac9210dc03101b27c2375a801b7c2cf Reviewed-on: https://go-review.googlesource.com/c/go/+/741843 Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-23cmd/internal/obj/loong64: merge MOVD optab entries into MOVFlimeidan
Change-Id: Ib6c6bae3f5605a380eff62fd7c2a2537b2661db7 Reviewed-on: https://go-review.googlesource.com/c/go/+/741842 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-02-23cmd/internal/obj/loong64: merge MOVWU optab entries into MOVBUlimeidan
Change-Id: I88cbabe1d2d9448c61fc74207e6a02be96c4d816 Reviewed-on: https://go-review.googlesource.com/c/go/+/741841 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-02-23cmd/compile/internal/ssa: add codegen for Zicond extension on riscv64Xueqi Luo
Zicond is a mandatory extension in rva23u64. This patch converts certain branches to CondSelect and optimizes them to Zicond instructions on RISC-V in appropriate cases, 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 Change-Id: If5d9555980e0d1e26fa924974f88943eb86b050b GitHub-Last-Rev: 7a61508780953295f5507e5f927ab5be1d6afd91 GitHub-Pull-Request: golang/go#75577 Reviewed-on: https://go-review.googlesource.com/c/go/+/705996 Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-23cmd/compile: fix a typo in startRegs drop conditionAlexander Musman
Fix startRegs drop condition: it used `== 1` instead of `!= 0`, causing the startRegs optimization to only work for register R0. This left unnecessary register bits in startRegs, resulting in extra shuffle-generated OpLoadReg operations on merge edges. The practical effect is minor (a few less reloads in some functions); the fix is mostly to make the code behave as intended. Change-Id: I28279f51e3cafce4cfca0070633e22b9cc27a11b Reviewed-on: https://go-review.googlesource.com/c/go/+/745740 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com>
2026-02-23cmd/internal/obj/loong64: rearrange optab entrieslimeidan
Change-Id: I32189bb1edf236b8e8f406b2385bdce9071c072a Reviewed-on: https://go-review.googlesource.com/c/go/+/741840 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>