]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use the CBZ instruction in the assembler
authorHeisenberg <lziqiang1@gmail.com>
Thu, 11 Jun 2020 03:17:20 +0000 (11:17 +0800)
committerKeith Randall <khr@golang.org>
Mon, 17 Aug 2020 20:59:59 +0000 (20:59 +0000)
Use CBZ to replace the comparison and branch of arm64 and the zero instruction in the assembly file.

Change-Id: Id6c03e9af13aadafc3ad3953f82d2ffa29c12926
Reviewed-on: https://go-review.googlesource.com/c/go/+/237497
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/rt0_freebsd_arm64.s
src/runtime/rt0_netbsd_arm64.s
src/runtime/rt0_openbsd_arm64.s

index 3a348c33e20e49637d359b6a6ff4e86d2050d484..a938d98262e7aa50c20801dd653dd2320fbefd5c 100644 (file)
@@ -45,8 +45,7 @@ TEXT _rt0_arm64_freebsd_lib(SB),NOSPLIT,$184
 
        // Create a new thread to do the runtime initialization and return.
        MOVD    _cgo_sys_thread_create(SB), R4
-       CMP     $0, R4
-       BEQ     nocgo
+       CBZ     R4, nocgo
        MOVD    $_rt0_arm64_freebsd_lib_go(SB), R0
        MOVD    $0, R1
        SUB     $16, RSP        // reserve 16 bytes for sp-8 where fp may be saved.
index 75ecbe517672d355c5adc13467511940279f3691..2f3b5a5a87a0cd4ce52afd6df7c03361a839dbeb 100644 (file)
@@ -44,8 +44,7 @@ TEXT _rt0_arm64_netbsd_lib(SB),NOSPLIT,$184
 
        // Create a new thread to do the runtime initialization and return.
        MOVD    _cgo_sys_thread_create(SB), R4
-       CMP     $0, R4
-       BEQ     nocgo
+       CBZ     R4, nocgo
        MOVD    $_rt0_arm64_netbsd_lib_go(SB), R0
        MOVD    $0, R1
        SUB     $16, RSP                // reserve 16 bytes for sp-8 where fp may be saved.
index 12408f2eecdbe8143565da39b8c624dbc8c6f2d7..722fab6129296e1fd6e980ae3273469ad819ea80 100644 (file)
@@ -50,8 +50,7 @@ TEXT _rt0_arm64_openbsd_lib(SB),NOSPLIT,$184
 
        // Create a new thread to do the runtime initialization and return.
        MOVD    _cgo_sys_thread_create(SB), R4
-       CMP     $0, R4
-       BEQ     nocgo
+       CBZ     R4, nocgo
        MOVD    $_rt0_arm64_openbsd_lib_go(SB), R0
        MOVD    $0, R1
        SUB     $16, RSP                // reserve 16 bytes for sp-8 where fp may be saved.