aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_arm64.s
diff options
context:
space:
mode:
authorXiangdong Ji <xiangdong.ji@arm.com>2019-11-21 07:46:37 +0000
committerTobias Klauser <tobias.klauser@gmail.com>2020-03-03 09:29:47 +0000
commit52b457d6f320c3491ab14a71afc3c7416b36430c (patch)
tree0329451487e1e9383912627557b11a6cbee6f750 /src/runtime/asm_arm64.s
parent34830beffa6396129bd9d9da58afb7a046775d49 (diff)
downloadgo-52b457d6f320c3491ab14a71afc3c7416b36430c.tar.gz
go-52b457d6f320c3491ab14a71afc3c7416b36430c.zip
runtime: use CBZ/CBNZ in linux/arm64 assembly code
Replace compare and branch on zero/non-zero instructions in linux/arm64 assembly files with CBZ/CBNZ. Change-Id: I4dbf56678f85827e83b5863804368bc28a4603b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/209617 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Diffstat (limited to 'src/runtime/asm_arm64.s')
-rw-r--r--src/runtime/asm_arm64.s36
1 files changed, 12 insertions, 24 deletions
diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s
index 0be06d124e..6b3d1e779e 100644
--- a/src/runtime/asm_arm64.s
+++ b/src/runtime/asm_arm64.s
@@ -27,8 +27,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0
// if there is a _cgo_init, call it using the gcc ABI.
MOVD _cgo_init(SB), R12
- CMP $0, R12
- BEQ nocgo
+ CBZ R12, nocgo
MRS_TPIDR_R0 // load TLS base pointer
MOVD R0, R3 // arg 3: TLS base pointer
@@ -114,8 +113,7 @@ TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8
MOVD ZR, gobuf_ret(R3)
// Assert ctxt is zero. See func save.
MOVD gobuf_ctxt(R3), R0
- CMP $0, R0
- BEQ 2(PC)
+ CBZ R0, 2(PC)
CALL runtime·badctxt(SB)
RET
@@ -448,8 +446,7 @@ CALLFN(·call1073741824, 1073741832 )
// func memhash32(p unsafe.Pointer, h uintptr) uintptr
TEXT runtime·memhash32(SB),NOSPLIT|NOFRAME,$0-24
MOVB runtime·useAeshash(SB), R0
- CMP $0, R0
- BEQ noaes
+ CBZ R0, noaes
MOVD p+0(FP), R0
MOVD h+8(FP), R1
MOVD $ret+16(FP), R2
@@ -474,8 +471,7 @@ noaes:
// func memhash64(p unsafe.Pointer, h uintptr) uintptr
TEXT runtime·memhash64(SB),NOSPLIT|NOFRAME,$0-24
MOVB runtime·useAeshash(SB), R0
- CMP $0, R0
- BEQ noaes
+ CBZ R0, noaes
MOVD p+0(FP), R0
MOVD h+8(FP), R1
MOVD $ret+16(FP), R2
@@ -500,8 +496,7 @@ noaes:
// func memhash(p unsafe.Pointer, h, size uintptr) uintptr
TEXT runtime·memhash(SB),NOSPLIT|NOFRAME,$0-32
MOVB runtime·useAeshash(SB), R0
- CMP $0, R0
- BEQ noaes
+ CBZ R0, noaes
MOVD p+0(FP), R0
MOVD s+16(FP), R1
MOVD h+8(FP), R3
@@ -513,8 +508,7 @@ noaes:
// func strhash(p unsafe.Pointer, h uintptr) uintptr
TEXT runtime·strhash(SB),NOSPLIT|NOFRAME,$0-24
MOVB runtime·useAeshash(SB), R0
- CMP $0, R0
- BEQ noaes
+ CBZ R0, noaes
MOVD p+0(FP), R10 // string pointer
LDP (R10), (R0, R1) //string data/ length
MOVD h+8(FP), R3
@@ -548,8 +542,7 @@ TEXT aeshashbody<>(SB),NOSPLIT|NOFRAME,$0
B aes129plus
aes0to15:
- CMP $0, R1
- BEQ aes0
+ CBZ R1, aes0
VEOR V2.B16, V2.B16, V2.B16
TBZ $3, R1, less_than_8
VLD1.P 8(R0), V2.D[0]
@@ -879,8 +872,7 @@ TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
MOVD $0, (g_sched+gobuf_ret)(g)
// Assert ctxt is zero. See func save.
MOVD (g_sched+gobuf_ctxt)(g), R0
- CMP $0, R0
- BEQ 2(PC)
+ CBZ R0, 2(PC)
CALL runtime·badctxt(SB)
RET
@@ -893,8 +885,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20
MOVD arg+8(FP), R0
MOVD RSP, R2 // save original stack pointer
- CMP $0, g
- BEQ nosave
+ CBZ g, nosave
MOVD g, R4
// Figure out if we need to switch to m->g0 stack.
@@ -990,8 +981,7 @@ TEXT ·cgocallback_gofunc(SB),NOSPLIT,$24-32
// Load g from thread-local storage.
MOVB runtime·iscgo(SB), R3
- CMP $0, R3
- BEQ nocgo
+ CBZ R3, nocgo
BL runtime·load_g(SB)
nocgo:
@@ -1000,8 +990,7 @@ nocgo:
// In this case, we're running on the thread stack, so there's
// lots of space, but the linker doesn't know. Hide the call from
// the linker analysis by using an indirect call.
- CMP $0, g
- BEQ needm
+ CBZ g, needm
MOVD g_m(g), R8
MOVD R8, savedm-8(SP)
@@ -1092,8 +1081,7 @@ havem:
// If the m on entry was nil, we called needm above to borrow an m
// for the duration of the call. Since the call is over, return it with dropm.
MOVD savedm-8(SP), R6
- CMP $0, R6
- BNE droppedm
+ CBNZ R6, droppedm
MOVD $runtime·dropm(SB), R0
BL (R0)
droppedm: