From 82a761b656704c07a94c12b10141a0cdba1a4534 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Thu, 5 Feb 2015 08:23:14 -0800 Subject: [PATCH] runtime: speed up eqstring eqstring does not need to check the length of the strings. Other architectures were done in a separate commit. While we're here, add a pointer equality check. Change-Id: Id2c8616a03a7da7037c1e9ccd56a549fc952bd98 Reviewed-on: https://go-review.googlesource.com/3956 Reviewed-by: Keith Randall --- src/runtime/asm_ppc64x.s | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index 660c7cdfe5..694dfcc24e 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -969,30 +969,30 @@ eq: RETURN // eqstring tests whether two strings are equal. +// The compiler guarantees that strings passed +// to eqstring have equal length. // See runtime_test.go:eqstring_generic for // equivalent Go code. TEXT runtime·eqstring(SB),NOSPLIT,$0-33 - MOVD s1len+8(FP), R4 - MOVD s2len+24(FP), R5 - CMP R4, R5 - BNE noteq - MOVD s1str+0(FP), R3 MOVD s2str+16(FP), R4 + MOVD $1, R5 + MOVB R5, ret+32(FP) + CMP R3, R4 + BNE 2(PC) + RETURN + MOVD s1len+8(FP), R5 SUB $1, R3 SUB $1, R4 ADD R3, R5, R8 loop: CMP R3, R8 - BNE 4(PC) - MOVD $1, R3 - MOVB R3, ret+32(FP) + BNE 2(PC) RETURN MOVBZU 1(R3), R6 MOVBZU 1(R4), R7 CMP R6, R7 BEQ loop -noteq: MOVB R0, ret+32(FP) RETURN