1
0
mirror of https://github.com/golang/go synced 2024-11-14 13:30:30 -07:00
Commit Graph

60986 Commits

Author SHA1 Message Date
qmuntal
ae8708f744 os/user: fix Current().GroupIds() for AD joined users on Windows
This CL special-case User.GroupIds to get the group IDs from the user's
token when the user is the current user.

This approach is more efficient than calling NetUserGetLocalGroups.
It is also more reliable for users joined to an Active Directory domain,
where NetUserGetLocalGroups is likely to fail.

Updates #26041.
Fixes #62712.

Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64
Change-Id: If7c30287192872077b98a514bd6346dbd1a64fb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/611116
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-16 20:48:56 +00:00
Cuong Manh Le
2927aa10ab unique: handle zero-size types
Fixes #69458

Change-Id: Ic7fda7f556522780b2819138dfc1277137398692
Reviewed-on: https://go-review.googlesource.com/c/go/+/613397
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-09-16 20:25:08 +00:00
Robert Griesemer
aa06c94054 math/big: add clarifying (internal) comment
Follow-up on CL 467555.

Change-Id: I1815b5def656ae4b86c31385ad0737f0465fa2d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/613535
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-16 19:10:55 +00:00
Michael Pratt
a02516a379 runtime: remove go:noescape from getcallerpc/sp
getcallerpc and getcallerps dropped their arguments in CL 65474 and CL
109596, respectively.

Without an argument there is nothing to escape.

Change-Id: I24f300d039a2a0615ca0c3ea247125676a6237d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/613497
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-09-16 19:10:52 +00:00
Michael Pratt
72739bbfa6 cmd/compile: remove ir.OGETCALLERPC
Nothing ever creates this op, so it can be safely removed. Note that SSA
still intrinsifies runtime.getcallerpc.

The similar ir.OGETCALLERSP is still used for defer handling in
typecheck/func.go:tcRecover.

For #54766.

Change-Id: I6bdb2072af2c068080ae977c0cbd4684d0c7c752
Reviewed-on: https://go-review.googlesource.com/c/go/+/613496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-09-16 19:10:50 +00:00
Michael Pratt
5b2f71a2c3 cmd/compile/internal/typecheck: remove getcallerpc/sp builtin signature
The compiler never does a lookup of these (LookupRuntime), so they
aren't needed here.

getcallerpc is only used in intrinsification. getcallersp is used in
intrinsification and defer handling via a direct OGETCALLERSP op.

For #54766.

Change-Id: I1666ceef3360a84573ae5b41b1c51d9205de7235
Reviewed-on: https://go-review.googlesource.com/c/go/+/613495
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-16 18:49:05 +00:00
Joel Sing
5367d696f7 math/big: simplify divBasic ujn assignment
Rather than conditionally assigning ujn, initialise ujn above the
loop to invent the leading 0 for u, then unconditionally load ujn
at the bottom of the loop. This code operates on the basis that
n >= 2, hence j+n-1 is always greater than zero.

Change-Id: I1272ef30c787ed8707ae8421af2adcccc776d389
Reviewed-on: https://go-review.googlesource.com/c/go/+/467555
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Robert Griesemer <gri@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-09-16 17:33:18 +00:00
Dmitri Shuralyov
4f95ad8ca2 cmd/preprofile, runtime/coverage: add package comment
As https://go.dev/doc/comment#package says, every package
should have a package comment. Command cmd/preprofile had
one, it was just not being recognized due to a blank line.

For #51430.
For #58102.

Change-Id: I73e31158e0f244f6453728ab68c5c8da4cfb38b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/613375
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-16 17:07:00 +00:00
Cuong Manh Le
3d33437c45 unicode/utf8: speedup RuneCount
CL 612617 did speedup RuneCountInString, thus we can now use it to
speedup RuneCount, too.

name                         old time/op    new time/op    delta
RuneCountTenASCIIChars-8       8.69ns ± 1%    3.59ns ± 2%  -58.66%  (p=0.000 n=9+9)
RuneCountTenJapaneseChars-8    49.8ns ± 2%    40.9ns ± 0%  -17.94%  (p=0.000 n=10+8)

Change-Id: I311750c00efc79af35fb0ca3b482a5d94e0a7977
Reviewed-on: https://go-review.googlesource.com/c/go/+/612955
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-15 02:05:37 +00:00
Cuong Manh Le
9bd34ebb7e unicode/utf8: add test that RuneCount does zero allocations
See disccusion in CL 612955.

Change-Id: I2de582321648f1798929ffb80d2f087e41146ead
Reviewed-on: https://go-review.googlesource.com/c/go/+/613315
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-09-15 02:04:55 +00:00
Cuong Manh Le
f117d1c9b5 test: add test for issue 24755
Fixes #24755

Change-Id: I00b276c5c2acb227d42a069d1af6027e4b499d31
Reviewed-on: https://go-review.googlesource.com/c/go/+/613115
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-09-13 21:24:10 +00:00
Cuong Manh Le
8343980c70 all: add test for issue 20027
Fixes #20027

Change-Id: Ia616d43c0affa7b927ddfb53755072c94ba27917
Reviewed-on: https://go-review.googlesource.com/c/go/+/612618
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-13 21:21:33 +00:00
Jes Cok
0a2cc74f5a cmd: make use of maps.{Copy, Clone}
Change-Id: I8a38b4c71c34d3544ee32be9c6e767bb1099a720
GitHub-Last-Rev: ff4cb4e91b
GitHub-Pull-Request: golang/go#69424
Reviewed-on: https://go-review.googlesource.com/c/go/+/612735
Reviewed-by: Keith Randall <khr@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-09-13 21:05:31 +00:00
Jes Cok
76e44f42c8 encoding/gob: make use of maps.Clone
Change-Id: I6a23219a9e05350bdd9205e19165d5944f15de31
GitHub-Last-Rev: 8c295bf55f
GitHub-Pull-Request: golang/go#69429
Reviewed-on: https://go-review.googlesource.com/c/go/+/612719
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-13 21:04:06 +00:00
Jes Cok
bc7c35a6d3 archive/tar: make use of maps.Clone
Change-Id: I2a9d849410002dae1f49a53597298c1903954d12
GitHub-Last-Rev: 20a56b4161
GitHub-Pull-Request: golang/go#69427
Reviewed-on: https://go-review.googlesource.com/c/go/+/612737
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-13 21:03:27 +00:00
Xiaolin Zhao
f243cf6016 cmd/compile: optimize math.Float64(32)bits and math.Float64(32)frombits on loong64
Use float <-> int register moves without conversion instead of stores
and loads to move float <-> int values like arm64 and mips64.

goos: linux
goarch: loong64
pkg: math
cpu: Loongson-3A6000 @ 2500.00MHz
                    │  bench.old   │               bench.new                │
                    │    sec/op    │    sec/op     vs base                  │
Acos                   15.98n ± 0%    15.94n ± 0%   -0.25% (p=0.000 n=20)
Acosh                  27.75n ± 0%    25.56n ± 0%   -7.89% (p=0.000 n=20)
Asin                   15.85n ± 0%    15.76n ± 0%   -0.57% (p=0.000 n=20)
Asinh                  39.79n ± 0%    37.69n ± 0%   -5.28% (p=0.000 n=20)
Atan                   7.261n ± 0%    7.242n ± 0%   -0.27% (p=0.000 n=20)
Atanh                  28.30n ± 0%    27.62n ± 0%   -2.40% (p=0.000 n=20)
Atan2                  15.85n ± 0%    15.75n ± 0%   -0.63% (p=0.000 n=20)
Cbrt                   27.02n ± 0%    21.08n ± 0%  -21.98% (p=0.000 n=20)
Ceil                   2.830n ± 1%    2.896n ± 1%   +2.31% (p=0.000 n=20)
Copysign              0.8022n ± 0%   0.8004n ± 0%   -0.22% (p=0.000 n=20)
Cos                    11.64n ± 0%    11.61n ± 0%   -0.26% (p=0.000 n=20)
Cosh                   35.98n ± 0%    33.44n ± 0%   -7.05% (p=0.000 n=20)
Erf                    10.09n ± 0%    10.08n ± 0%   -0.10% (p=0.000 n=20)
Erfc                   11.40n ± 0%    11.35n ± 0%   -0.44% (p=0.000 n=20)
Erfinv                 12.31n ± 0%    12.29n ± 0%   -0.16% (p=0.000 n=20)
Erfcinv                12.16n ± 0%    12.17n ± 0%   +0.08% (p=0.000 n=20)
Exp                    28.41n ± 0%    26.44n ± 0%   -6.95% (p=0.000 n=20)
ExpGo                  28.68n ± 0%    27.07n ± 0%   -5.60% (p=0.000 n=20)
Expm1                  17.21n ± 0%    16.75n ± 0%   -2.67% (p=0.000 n=20)
Exp2                   24.71n ± 0%    23.01n ± 0%   -6.88% (p=0.000 n=20)
Exp2Go                 25.17n ± 0%    23.91n ± 0%   -4.99% (p=0.000 n=20)
Abs                   0.8004n ± 0%   0.8004n ± 0%        ~ (p=0.224 n=20)
Dim                    1.201n ± 0%    1.201n ± 0%        ~ (p=1.000 n=20) ¹
Floor                  2.848n ± 0%    2.859n ± 0%   +0.39% (p=0.000 n=20)
Max                    3.074n ± 0%    3.071n ± 0%        ~ (p=0.481 n=20)
Min                    3.179n ± 0%    3.176n ± 0%   -0.09% (p=0.003 n=20)
Mod                    49.62n ± 0%    44.82n ± 0%   -9.67% (p=0.000 n=20)
Frexp                  7.604n ± 0%    6.803n ± 0%  -10.53% (p=0.000 n=20)
Gamma                  18.01n ± 0%    17.61n ± 0%   -2.22% (p=0.000 n=20)
Hypot                  7.204n ± 0%    7.604n ± 0%   +5.55% (p=0.000 n=20)
HypotGo                7.204n ± 0%    7.604n ± 0%   +5.56% (p=0.000 n=20)
Ilogb                  6.003n ± 0%    6.003n ± 0%        ~ (p=0.407 n=20)
J0                     76.43n ± 0%    76.24n ± 0%   -0.25% (p=0.000 n=20)
J1                     76.44n ± 0%    76.44n ± 0%        ~ (p=1.000 n=20)
Jn                     168.2n ± 0%    168.5n ± 0%   +0.18% (p=0.000 n=20)
Ldexp                  8.804n ± 0%    7.604n ± 0%  -13.63% (p=0.000 n=20)
Lgamma                 19.01n ± 0%    19.01n ± 0%        ~ (p=0.695 n=20)
Log                    19.38n ± 0%    19.12n ± 0%   -1.34% (p=0.000 n=20)
Logb                   6.003n ± 0%    6.003n ± 0%        ~ (p=1.000 n=20)
Log1p                  18.57n ± 0%    16.72n ± 0%   -9.96% (p=0.000 n=20)
Log10                  20.67n ± 0%    20.45n ± 0%   -1.06% (p=0.000 n=20)
Log2                   9.605n ± 0%    8.804n ± 0%   -8.34% (p=0.000 n=20)
Modf                   4.402n ± 0%    4.402n ± 0%        ~ (p=1.000 n=20)
Nextafter32            7.204n ± 0%    5.603n ± 0%  -22.22% (p=0.000 n=20)
Nextafter64            6.803n ± 0%    6.003n ± 0%  -11.76% (p=0.000 n=20)
PowInt                 39.62n ± 0%    37.22n ± 0%   -6.06% (p=0.000 n=20)
PowFrac                120.9n ± 0%    108.9n ± 0%   -9.93% (p=0.000 n=20)
Pow10Pos               1.601n ± 0%    1.601n ± 0%        ~ (p=0.487 n=20)
Pow10Neg               2.675n ± 0%    2.675n ± 0%        ~ (p=1.000 n=20)
Round                  3.018n ± 0%    2.401n ± 0%  -20.46% (p=0.000 n=20)
RoundToEven            3.822n ± 0%    3.001n ± 0%  -21.48% (p=0.000 n=20)
Remainder              45.62n ± 0%    42.42n ± 0%   -7.01% (p=0.000 n=20)
Signbit               0.9075n ± 0%   0.8004n ± 0%  -11.81% (p=0.000 n=20)
Sin                    12.65n ± 0%    12.65n ± 0%        ~ (p=0.503 n=20)
Sincos                 14.81n ± 0%    14.60n ± 0%   -1.42% (p=0.000 n=20)
Sinh                   36.75n ± 0%    35.11n ± 0%   -4.46% (p=0.000 n=20)
SqrtIndirect           1.201n ± 0%    1.201n ± 0%        ~ (p=1.000 n=20) ¹
SqrtLatency            4.002n ± 0%    4.002n ± 0%        ~ (p=1.000 n=20)
SqrtIndirectLatency    4.002n ± 0%    4.002n ± 0%        ~ (p=1.000 n=20)
SqrtGoLatency          52.85n ± 0%    40.82n ± 0%  -22.76% (p=0.000 n=20)
SqrtPrime              887.4n ± 0%    887.4n ± 0%        ~ (p=0.751 n=20)
Tan                    13.95n ± 0%    13.97n ± 0%   +0.18% (p=0.000 n=20)
Tanh                   36.79n ± 0%    34.89n ± 0%   -5.16% (p=0.000 n=20)
Trunc                  2.849n ± 0%    2.861n ± 0%   +0.42% (p=0.000 n=20)
Y0                     77.44n ± 0%    77.64n ± 0%   +0.26% (p=0.000 n=20)
Y1                     74.41n ± 0%    74.33n ± 0%   -0.11% (p=0.000 n=20)
Yn                     158.7n ± 0%    159.0n ± 0%   +0.19% (p=0.000 n=20)
Float64bits           0.8774n ± 0%   0.4002n ± 0%  -54.39% (p=0.000 n=20)
Float64frombits       0.8042n ± 0%   0.4002n ± 0%  -50.24% (p=0.000 n=20)
Float32bits           1.1230n ± 0%   0.5336n ± 0%  -52.48% (p=0.000 n=20)
Float32frombits       1.0670n ± 0%   0.8004n ± 0%  -24.99% (p=0.000 n=20)
FMA                    2.001n ± 0%    2.001n ± 0%        ~ (p=0.605 n=20)
geomean                10.87n         10.10n        -7.15%
¹ all samples are equal

goos: linux
goarch: loong64
pkg: math
cpu: Loongson-3A5000 @ 2500.00MHz
                    │  bench.old   │              bench.new               │
                    │    sec/op    │    sec/op     vs base                │
Acos                   33.10n ± 0%    31.95n ± 2%   -3.46% (p=0.000 n=20)
Acosh                  58.38n ± 0%    50.44n ± 0%  -13.60% (p=0.000 n=20)
Asin                   32.70n ± 0%    31.94n ± 0%   -2.32% (p=0.000 n=20)
Asinh                  57.65n ± 0%    50.83n ± 0%  -11.82% (p=0.000 n=20)
Atan                   14.21n ± 0%    14.21n ± 0%        ~ (p=0.501 n=20)
Atanh                  60.86n ± 0%    54.44n ± 0%  -10.56% (p=0.000 n=20)
Atan2                  32.02n ± 0%    34.02n ± 0%   +6.25% (p=0.000 n=20)
Cbrt                   55.58n ± 0%    40.64n ± 0%  -26.88% (p=0.000 n=20)
Ceil                   9.566n ± 0%    9.566n ± 0%        ~ (p=0.463 n=20)
Copysign              0.8005n ± 0%   0.8005n ± 0%        ~ (p=0.806 n=20)
Cos                    18.02n ± 0%    18.02n ± 0%        ~ (p=0.191 n=20)
Cosh                   64.44n ± 0%    65.64n ± 0%   +1.86% (p=0.000 n=20)
Erf                    16.15n ± 0%    16.16n ± 0%        ~ (p=0.770 n=20)
Erfc                   18.71n ± 0%    18.83n ± 0%   +0.61% (p=0.000 n=20)
Erfinv                 19.33n ± 0%    19.34n ± 0%        ~ (p=0.513 n=20)
Erfcinv                18.90n ± 0%    19.78n ± 0%   +4.63% (p=0.000 n=20)
Exp                    50.04n ± 0%    49.66n ± 0%   -0.75% (p=0.000 n=20)
ExpGo                  50.03n ± 0%    50.03n ± 0%        ~ (p=0.723 n=20)
Expm1                  28.41n ± 0%    28.27n ± 0%   -0.49% (p=0.000 n=20)
Exp2                   50.08n ± 0%    51.23n ± 0%   +2.31% (p=0.000 n=20)
Exp2Go                 49.77n ± 0%    49.89n ± 0%   +0.24% (p=0.000 n=20)
Abs                   0.8009n ± 0%   0.8006n ± 0%        ~ (p=0.317 n=20)
Dim                    1.987n ± 0%    1.993n ± 0%   +0.28% (p=0.001 n=20)
Floor                  8.543n ± 0%    8.548n ± 0%        ~ (p=0.509 n=20)
Max                    6.670n ± 0%    6.672n ± 0%        ~ (p=0.335 n=20)
Min                    6.694n ± 0%    6.694n ± 0%        ~ (p=0.459 n=20)
Mod                    56.44n ± 0%    53.23n ± 0%   -5.70% (p=0.000 n=20)
Frexp                  8.409n ± 0%    7.606n ± 0%   -9.55% (p=0.000 n=20)
Gamma                  35.64n ± 0%    35.23n ± 0%   -1.15% (p=0.000 n=20)
Hypot                  11.21n ± 0%    10.61n ± 0%   -5.31% (p=0.000 n=20)
HypotGo                11.50n ± 0%    11.01n ± 0%   -4.30% (p=0.000 n=20)
Ilogb                  7.606n ± 0%    6.804n ± 0%  -10.54% (p=0.000 n=20)
J0                     125.3n ± 0%    126.5n ± 0%   +0.96% (p=0.000 n=20)
J1                     124.9n ± 0%    125.3n ± 0%   +0.32% (p=0.000 n=20)
Jn                     264.3n ± 0%    265.9n ± 0%   +0.61% (p=0.000 n=20)
Ldexp                  9.606n ± 0%    9.204n ± 0%   -4.19% (p=0.000 n=20)
Lgamma                 38.82n ± 0%    38.85n ± 0%   +0.06% (p=0.019 n=20)
Log                    38.44n ± 0%    28.04n ± 0%  -27.06% (p=0.000 n=20)
Logb                   8.405n ± 0%    7.605n ± 0%   -9.52% (p=0.000 n=20)
Log1p                  31.62n ± 0%    27.11n ± 0%  -14.26% (p=0.000 n=20)
Log10                  38.83n ± 0%    28.42n ± 0%  -26.81% (p=0.000 n=20)
Log2                   11.21n ± 0%    10.41n ± 0%   -7.14% (p=0.000 n=20)
Modf                   5.204n ± 0%    5.205n ± 0%        ~ (p=0.983 n=20)
Nextafter32            8.809n ± 0%    7.208n ± 0%  -18.18% (p=0.000 n=20)
Nextafter64            8.405n ± 0%    8.406n ± 0%   +0.01% (p=0.007 n=20)
PowInt                 48.83n ± 0%    44.78n ± 0%   -8.28% (p=0.000 n=20)
PowFrac                146.9n ± 0%    142.1n ± 0%   -3.23% (p=0.000 n=20)
Pow10Pos               2.334n ± 0%    2.333n ± 0%        ~ (p=0.110 n=20)
Pow10Neg               4.803n ± 0%    4.803n ± 0%        ~ (p=0.130 n=20)
Round                  4.816n ± 0%    3.819n ± 0%  -20.70% (p=0.000 n=20)
RoundToEven            5.735n ± 0%    5.204n ± 0%   -9.26% (p=0.000 n=20)
Remainder              52.05n ± 0%    49.64n ± 0%   -4.63% (p=0.000 n=20)
Signbit                1.201n ± 0%    1.001n ± 0%  -16.65% (p=0.000 n=20)
Sin                    20.63n ± 0%    20.64n ± 0%   +0.05% (p=0.040 n=20)
Sincos                 23.82n ± 0%    24.62n ± 0%   +3.36% (p=0.000 n=20)
Sinh                   71.25n ± 0%    68.44n ± 0%   -3.94% (p=0.000 n=20)
SqrtIndirect           2.001n ± 0%    2.001n ± 0%        ~ (p=0.182 n=20)
SqrtLatency            4.003n ± 0%    4.003n ± 0%        ~ (p=0.754 n=20)
SqrtIndirectLatency    4.003n ± 0%    4.003n ± 0%        ~ (p=0.773 n=20)
SqrtGoLatency          60.84n ± 0%    81.26n ± 0%  +33.56% (p=0.000 n=20)
SqrtPrime              1.791µ ± 0%    1.791µ ± 0%        ~ (p=0.784 n=20)
Tan                    27.22n ± 0%    27.22n ± 0%        ~ (p=0.819 n=20)
Tanh                   70.88n ± 0%    69.04n ± 0%   -2.60% (p=0.000 n=20)
Trunc                  8.543n ± 0%    8.543n ± 0%        ~ (p=0.784 n=20)
Y0                     122.9n ± 0%    122.9n ± 0%        ~ (p=0.559 n=20)
Y1                     123.3n ± 0%    121.7n ± 0%   -1.30% (p=0.000 n=20)
Yn                     263.0n ± 0%    262.6n ± 0%   -0.15% (p=0.000 n=20)
Float64bits           1.2010n ± 0%   0.6004n ± 0%  -50.01% (p=0.000 n=20)
Float64frombits       1.2010n ± 0%   0.6004n ± 0%  -50.01% (p=0.000 n=20)
Float32bits           1.7010n ± 0%   0.8005n ± 0%  -52.94% (p=0.000 n=20)
Float32frombits       1.5010n ± 0%   0.8005n ± 0%  -46.67% (p=0.000 n=20)
FMA                    2.001n ± 0%    2.001n ± 0%        ~ (p=0.238 n=20)
geomean                17.41n         16.15n        -7.19%

Change-Id: I0a0c263af2f07203eab1782e69c706f20c689d8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/604737
Auto-Submit: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2024-09-13 19:29:23 +00:00
Mark Ryan
5752a94677 crypto/md5: provide optimised assembly for riscv64
Provide an optimised assembly implementation of MD5 for RISC-V.
There are significant performance improvements.  The assembler takes
advantage of Zbb instructions when they are available.

Results for the VisionFive 2 running Ubuntu 24.04 with
GORISCV64=rva20u64.

goos: linux
goarch: riscv64
pkg: crypto/md5
                    │ md5_go.txt  │             md5_ass.txt             │
                    │   sec/op    │   sec/op     vs base                │
Hash8Bytes            1.202µ ± 0%   1.220µ ± 0%   +1.50% (p=0.000 n=10)
Hash64                1.665µ ± 0%   1.518µ ± 0%   -8.83% (p=0.000 n=10)
Hash128               2.165µ ± 0%   1.885µ ± 0%  -12.94% (p=0.000 n=10)
Hash256               3.162µ ± 0%   2.613µ ± 0%  -17.38% (p=0.000 n=10)
Hash512               5.146µ ± 0%   4.063µ ± 0%  -21.05% (p=0.000 n=10)
Hash1K                9.115µ ± 0%   6.959µ ± 0%  -23.65% (p=0.000 n=10)
Hash8K                64.68µ ± 0%   47.52µ ± 0%  -26.54% (p=0.000 n=10)
Hash1M                8.131m ± 0%   5.936m ± 0%  -27.00% (p=0.000 n=10)
Hash8M                65.06m ± 0%   47.50m ± 0%  -26.99% (p=0.000 n=10)
Hash8BytesUnaligned   1.210µ ± 0%   1.199µ ± 0%   -0.91% (p=0.000 n=10)
Hash1KUnaligned       9.114µ ± 0%   8.266µ ± 0%   -9.30% (p=0.000 n=10)
Hash8KUnaligned       64.68µ ± 0%   57.97µ ± 0%  -10.38% (p=0.000 n=10)
geomean               22.37µ        18.83µ       -15.82%

Results for the VisionFive 2 running Ubuntu 24.04 with
GORISCV64=rva22u64.

goos: linux
goarch: riscv64
pkg: crypto/md5
                    │ md5_g22.txt │             md5_a22.txt             │
                    │   sec/op    │   sec/op     vs base                │
Hash8Bytes            1.175µ ± 0%   1.002µ ± 0%  -14.72% (p=0.000 n=10)
Hash64                1.575µ ± 0%   1.274µ ± 0%  -19.11% (p=0.000 n=10)
Hash128               2.033µ ± 0%   1.587µ ± 0%  -21.92% (p=0.000 n=10)
Hash256               2.943µ ± 0%   2.209µ ± 0%  -24.93% (p=0.000 n=10)
Hash512               4.755µ ± 0%   3.443µ ± 0%  -27.58% (p=0.000 n=10)
Hash1K                8.378µ ± 0%   5.910µ ± 0%  -29.46% (p=0.000 n=10)
Hash8K                59.12µ ± 0%   40.45µ ± 0%  -31.58% (p=0.000 n=10)
Hash1M                7.426m ± 0%   5.056m ± 0%  -31.92% (p=0.000 n=10)
Hash8M                59.41m ± 0%   40.45m ± 0%  -31.91% (p=0.000 n=10)
Hash8BytesUnaligned   1.169µ ± 0%   1.012µ ± 0%  -13.43% (p=0.000 n=10)
Hash1KUnaligned       8.379µ ± 0%   7.213µ ± 0%  -13.91% (p=0.000 n=10)
Hash8KUnaligned       59.12µ ± 0%   50.90µ ± 0%  -13.91% (p=0.000 n=10)
geomean               20.83µ        15.99µ       -23.21%

Change-Id: I61e3fa802c2cc50e0b5f71f151b4741691ccb481
Reviewed-on: https://go-review.googlesource.com/c/go/+/527936
Reviewed-by: Joel Sing <joel@sing.id.au>
Auto-Submit: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-13 17:51:27 +00:00
Michael Matloob
d79e6bec63 cmd/go: populate build info for test mains
Before this change, test binaries didn't have build info populated on them
unless they were tests for package main. Now we generate them for all
test binaries so that they can be inspected like other binaries.

We don't need to add the default GODEBUG in printLinkerConfig because it
will now always be present on the build info, and when build info is
present we use it to generate the hash.

Fixes #33976

Change-Id: Ib4f51c04f87df3c7f2f21c400ab446e70d66a101
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/613096
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-13 17:15:56 +00:00
Xiaolin Zhao
2c5b707b3b cmd/compile: optimize RotateLeft8/16 on loong64
goos: linux
goarch: loong64
pkg: math/bits
cpu: Loongson-3A6000 @ 2500.00MHz
             │  bench.old   │              bench.new               │
             │    sec/op    │    sec/op     vs base                │
RotateLeft8     1.401n ± 0%    1.201n ± 0%  -14.28% (p=0.000 n=20)
RotateLeft16   1.4010n ± 0%   0.8032n ± 0%  -42.67% (p=0.000 n=20)
geomean         1.401n        0.9822n       -29.90%

goos: linux
goarch: loong64
pkg: math/bits
cpu: Loongson-3A5000 @ 2500.00MHz
             │  bench.old  │              bench.new              │
             │   sec/op    │   sec/op     vs base                │
RotateLeft8    1.576n ± 0%   1.310n ± 0%  -16.88% (p=0.000 n=20)
RotateLeft16   1.576n ± 0%   1.166n ± 0%  -26.02% (p=0.000 n=20)
geomean        1.576n        1.236n       -21.58%

Change-Id: I39c18306be0b8fd31b57bd0911714abd1783b50e
Reviewed-on: https://go-review.googlesource.com/c/go/+/604738
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-13 17:15:09 +00:00
Xiaolin Zhao
b895dd5630 cmd/internal/obj/loong64: add support for instructions FSCALEB{F/D} and FLOGB{F/D}
Go asm syntax:
	FSCALEB{F/D}	FK, FJ, FD
	FLOGB{F/D}	FJ, FD

Equivalent platform assembler syntax:
	fscaleb.{s/d}	fd, fj, fk
	flogb.{s/d}	fd, fj

Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: I6cd75c7605adbb572dae86d6470ec7cf20ce0f6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/612975
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-13 17:05:38 +00:00
Mateusz Poliwczak
76650b60eb go/ast: note that in BasicLit CHARs and STRINGs are quoted
This reapplies CL 244960, for some reason CL 264181 removed this comment.

Updates #39590

Change-Id: Ia37268812c6929020b0cd583d2c7fa48a098377c
GitHub-Last-Rev: 2acee37fed
GitHub-Pull-Request: golang/go#69019
Reviewed-on: https://go-review.googlesource.com/c/go/+/607517
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-13 17:03:16 +00:00
Jes Cok
998ce1c426 net/http: make use of maps.Copy
Change-Id: If8e02760fe1fb095ecebc306fd98662a51a1f66f
GitHub-Last-Rev: 7b8099f1fe
GitHub-Pull-Request: golang/go#69426
Reviewed-on: https://go-review.googlesource.com/c/go/+/612736
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-13 17:00:55 +00:00
Jes Cok
fc97288e26 text/template: make use of maps.Copy for Template.Clone
Change-Id: I1da668223b599867afe5483384b458482624adc5
GitHub-Last-Rev: 0a6bd6e84a
GitHub-Pull-Request: golang/go#69423
Reviewed-on: https://go-review.googlesource.com/c/go/+/612717
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-13 17:00:52 +00:00
Kir Kolyshkin
4c0f098533 internal/testenv: add MustHaveSource, rm HasSrc
All the users of HasSrc call t.Skip anyway, so let's move it to testenv.

Fix go/build to use MustHaveSource rather than MustHaveGoBuild where
appropriate.

Change-Id: I052bf96fd5a5780c1930da5b3a52b7a8dbebea46
Reviewed-on: https://go-review.googlesource.com/c/go/+/612057
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Tim King <taking@google.com>
2024-09-13 16:56:48 +00:00
Tobias Klauser
f3c89e21a5 cmd/link/internal: use slices.Contains
Change-Id: Ib437e272e0eb7d1b0969a4ed94d264ca3aad7c59
Reviewed-on: https://go-review.googlesource.com/c/go/+/612696
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-13 16:53:31 +00:00
Robert Griesemer
8a4b439ee6 go/types, types2: add initial README.md
Change-Id: I0a5ce4d50d65b803b001d01d627e8e6d2af66d6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/611335
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-09-12 21:35:20 +00:00
Cuong Manh Le
751fbf9e5a unicode/utf8: use range loop in RuneCountInString
CL 28490 speeded up non-ASCII rune decoding, and ASCII rune is also
decoded faster now.

Benchmark using:

    perflock -governor 70% go test -run=NONE -bench=BenchmarkRuneCountInString -count=10

Result:

name                                 old time/op  new time/op  delta
RuneCountInStringTenASCIIChars-8     10.2ns ± 0%   7.1ns ± 1%  -30.53%  (p=0.000 n=8+9)
RuneCountInStringTenJapaneseChars-8  49.3ns ± 2%  38.5ns ± 2%  -21.84%  (p=0.000 n=8+8)

Fixes #13162

Change-Id: Ifb01f3799c5c93e7f7c7af13a95becfde85ae807
Reviewed-on: https://go-review.googlesource.com/c/go/+/612617
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
2024-09-12 19:10:46 +00:00
Guoqi Chen
8efb5ebfd0 runtime: switch cputicks and switchToCrashStack0 on loong64 to regabi
goos: linux
goarch: loong64
pkg: runtime
cpu: Loongson-3A6000 @ 2500.00MHz
                     |   old.bench   |   new.bench                        |
                     |   sec/op      |   sec/op      vs base              |
SelectUncontended       246.6n ± 0%     247.4n ± 0%  +0.32% (p=0.000 n=10)
SelectSyncContended     1.458µ ± 0%     1.461µ ± 0%  +0.17% (p=0.000 n=10)
SelectAsyncContended    246.6n ± 0%     247.5n ± 0%  +0.36% (p=0.000 n=10)
SelectNonblock          32.81n ± 0%     32.81n ± 0%       ~ (p=1.000 n=10)
SelectProdCons          653.8n ± 0%     652.2n ± 0%  -0.24% (p=0.010 n=10)
GoroutineSelect         2.204m ± 0%     2.172m ± 0%  -1.46% (p=0.000 n=10)
GoroutineForRange       1.775m ± 0%     1.748m ± 0%  -1.54% (p=0.000 n=10)
geomean                 3.573µ          3.561µ       -0.34%

Change-Id: I6337cad72369e77e378b6e9bec6521d71b3f4fc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/610175
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
2024-09-12 17:06:28 +00:00
Michael Pratt
7a5fc9b34d os: add clone(CLONE_PIDFD) check to pidfd feature check
clone(CLONE_PIDFD) was added in Linux 5.2 and pidfd_open was added in
Linux 5.3. Thus our feature check for pidfd_open should be sufficient to
ensure that clone(CLONE_PIDFD) works.

Unfortuantely, some alternative Linux implementations may not follow
this strict ordering. For example, QEMU 7.2 (Dec 2022) added pidfd_open,
but clone(CLONE_PIDFD) was only added in QEMU 8.0 (Apr 2023).

Debian bookworm provides QEMU 7.2 by default.

Fixes #69259.

Change-Id: Ie3f3dc51f0cd76944871bf98690abf59f68fd7bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/592078
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-09-12 15:45:38 +00:00
Joel Sing
0ee5d20b1f cmd/compile,cmd/internal/obj/riscv: always provide ANDN, ORN and XNOR for riscv64
The ANDN, ORN and XNOR RISC-V Zbb extension instructions are easily
synthesised. Make them always available by adding support to the
riscv64 assembler so that we either emit two instruction sequences,
or a single instruction, when permitted by the GORISCV64 profile.
This means that these instructions can be used unconditionally,
simplifying compiler rewrite rules, codegen tests and manually
written assembly.

Around 180 instructions are removed from the Go binary on riscv64
when built with rva22u64.

Change-Id: Ib2d90f2593a306530dc0ed08a981acde4d01be20
Reviewed-on: https://go-review.googlesource.com/c/go/+/611895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-12 15:03:44 +00:00
Michael Matloob
301499ff7b cmd/go: explicitly add default GODEBUG to linker config
Previously we expected the default GODEBUG that's embedded in the binary
to be taken into account for build actionIDs through the build info. The
build info contains the default GODEBUG for a package main, and then
that build info is used to generate the action id. But tests of packages
other than main do not have buildinfo set on them. So the default
GODEBUG isn't taken into account in the action id for those tests.
Explicitly include GODEBUG when generating all link actions' action ids
to make sure it's always present.

Fixes #69203

Change-Id: Ifbc58482454ecfb51ba09cfcff02972cac3270c1
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/610875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-09-12 14:58:37 +00:00
jokemanfire
c1fe637eda cmd/go: set environment LANG=C when getting compiler version
Compiler's version will not work well if gcc output have
different language. Like 'gcc -v', it may not output:
'gcc version xx.xx.x'

 Fixes #69221

Change-Id: I4adcea79dfaaf5853dfb6e718468f8530c67da6a
GitHub-Last-Rev: 069787c083
GitHub-Pull-Request: golang/go#69223
Reviewed-on: https://go-review.googlesource.com/c/go/+/610215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: DING HU <huzuzong123@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-09-12 14:57:15 +00:00
Tobias Klauser
30f3931c54 runtime/pprof: use slices.Contains
Change-Id: I013aae68f47d7a37deb44097f80a213d8c7976bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/612655
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-12 14:50:13 +00:00
Ian Lance Taylor
e9a500f47d os: check for EACCES, not EPERM, in Getwd test
Fixes #69406

Change-Id: I1c6b1498d87f94cc9196a933c13df1c3369e19a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/610756
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-12 00:11:48 +00:00
Cuong Manh Le
e6138185db cmd/compile/internal/typecheck: simplify checkmake/checkunsafesliceorstring
types2 handles all constant-related bounds checks in user Go code now,
so it's safe to remove the constants check from these functions.

Change-Id: I4e3fb5d22f9bbc95878c7df2ee3b0eb1819f8dd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/611677
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Tim King <taking@google.com>
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>
2024-09-11 23:46:33 +00:00
Cuong Manh Le
d7521704ce cmd/compile/internal/typecheck: simplify tcSlice
types2 handles all constant-related bounds checks in user Go code now,
so it's safe to remove all constants checking in tcSlice function.

Change-Id: Ia0dd4928d7122a6f62df10436bb4a3675ebf3357
Reviewed-on: https://go-review.googlesource.com/c/go/+/611676
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: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-11 22:58:05 +00:00
Xiaolin Zhao
50e536daa1 src/internal/bytealg: optimize the function Compare on loong64
The relevant performance improved by 66.73%.

benchmark:
goos: linux
goarch: loong64
pkg: bytes
cpu: Loongson-3A6000 @ 2500.00MHz
                                      │     old      │                 new                 │
                                      │    sec/op    │   sec/op     vs base                │
BytesCompare/1                           5.603n ± 0%   4.002n ± 0%  -28.57% (p=0.000 n=20)
BytesCompare/2                           6.405n ± 0%   4.002n ± 0%  -37.52% (p=0.000 n=20)
BytesCompare/4                           8.007n ± 0%   4.002n ± 0%  -50.02% (p=0.000 n=20)
BytesCompare/8                          11.210n ± 0%   4.002n ± 0%  -64.30% (p=0.000 n=20)
BytesCompare/16                          6.005n ± 0%   4.802n ± 0%  -20.03% (p=0.000 n=20)
BytesCompare/32                          6.806n ± 0%   4.402n ± 0%  -35.32% (p=0.000 n=20)
BytesCompare/64                          8.407n ± 0%   6.003n ± 0%  -28.60% (p=0.000 n=20)
BytesCompare/128                        11.610n ± 0%   8.404n ± 0%  -27.61% (p=0.000 n=20)
BytesCompare/256                         18.02n ± 0%   14.01n ± 0%  -22.25% (p=0.000 n=20)
BytesCompare/512                         31.23n ± 0%   26.98n ± 0%  -13.61% (p=0.000 n=20)
BytesCompare/1024                        56.85n ± 0%   52.43n ± 0%   -7.77% (p=0.000 n=20)
BytesCompare/2048                        108.1n ± 0%   103.8n ± 0%   -3.98% (p=0.000 n=20)
CompareBytesEqual                       15.610n ± 0%   5.203n ± 0%  -66.67% (p=0.000 n=20)
CompareBytesToNil                        3.203n ± 0%   3.202n ± 0%   -0.03% (p=0.000 n=20)
CompareBytesEmpty                        3.203n ± 0%   2.423n ± 0%  -24.35% (p=0.000 n=20)
CompareBytesIdentical                    3.203n ± 0%   2.424n ± 0%  -24.32% (p=0.000 n=20)
CompareBytesSameLength                   8.407n ± 0%   8.004n ± 0%   -4.79% (p=0.000 n=20)
CompareBytesDifferentLength              8.808n ± 0%   7.604n ± 0%  -13.67% (p=0.000 n=20)
CompareBytesBigUnaligned/offset=1       839.85µ ± 0%   82.04µ ± 0%  -90.23% (p=0.000 n=20)
CompareBytesBigUnaligned/offset=2       839.86µ ± 0%   82.03µ ± 0%  -90.23% (p=0.000 n=20)
CompareBytesBigUnaligned/offset=3       839.86µ ± 0%   82.03µ ± 0%  -90.23% (p=0.000 n=20)
CompareBytesBigUnaligned/offset=4       839.86µ ± 0%   82.03µ ± 0%  -90.23% (p=0.000 n=20)
CompareBytesBigUnaligned/offset=5       839.85µ ± 0%   82.04µ ± 0%  -90.23% (p=0.000 n=20)
CompareBytesBigUnaligned/offset=6       839.85µ ± 0%   82.03µ ± 0%  -90.23% (p=0.000 n=20)
CompareBytesBigUnaligned/offset=7       839.85µ ± 0%   82.03µ ± 0%  -90.23% (p=0.000 n=20)
CompareBytesBigBothUnaligned/offset=0    78.77µ ± 0%   78.75µ ± 0%   -0.03% (p=0.000 n=20)
CompareBytesBigBothUnaligned/offset=1   839.84µ ± 0%   85.31µ ± 0%  -89.84% (p=0.000 n=20)
CompareBytesBigBothUnaligned/offset=2   839.84µ ± 0%   85.31µ ± 0%  -89.84% (p=0.000 n=20)
CompareBytesBigBothUnaligned/offset=3   839.85µ ± 0%   85.31µ ± 0%  -89.84% (p=0.000 n=20)
CompareBytesBigBothUnaligned/offset=4   839.83µ ± 0%   85.31µ ± 0%  -89.84% (p=0.000 n=20)
CompareBytesBigBothUnaligned/offset=5   839.85µ ± 0%   85.31µ ± 0%  -89.84% (p=0.000 n=20)
CompareBytesBigBothUnaligned/offset=6   839.85µ ± 0%   85.31µ ± 0%  -89.84% (p=0.000 n=20)
CompareBytesBigBothUnaligned/offset=7   839.84µ ± 0%   85.31µ ± 0%  -89.84% (p=0.000 n=20)
CompareBytesBig                          78.77µ ± 0%   78.75µ ± 0%   -0.03% (p=0.001 n=20)
CompareBytesBigIdentical                 2.802n ± 0%   2.801n ± 0%   -0.04% (p=0.001 n=20)
geomean                                  1.524µ        507.2n       -66.73%

Change-Id: Ice9f4ef0ce0fbb5a6424823c5f8e0c0c369fd159
Reviewed-on: https://go-review.googlesource.com/c/go/+/589538
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Auto-Submit: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-11 22:34:54 +00:00
Xiaolin Zhao
547baafa37 runtime: optimize the function memmove on loong64
benchmarck on 3A6000:
goos: linux
goarch: loong64
pkg: runtime
cpu: Loongson-3A6000 @ 2500.00MHz
                                 │      old      │                 new                  │
                                 │    sec/op     │    sec/op     vs base                │
Memmove/0                           0.6003n ± 0%   0.6003n ± 0%        ~ (p=0.487 n=20)
Memmove/1                            4.402n ± 0%    2.815n ± 0%  -36.05% (p=0.000 n=20)
Memmove/2                            5.202n ± 0%    3.202n ± 0%  -38.45% (p=0.000 n=20)
Memmove/3                            6.003n ± 0%    2.820n ± 0%  -53.02% (p=0.000 n=20)
Memmove/4                            6.803n ± 0%    3.202n ± 0%  -52.93% (p=0.000 n=20)
Memmove/5                            7.604n ± 0%    3.202n ± 0%  -57.89% (p=0.000 n=20)
Memmove/6                            8.404n ± 0%    3.202n ± 0%  -61.90% (p=0.000 n=20)
Memmove/7                            9.204n ± 0%    3.202n ± 0%  -65.21% (p=0.000 n=20)
Memmove/8                            4.802n ± 0%    3.602n ± 0%  -24.99% (p=0.000 n=20)
Memmove/9                            6.003n ± 0%    3.202n ± 0%  -46.66% (p=0.000 n=20)
Memmove/10                           6.803n ± 0%    3.202n ± 0%  -52.93% (p=0.000 n=20)
Memmove/11                           7.604n ± 0%    3.202n ± 0%  -57.89% (p=0.000 n=20)
Memmove/12                           8.404n ± 0%    3.202n ± 0%  -61.90% (p=0.000 n=20)
Memmove/13                           9.204n ± 0%    3.202n ± 0%  -65.21% (p=0.000 n=20)
Memmove/14                          10.000n ± 0%    3.202n ± 0%  -67.98% (p=0.000 n=20)
Memmove/15                          10.810n ± 0%    3.202n ± 0%  -70.38% (p=0.000 n=20)
Memmove/16                           6.003n ± 0%    3.202n ± 0%  -46.66% (p=0.000 n=20)
Memmove/32                           7.604n ± 0%    3.602n ± 0%  -52.63% (p=0.000 n=20)
Memmove/64                          10.810n ± 0%    4.402n ± 0%  -59.28% (p=0.000 n=20)
Memmove/128                         17.210n ± 0%    8.004n ± 0%  -53.49% (p=0.000 n=20)
Memmove/256                          30.41n ± 0%    10.81n ± 0%  -64.45% (p=0.000 n=20)
Memmove/512                          56.03n ± 0%    17.81n ± 0%  -68.21% (p=0.000 n=20)
Memmove/1024                        107.30n ± 0%    30.62n ± 0%  -71.46% (p=0.000 n=20)
Memmove/2048                        209.70n ± 0%    56.23n ± 0%  -73.19% (p=0.000 n=20)
Memmove/4096                         414.6n ± 0%    107.5n ± 0%  -74.07% (p=0.000 n=20)
MemmoveOverlap/32                    8.404n ± 0%    4.402n ± 0%  -47.62% (p=0.000 n=20)
MemmoveOverlap/64                   11.610n ± 0%    5.003n ± 0%  -56.91% (p=0.000 n=20)
MemmoveOverlap/128                  18.010n ± 0%    9.005n ± 0%  -50.00% (p=0.000 n=20)
MemmoveOverlap/256                   31.22n ± 0%    12.41n ± 0%  -60.25% (p=0.000 n=20)
MemmoveOverlap/512                   56.83n ± 0%    19.08n ± 0%  -66.43% (p=0.000 n=20)
MemmoveOverlap/1024                 108.10n ± 0%    32.00n ± 0%  -70.40% (p=0.000 n=20)
MemmoveOverlap/2048                 210.50n ± 0%    57.94n ± 0%  -72.48% (p=0.000 n=20)
MemmoveOverlap/4096                  415.4n ± 0%    108.9n ± 0%  -73.78% (p=0.000 n=20)
MemmoveUnalignedDst/0                2.448n ± 0%    2.942n ± 0%  +20.16% (p=0.000 n=20)
MemmoveUnalignedDst/1                4.802n ± 0%    3.202n ± 0%  -33.32% (p=0.000 n=20)
MemmoveUnalignedDst/2                5.603n ± 0%    3.602n ± 0%  -35.71% (p=0.000 n=20)
MemmoveUnalignedDst/3                6.403n ± 0%    3.202n ± 0%  -49.99% (p=0.000 n=20)
MemmoveUnalignedDst/4                7.203n ± 0%    3.602n ± 0%  -49.99% (p=0.000 n=20)
MemmoveUnalignedDst/5                8.004n ± 0%    3.602n ± 0%  -55.00% (p=0.000 n=20)
MemmoveUnalignedDst/6                8.804n ± 0%    3.602n ± 0%  -59.09% (p=0.000 n=20)
MemmoveUnalignedDst/7                9.605n ± 0%    3.602n ± 0%  -62.50% (p=0.000 n=20)
MemmoveUnalignedDst/8               10.400n ± 0%    4.002n ± 0%  -61.52% (p=0.000 n=20)
MemmoveUnalignedDst/9               11.210n ± 0%    3.802n ± 0%  -66.08% (p=0.000 n=20)
MemmoveUnalignedDst/10              12.010n ± 0%    3.802n ± 0%  -68.34% (p=0.000 n=20)
MemmoveUnalignedDst/11              12.810n ± 0%    3.802n ± 0%  -70.32% (p=0.000 n=20)
MemmoveUnalignedDst/12              13.610n ± 0%    3.802n ± 0%  -72.06% (p=0.000 n=20)
MemmoveUnalignedDst/13              14.410n ± 0%    3.802n ± 0%  -73.62% (p=0.000 n=20)
MemmoveUnalignedDst/14              15.210n ± 0%    3.802n ± 0%  -75.00% (p=0.000 n=20)
MemmoveUnalignedDst/15              16.010n ± 0%    3.802n ± 0%  -76.25% (p=0.000 n=20)
MemmoveUnalignedDst/16              17.210n ± 0%    3.802n ± 0%  -77.91% (p=0.000 n=20)
MemmoveUnalignedDst/32              30.020n ± 0%    4.202n ± 0%  -86.00% (p=0.000 n=20)
MemmoveUnalignedDst/64              56.030n ± 0%    6.804n ± 0%  -87.86% (p=0.000 n=20)
MemmoveUnalignedDst/128             106.90n ± 0%    13.61n ± 0%  -87.27% (p=0.000 n=20)
MemmoveUnalignedDst/256             209.50n ± 0%    17.07n ± 1%  -91.85% (p=0.000 n=20)
MemmoveUnalignedDst/512             414.60n ± 0%    24.95n ± 0%  -93.98% (p=0.000 n=20)
MemmoveUnalignedDst/1024            828.40n ± 0%    42.82n ± 0%  -94.83% (p=0.000 n=20)
MemmoveUnalignedDst/2048           1648.00n ± 0%    78.04n ± 0%  -95.26% (p=0.000 n=20)
MemmoveUnalignedDst/4096            3287.0n ± 0%    148.4n ± 0%  -95.49% (p=0.000 n=20)
MemmoveUnalignedDstOverlap/32       30.810n ± 0%    5.603n ± 0%  -81.81% (p=0.000 n=20)
MemmoveUnalignedDstOverlap/64       56.430n ± 0%    7.604n ± 0%  -86.52% (p=0.000 n=20)
MemmoveUnalignedDstOverlap/128     107.700n ± 0%    9.812n ± 0%  -90.89% (p=0.000 n=20)
MemmoveUnalignedDstOverlap/256      210.10n ± 0%    13.50n ± 0%  -93.57% (p=0.000 n=20)
MemmoveUnalignedDstOverlap/512      415.00n ± 0%    21.21n ± 0%  -94.89% (p=0.000 n=20)
MemmoveUnalignedDstOverlap/1024     828.80n ± 0%    41.02n ± 0%  -95.05% (p=0.000 n=20)
MemmoveUnalignedDstOverlap/2048    1648.00n ± 0%    80.23n ± 0%  -95.13% (p=0.000 n=20)
MemmoveUnalignedDstOverlap/4096     3288.0n ± 0%    162.4n ± 0%  -95.06% (p=0.000 n=20)
MemmoveUnalignedSrc/0                2.468n ± 1%    2.913n ± 0%  +18.01% (p=0.000 n=20)
MemmoveUnalignedSrc/1                4.802n ± 0%    3.202n ± 0%  -33.32% (p=0.000 n=20)
MemmoveUnalignedSrc/2                5.603n ± 0%    3.603n ± 0%  -35.70% (p=0.000 n=20)
MemmoveUnalignedSrc/3                6.403n ± 0%    3.207n ± 0%  -49.91% (p=0.000 n=20)
MemmoveUnalignedSrc/4                7.203n ± 0%    3.603n ± 0%  -49.98% (p=0.000 n=20)
MemmoveUnalignedSrc/5                8.004n ± 0%    3.602n ± 0%  -55.00% (p=0.000 n=20)
MemmoveUnalignedSrc/6                8.804n ± 0%    3.602n ± 0%  -59.09% (p=0.000 n=20)
MemmoveUnalignedSrc/7                9.605n ± 0%    3.602n ± 0%  -62.50% (p=0.000 n=20)
MemmoveUnalignedSrc/8               10.410n ± 0%    4.002n ± 0%  -61.56% (p=0.000 n=20)
MemmoveUnalignedSrc/9               11.210n ± 0%    3.802n ± 0%  -66.08% (p=0.000 n=20)
MemmoveUnalignedSrc/10              12.010n ± 0%    3.802n ± 0%  -68.34% (p=0.000 n=20)
MemmoveUnalignedSrc/11              12.810n ± 0%    3.802n ± 0%  -70.32% (p=0.000 n=20)
MemmoveUnalignedSrc/12              13.610n ± 0%    3.802n ± 0%  -72.06% (p=0.000 n=20)
MemmoveUnalignedSrc/13              14.410n ± 0%    3.802n ± 0%  -73.62% (p=0.000 n=20)
MemmoveUnalignedSrc/14              15.210n ± 0%    3.802n ± 0%  -75.00% (p=0.000 n=20)
MemmoveUnalignedSrc/15              16.010n ± 0%    3.802n ± 0%  -76.25% (p=0.000 n=20)
MemmoveUnalignedSrc/16              16.810n ± 0%    3.802n ± 0%  -77.38% (p=0.000 n=20)
MemmoveUnalignedSrc/32              30.410n ± 0%    4.301n ± 0%  -85.86% (p=0.000 n=20)
MemmoveUnalignedSrc/64              55.630n ± 0%    5.203n ± 0%  -90.65% (p=0.000 n=20)
MemmoveUnalignedSrc/128            107.300n ± 0%    8.805n ± 0%  -91.79% (p=0.000 n=20)
MemmoveUnalignedSrc/256             209.50n ± 0%    12.41n ± 6%  -94.08% (p=0.000 n=20)
MemmoveUnalignedSrc/512             414.20n ± 0%    20.41n ± 0%  -95.07% (p=0.000 n=20)
MemmoveUnalignedSrc/1024            828.00n ± 0%    36.92n ± 0%  -95.54% (p=0.000 n=20)
MemmoveUnalignedSrc/2048           1648.00n ± 0%    71.41n ± 0%  -95.67% (p=0.000 n=20)
MemmoveUnalignedSrc/4096            3287.0n ± 0%    132.2n ± 0%  -95.98% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_16_0        7.203n ± 0%    5.002n ± 0%  -30.56% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_16_0        7.604n ± 0%    5.002n ± 0%  -34.22% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_16_1       13.210n ± 0%    5.002n ± 0%  -62.13% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_16_1       13.210n ± 0%    5.002n ± 0%  -62.13% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_16_4       13.210n ± 0%    5.002n ± 0%  -62.13% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_16_4       13.610n ± 0%    5.002n ± 0%  -63.24% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_16_7       12.810n ± 0%    5.002n ± 0%  -60.95% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_16_7       13.610n ± 0%    5.002n ± 0%  -63.24% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_64_0       12.010n ± 0%    7.191n ± 0%  -40.12% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_64_0       12.410n ± 0%    7.194n ± 0%  -42.03% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_64_1       18.410n ± 0%    7.604n ± 0%  -58.70% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_64_1       18.410n ± 0%    7.604n ± 0%  -58.70% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_64_4       18.410n ± 0%    7.604n ± 0%  -58.70% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_64_4       18.810n ± 0%    7.604n ± 0%  -59.57% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_64_7       18.010n ± 0%    7.604n ± 0%  -57.78% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_64_7       18.810n ± 0%    7.604n ± 0%  -59.57% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_256_0       31.62n ± 0%    14.19n ± 0%  -55.12% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_256_0       32.02n ± 0%    13.61n ± 0%  -57.50% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_256_1       38.02n ± 0%    18.20n ± 0%  -52.13% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_256_1       38.02n ± 0%    18.41n ± 0%  -51.58% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_256_4       38.02n ± 0%    17.21n ± 0%  -54.73% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_256_4       38.42n ± 0%    16.81n ± 0%  -56.25% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_256_7       37.62n ± 0%    15.61n ± 0%  -58.51% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_256_7       38.42n ± 0%    15.01n ± 0%  -60.93% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_4096_0      415.8n ± 0%    111.1n ± 0%  -73.28% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_4096_0      416.2n ± 0%    110.5n ± 0%  -73.45% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_4096_1      422.2n ± 0%    114.3n ± 0%  -72.93% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_4096_1      422.2n ± 0%    114.7n ± 0%  -72.83% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_4096_4      422.2n ± 0%    113.3n ± 0%  -73.16% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_4096_4      422.6n ± 0%    113.1n ± 0%  -73.24% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_4096_7      421.8n ± 0%    111.7n ± 0%  -73.52% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_4096_7      422.6n ± 0%    111.7n ± 0%  -73.57% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_65536_0     6.568µ ± 0%    4.869µ ± 0%  -25.88% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_65536_0     6.568µ ± 0%    5.009µ ± 0%  -23.74% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_65536_1     6.574µ ± 0%    4.743µ ± 0%  -27.85% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_65536_1     6.574µ ± 0%    4.770µ ± 0%  -27.44% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_65536_4     6.574µ ± 0%    4.758µ ± 0%  -27.63% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_65536_4     6.574µ ± 0%    4.768µ ± 0%  -27.48% (p=0.000 n=20)
MemmoveUnalignedSrcDst/f_65536_7     6.574µ ± 0%    4.757µ ± 0%  -27.64% (p=0.000 n=20)
MemmoveUnalignedSrcDst/b_65536_7     6.574µ ± 0%    4.583µ ± 0%  -30.29% (p=0.000 n=20)
MemmoveUnalignedSrcOverlap/32       30.410n ± 0%    6.804n ± 0%  -77.63% (p=0.000 n=20)
MemmoveUnalignedSrcOverlap/64        56.03n ± 0%    10.01n ± 0%  -82.13% (p=0.000 n=20)
MemmoveUnalignedSrcOverlap/128      107.30n ± 0%    14.01n ± 0%  -86.94% (p=0.000 n=20)
MemmoveUnalignedSrcOverlap/256      209.70n ± 0%    13.43n ± 1%  -93.60% (p=0.000 n=20)
MemmoveUnalignedSrcOverlap/512      414.60n ± 0%    22.23n ± 0%  -94.64% (p=0.000 n=20)
MemmoveUnalignedSrcOverlap/1024     828.40n ± 0%    37.62n ± 0%  -95.46% (p=0.000 n=20)
MemmoveUnalignedSrcOverlap/2048    1648.00n ± 0%    68.04n ± 0%  -95.87% (p=0.000 n=20)
MemmoveUnalignedSrcOverlap/4096     3287.0n ± 0%    128.9n ± 0%  -96.08% (p=0.000 n=20)
geomean                              48.94n         13.58n       -72.26%

The relevant performance improved by 72.26%.

Change-Id: If2d3e09c3d687e733e6ff2c50feb8d6a8eb7e63b
Reviewed-on: https://go-review.googlesource.com/c/go/+/589537
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Auto-Submit: Tim King <taking@google.com>
2024-09-11 21:43:27 +00:00
Cherry Mui
eb975601a0 cmd/compile: correct wasmexport result type checking
The function resultsToWasmFields was originally for only
wasmimport. I adopted it for wasmexport as well, but forgot to
update a few places that were wasmimport-specific. This leads to
compiler panic if an invalid result type is passed, and also
unsafe.Pointer not actually supported. This CL fixes it.

Updates #65199.

Change-Id: I9bbd7154b70422504994840ff541c39ee596ee8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/611315
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-11 20:01:21 +00:00
Xiaolin Zhao
69827b5c8d crypto/subtle: implement xorBytes in hardware on loong64
goos: linux
goarch: loong64
pkg: crypto/subtle
cpu: Loongson-3A6000 @ 2500.00MHz
                    │  bench.old   │              bench.new              │
                    │    sec/op    │   sec/op     vs base                │
XORBytes/8Bytes       11.250n ± 0%   6.403n ± 0%  -43.08% (p=0.000 n=20)
XORBytes/128Bytes      24.61n ± 0%   12.21n ± 0%  -50.39% (p=0.000 n=20)
XORBytes/2048Bytes     216.7n ± 0%   108.3n ± 0%  -50.02% (p=0.000 n=20)
XORBytes/32768Bytes    3.657µ ± 0%   1.683µ ± 0%  -53.98% (p=0.000 n=20)
geomean                121.7n        61.44n       -49.52%

                    │  bench.old   │               bench.new                │
                    │     B/s      │      B/s       vs base                 │
XORBytes/8Bytes       678.1Mi ± 0%   1191.5Mi ± 0%   +75.72% (p=0.000 n=20)
XORBytes/128Bytes     4.844Gi ± 0%    9.766Gi ± 0%  +101.63% (p=0.000 n=20)
XORBytes/2048Bytes    8.801Gi ± 0%   17.619Gi ± 0%  +100.18% (p=0.000 n=20)
XORBytes/32768Bytes   8.346Gi ± 0%   18.137Gi ± 0%  +117.32% (p=0.000 n=20)
geomean               3.918Gi         7.763Gi        +98.14%

goos: linux
goarch: loong64
pkg: crypto/subtle
cpu: Loongson-3A5000 @ 2500.00MHz
                    │  bench.old   │              bench.new              │
                    │    sec/op    │   sec/op     vs base                │
XORBytes/8Bytes       16.420n ± 0%   8.806n ± 0%  -46.37% (p=0.000 n=20)
XORBytes/128Bytes      35.84n ± 0%   16.42n ± 0%  -54.19% (p=0.000 n=20)
XORBytes/2048Bytes     332.0n ± 0%   160.5n ± 0%  -51.64% (p=0.000 n=20)
XORBytes/32768Bytes    4.944µ ± 0%   2.474µ ± 0%  -49.96% (p=0.000 n=20)
geomean                176.3n        87.05n       -50.62%

                    │  bench.old   │               bench.new                │
                    │     B/s      │      B/s       vs base                 │
XORBytes/8Bytes       464.7Mi ± 0%    866.4Mi ± 0%   +86.45% (p=0.000 n=20)
XORBytes/128Bytes     3.326Gi ± 0%    7.261Gi ± 0%  +118.31% (p=0.000 n=20)
XORBytes/2048Bytes    5.745Gi ± 0%   11.880Gi ± 0%  +106.80% (p=0.000 n=20)
XORBytes/32768Bytes   6.172Gi ± 0%   12.334Gi ± 0%   +99.83% (p=0.000 n=20)
geomean               2.705Gi         5.477Gi       +102.52%

Change-Id: Id404f9023a57025f78b6922659cfa8870881d646
Reviewed-on: https://go-review.googlesource.com/c/go/+/590175
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-11 19:40:18 +00:00
Jes Cok
1dfb33e861 html/template: use maps.Copy in escaper.escapeListConditionally
To make it a little simpler.

Change-Id: I0d7f015e8f245fbdd8c5cf5c10e8d2bd44b91021
GitHub-Last-Rev: 2eae47fe8b
GitHub-Pull-Request: golang/go#69396
Reviewed-on: https://go-review.googlesource.com/c/go/+/612397
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-11 18:05:46 +00:00
Cuong Manh Le
2d9255b0ea cmd/compile/internal/typecheck: simplify IndexConst
types2 handles all constant-related bounds checks in user Go code now,
so it's safe to remove the check in IndexConst function.

Change-Id: I9116493f191c4df1cce7e43c8ac3dc5bf020fd5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/611675
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-09-11 17:13:48 +00:00
Cuong Manh Le
820329508a runtime: Goexit on C-created thread report more useful error message
This reverts CL 609296, with the fix for failing builders.

Fixes #68275

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-nocgo,gotip-darwin-amd64-nocgo,gotip-linux-ppc64_power10,gotip-linux-ppc64_power8
Change-Id: I0f539ee7b0be720642eee8885946edccd9c6e04e
Reviewed-on: https://go-review.googlesource.com/c/go/+/612335
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
2024-09-11 17:05:32 +00:00
Mark D Ryan
26aa8d6eb8 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 <taking@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@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>
2024-09-11 16:49:16 +00:00
Cuong Manh Le
5d06d165ff cmd/compile: remove types.Type rparams field
This field is present during the initial development of generic support
inside compiler, and indicating whether a type is fully instantiated is
the solely purpose at this moment. Further, its name is also confused,
and there have been a TODO to chose a better name for it.

Instead, just using a bit to track whether a type is fully instantiated,
then this rparams field can be removed to simplify the code.

Change-Id: Ia29c6dd5792487c440b83b0f3b77bd60917c2019
Reviewed-on: https://go-review.googlesource.com/c/go/+/611255
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-09-11 16:48:39 +00:00
Ian Lance Taylor
ec67622d04 cmd/compile, go/types: add missing space in error message
Otherwise "print(nil)" gets an error like
    use of untyped nil in argument to built-inprint

Change-Id: Iaa841df106f90787031dce75a49af69860a9dbc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/611918
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-09-11 16:19:00 +00:00
Tobias Klauser
9deda35ff8 cmd/cgo: use slices.ContainsFunc
Now that Go 1.22.6 is the minimum bootstrap toolchain (cf. CL 606156),
the slices package (introduced in Go 1.21) can be used in packages built
using the bootstrap toolchain.

For #64751

Change-Id: Ib36f39016f57c5e110f78a85ca9c806d91356024
Reviewed-on: https://go-review.googlesource.com/c/go/+/612316
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-11 14:12:40 +00:00
Dmitri Shuralyov
ad6ee21bbf go/printer: revert "do not treat comments inside a ast.Decl as godoc"
This reverts commit CL 609077.

Reason for revert: it turned out to also introduce a change to the
formatting as described in issue #69382, which wasn't intended.

For #69382.

Change-Id: Id8f36e5503e63e7586c8afe7c7d3dc25fd56ed94
Reviewed-on: https://go-review.googlesource.com/c/go/+/612137
Reviewed-by: Christian Höppner <hoeppi@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-11 06:30:02 +00:00
Meng Zhuo
90391c2e8a math: add round assembly implementations on riscv64
This CL reapplies CL 504737 and adds integer precision
limitation check, since CL 504737 only checks whether
floating point number is +-Inf or NaN.

This CL is also ~7% faster than CL 504737.

Updates #68322

goos: linux
goarch: riscv64
pkg: math
            │ math.old.bench │           math.new.bench            │
            │     sec/op     │   sec/op     vs base                │
Ceil             54.09n ± 0%   18.72n ± 0%  -65.39% (p=0.000 n=10)
Floor            40.72n ± 0%   18.72n ± 0%  -54.03% (p=0.000 n=10)
Round            20.73n ± 0%   20.73n ± 0%        ~ (p=1.000 n=10)
RoundToEven      24.07n ± 0%   24.07n ± 0%        ~ (p=1.000 n=10)
Trunc            38.72n ± 0%   18.72n ± 0%  -51.65% (p=0.000 n=10)
geomean          33.56n        20.09n       -40.13%

Change-Id: I06cfe2cb9e2535cd705d40b6650a7e71fedd906c
Reviewed-on: https://go-review.googlesource.com/c/go/+/600075
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-11 02:28:10 +00:00
Meng Zhuo
2982253c42 test/codegen: add Rotate test for riscv64
Change-Id: I7d996b8d46fbeef933943f806052a30f1f8d50c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/588836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-11 01:37:00 +00:00