diff options
author | Sokolov Yura <funny.falcon@gmail.com> | 2017-01-05 09:36:27 +0300 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-02-10 19:16:29 +0000 |
commit | d03c1248604679e1e6a01253144065bc57da48b8 (patch) | |
tree | e668dc946c619cc67b9a5b79df244e58bf0b2233 /src/runtime/asm_s390x.s | |
parent | 9f75ecd5e12f2b9988086954933d610cd5647918 (diff) | |
download | go-d03c1248604679e1e6a01253144065bc57da48b8.tar.gz go-d03c1248604679e1e6a01253144065bc57da48b8.zip |
runtime: implement fastrand in go
So it could be inlined.
Using bit-tricks it could be implemented without condition
(improved trick version by Minux Ma).
Simple benchmark shows it is faster on i386 and x86_64, though
I don't know will it be faster on other architectures?
benchmark old ns/op new ns/op delta
BenchmarkFastrand-3 2.79 1.48 -46.95%
BenchmarkFastrandHashiter-3 25.9 24.9 -3.86%
Change-Id: Ie2eb6d0f598c0bb5fac7f6ad0f8b5e3eddaa361b
Reviewed-on: https://go-review.googlesource.com/34782
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/asm_s390x.s')
-rw-r--r-- | src/runtime/asm_s390x.s | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s index c2212a5f21..50a29e89d2 100644 --- a/src/runtime/asm_s390x.s +++ b/src/runtime/asm_s390x.s @@ -851,17 +851,6 @@ TEXT runtime·memeqbodyclc(SB),NOSPLIT|NOFRAME,$0-0 CLC $1, 0(R3), 0(R5) RET -TEXT runtime·fastrand(SB), NOSPLIT, $0-4 - MOVD g_m(g), R4 - MOVWZ m_fastrand(R4), R3 - ADD R3, R3 - CMPW R3, $0 - BGE 2(PC) - XOR $0x88888eef, R3 - MOVW R3, m_fastrand(R4) - MOVW R3, ret+0(FP) - RET - TEXT bytes·IndexByte(SB),NOSPLIT|NOFRAME,$0-40 MOVD s+0(FP), R3 // s => R3 MOVD s_len+8(FP), R4 // s_len => R4 |