[go] runtime: simplify the implementation of walltime and nanotime1 on loong64

5 views
Skip to first unread message

abner chenc (Gerrit)

unread,
Feb 3, 2026, 6:18:15 AM (4 days ago) Feb 3
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

abner chenc has uploaded the change for review

Commit message

runtime: simplify the implementation of walltime and nanotime1 on loong64

goos: linux
goarch: loong64
pkg: time
cpu: Loongson-3A6000 @ 2500.00MHz
| old.txt | new.txt |
| sec/op | sec/op vs base |
Now 34.82n ± 0% 34.24n ± 0% -1.67% (p=0.000 n=10)
NowUnixNano 35.44n ± 0% 35.82n ± 0% +1.07% (p=0.000 n=10)
NowUnixMilli 36.05n ± 0% 34.24n ± 0% -5.02% (p=0.000 n=10)
NowUnixMicro 36.83n ± 0% 34.83n ± 0% -5.43% (p=0.000 n=10)
geomean 35.78n 34.78n -2.80%
Change-Id: I6ab143b61dbf94c91df2e9dfb80ec9b908219825

Change diff

diff --git a/src/runtime/sys_linux_loong64.s b/src/runtime/sys_linux_loong64.s
index 41e12c3..0abbda4 100644
--- a/src/runtime/sys_linux_loong64.s
+++ b/src/runtime/sys_linux_loong64.s
@@ -205,7 +205,6 @@
// func walltime() (sec int64, nsec int32)
TEXT runtime·walltime<ABIInternal>(SB),NOSPLIT,$24
MOVV R3, R23 // R23 is unchanged by C code
- MOVV R3, R25

MOVV g_m(g), R24 // R24 = m

@@ -222,16 +221,14 @@
MOVV R11, m_vdsoSP(R24)

MOVV m_curg(R24), R4
- MOVV g, R5
- BNE R4, R5, noswitch
+ BNE R4, g, noswitch

MOVV m_g0(R24), R4
- MOVV (g_sched+gobuf_sp)(R4), R25 // Set SP to g0 stack
+ MOVV (g_sched+gobuf_sp)(R4), R3 // Set SP to g0 stack

noswitch:
- SUBV $16, R25
- AND $~15, R25 // Align for C code
- MOVV R25, R3
+ SUBV $16, R3
+ AND $~15, R3 // Align for C code

MOVW $CLOCK_REALTIME, R4
MOVV $0(R3), R5
@@ -283,7 +280,6 @@
// func nanotime1() int64
TEXT runtime·nanotime1<ABIInternal>(SB),NOSPLIT,$24
MOVV R3, R23 // R23 is unchanged by C code
- MOVV R3, R25

MOVV g_m(g), R24 // R24 = m

@@ -300,16 +296,14 @@
MOVV R11, m_vdsoSP(R24)

MOVV m_curg(R24), R4
- MOVV g, R5
- BNE R4, R5, noswitch
+ BNE R4, g, noswitch

MOVV m_g0(R24), R4
- MOVV (g_sched+gobuf_sp)(R4), R25 // Set SP to g0 stack
+ MOVV (g_sched+gobuf_sp)(R4), R3 // Set SP to g0 stack

noswitch:
- SUBV $16, R25
- AND $~15, R25 // Align for C code
- MOVV R25, R3
+ SUBV $16, R3
+ AND $~15, R3 // Align for C code

MOVW $CLOCK_MONOTONIC, R4
MOVV $0(R3), R5

Change information

Files:
  • M src/runtime/sys_linux_loong64.s
Change size: S
Delta: 1 file changed, 8 insertions(+), 14 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I6ab143b61dbf94c91df2e9dfb80ec9b908219825
Gerrit-Change-Number: 741380
Gerrit-PatchSet: 1
Gerrit-Owner: abner chenc <chen...@loongson.cn>
unsatisfied_requirement
satisfied_requirement
open
diffy

abner chenc (Gerrit)

unread,
Feb 3, 2026, 6:33:07 AM (4 days ago) Feb 3
to goph...@pubsubhelper.golang.org, Meidan Li, sophie zhao, Austin Clements, Keith Randall, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Austin Clements, Keith Randall, Martin Möhrmann, Meidan Li and sophie zhao

abner chenc voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Austin Clements
  • Keith Randall
  • Martin Möhrmann
  • Meidan Li
  • sophie zhao
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I6ab143b61dbf94c91df2e9dfb80ec9b908219825
Gerrit-Change-Number: 741380
Gerrit-PatchSet: 1
Gerrit-Owner: abner chenc <chen...@loongson.cn>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
Gerrit-Reviewer: Meidan Li <lime...@loongson.cn>
Gerrit-Reviewer: abner chenc <chen...@loongson.cn>
Gerrit-Reviewer: sophie zhao <zhaox...@loongson.cn>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Keith Randall <k...@golang.org>
Gerrit-Attention: sophie zhao <zhaox...@loongson.cn>
Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
Gerrit-Attention: Meidan Li <lime...@loongson.cn>
Gerrit-Attention: Austin Clements <aus...@google.com>
Gerrit-Comment-Date: Tue, 03 Feb 2026 11:32:58 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Keith Randall (Gerrit)

unread,
Feb 3, 2026, 6:23:06 PM (3 days ago) Feb 3
to abner chenc, goph...@pubsubhelper.golang.org, Keith Randall, Go LUCI, Meidan Li, sophie zhao, Austin Clements, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Austin Clements, Martin Möhrmann, Meidan Li, abner chenc and sophie zhao

Keith Randall voted Code-Review+2

Code-Review+2
Open in Gerrit

Related details

Attention is currently required from:
  • Austin Clements
  • Martin Möhrmann
  • Meidan Li
  • abner chenc
  • sophie zhao
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I6ab143b61dbf94c91df2e9dfb80ec9b908219825
Gerrit-Change-Number: 741380
Gerrit-PatchSet: 1
Gerrit-Owner: abner chenc <chen...@loongson.cn>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
Gerrit-Reviewer: Meidan Li <lime...@loongson.cn>
Gerrit-Reviewer: abner chenc <chen...@loongson.cn>
Gerrit-Reviewer: sophie zhao <zhaox...@loongson.cn>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: abner chenc <chen...@loongson.cn>
Gerrit-Attention: sophie zhao <zhaox...@loongson.cn>
Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
Gerrit-Attention: Meidan Li <lime...@loongson.cn>
Gerrit-Attention: Austin Clements <aus...@google.com>
Gerrit-Comment-Date: Tue, 03 Feb 2026 23:23:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Keith Randall (Gerrit)

unread,
Feb 3, 2026, 6:23:14 PM (3 days ago) Feb 3
to abner chenc, goph...@pubsubhelper.golang.org, Keith Randall, Go LUCI, Meidan Li, sophie zhao, Austin Clements, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Austin Clements, Martin Möhrmann, Meidan Li, abner chenc and sophie zhao

Keith Randall voted Code-Review+1

Code-Review+1
Gerrit-Reviewer: Keith Randall <k...@google.com>
Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
Gerrit-Reviewer: Meidan Li <lime...@loongson.cn>
Gerrit-Reviewer: abner chenc <chen...@loongson.cn>
Gerrit-Reviewer: sophie zhao <zhaox...@loongson.cn>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: abner chenc <chen...@loongson.cn>
Gerrit-Attention: sophie zhao <zhaox...@loongson.cn>
Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
Gerrit-Attention: Meidan Li <lime...@loongson.cn>
Gerrit-Attention: Austin Clements <aus...@google.com>
Gerrit-Comment-Date: Tue, 03 Feb 2026 23:23:09 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Meidan Li (Gerrit)

unread,
Feb 4, 2026, 4:31:00 AM (3 days ago) Feb 4
to abner chenc, goph...@pubsubhelper.golang.org, Keith Randall, Keith Randall, Go LUCI, sophie zhao, Austin Clements, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Austin Clements, Martin Möhrmann, abner chenc and sophie zhao

Meidan Li voted Code-Review+2

Code-Review+2
Open in Gerrit

Related details

Attention is currently required from:
  • Austin Clements
  • Martin Möhrmann
  • abner chenc
  • sophie zhao
Gerrit-Attention: Austin Clements <aus...@google.com>
Gerrit-Comment-Date: Wed, 04 Feb 2026 09:30:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

sophie zhao (Gerrit)

unread,
Feb 5, 2026, 7:53:18 AM (2 days ago) Feb 5
to abner chenc, goph...@pubsubhelper.golang.org, Meidan Li, Keith Randall, Keith Randall, Go LUCI, Austin Clements, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Austin Clements, Martin Möhrmann and abner chenc

sophie zhao voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Austin Clements
  • Martin Möhrmann
  • abner chenc
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I6ab143b61dbf94c91df2e9dfb80ec9b908219825
Gerrit-Change-Number: 741380
Gerrit-PatchSet: 1
Gerrit-Owner: abner chenc <chen...@loongson.cn>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@google.com>
Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
Gerrit-Reviewer: Meidan Li <lime...@loongson.cn>
Gerrit-Reviewer: abner chenc <chen...@loongson.cn>
Gerrit-Reviewer: sophie zhao <zhaox...@loongson.cn>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: abner chenc <chen...@loongson.cn>
Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
Gerrit-Attention: Austin Clements <aus...@google.com>
Gerrit-Comment-Date: Thu, 05 Feb 2026 12:53:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Michael Knyszek (Gerrit)

unread,
Feb 6, 2026, 12:34:02 PM (14 hours ago) Feb 6
to abner chenc, goph...@pubsubhelper.golang.org, sophie zhao, Meidan Li, Keith Randall, Keith Randall, Go LUCI, Austin Clements, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Austin Clements, Martin Möhrmann and abner chenc

Michael Knyszek voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Austin Clements
  • Martin Möhrmann
  • abner chenc
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I6ab143b61dbf94c91df2e9dfb80ec9b908219825
    Gerrit-Change-Number: 741380
    Gerrit-PatchSet: 1
    Gerrit-Owner: abner chenc <chen...@loongson.cn>
    Gerrit-Reviewer: Austin Clements <aus...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Reviewer: Keith Randall <k...@google.com>
    Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
    Gerrit-Reviewer: Meidan Li <lime...@loongson.cn>
    Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
    Gerrit-Reviewer: abner chenc <chen...@loongson.cn>
    Gerrit-Reviewer: sophie zhao <zhaox...@loongson.cn>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: abner chenc <chen...@loongson.cn>
    Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
    Gerrit-Attention: Austin Clements <aus...@google.com>
    Gerrit-Comment-Date: Fri, 06 Feb 2026 17:33:58 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    abner chenc (Gerrit)

    unread,
    Feb 6, 2026, 7:54:51 PM (6 hours ago) Feb 6
    to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Michael Knyszek, sophie zhao, Meidan Li, Keith Randall, Keith Randall, Go LUCI, Austin Clements, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com

    abner chenc submitted the change

    Change information

    Commit message:
    runtime: simplify the implementation of walltime and nanotime1 on loong64

    goos: linux
    goarch: loong64
    pkg: time
    cpu: Loongson-3A6000 @ 2500.00MHz
    | old.txt | new.txt |
    | sec/op | sec/op vs base |
    Now 34.82n ± 0% 34.24n ± 0% -1.67% (p=0.000 n=10)
    NowUnixNano 35.44n ± 0% 35.82n ± 0% +1.07% (p=0.000 n=10)
    NowUnixMilli 36.05n ± 0% 34.24n ± 0% -5.02% (p=0.000 n=10)
    NowUnixMicro 36.83n ± 0% 34.83n ± 0% -5.43% (p=0.000 n=10)
    geomean 35.78n 34.78n -2.80%
    Change-Id: I6ab143b61dbf94c91df2e9dfb80ec9b908219825
    Reviewed-by: Keith Randall <k...@google.com>
    Reviewed-by: Michael Knyszek <mkny...@google.com>
    Reviewed-by: Keith Randall <k...@golang.org>
    Reviewed-by: sophie zhao <zhaox...@loongson.cn>
    Reviewed-by: Meidan Li <lime...@loongson.cn>
    Files:
    • M src/runtime/sys_linux_loong64.s
    Change size: S
    Delta: 1 file changed, 8 insertions(+), 14 deletions(-)
    Branch: refs/heads/master
    Submit Requirements:
    • requirement satisfiedCode-Review: +2 by Keith Randall, +1 by sophie zhao, +1 by Keith Randall, +2 by Meidan Li, +1 by Michael Knyszek
    • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I6ab143b61dbf94c91df2e9dfb80ec9b908219825
    Gerrit-Change-Number: 741380
    Gerrit-PatchSet: 2
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages