]> Cypherpunks repositories - gostls13.git/commit
runtime: use hardware divider to improve performance
authorBen Shi <powerman1st@163.com>
Mon, 27 Feb 2017 07:56:57 +0000 (07:56 +0000)
committerCherry Zhang <cherryyz@google.com>
Tue, 11 Apr 2017 12:25:55 +0000 (12:25 +0000)
commit69261ecad6dd2f3efd5e4a249325ea27311526b6
tree183eb53b19753469b00f3f9e8338f342b8c71fd5
parent2a8d99e427ab19cb4f00680244f31818b53aa238
runtime: use hardware divider to improve performance

The hardware divider is an optional component of ARMv7. This patch
detects whether it is available in runtime and use it or not.

1. The hardware divider is detected at startup and a flag is set/clear
   according to a perticular bit of runtime.hwcap.
2. Each call of runtime.udiv will check this flag and decide if
   use the hardware division instruction.

A rough test shows the performance improves 40-50% for ARMv7. And
the compatibility of ARMv5/v6 is not broken.

fixes #19118

Change-Id: Ic586bc9659ebc169553ca2004d2bdb721df823ac
Reviewed-on: https://go-review.googlesource.com/37496
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
16 files changed:
misc/cgo/testcshared/main0.c
misc/cgo/testcshared/src/p/p.go
misc/cgo/testshared/shared_test.go
misc/cgo/testshared/src/division/division.go [new file with mode: 0644]
src/cmd/asm/internal/asm/testdata/arm.s
src/cmd/internal/obj/arm/a.out.go
src/cmd/internal/obj/arm/anames.go
src/cmd/internal/obj/arm/asm5.go
src/runtime/os_darwin_arm.go
src/runtime/os_freebsd_arm.go
src/runtime/os_linux_arm.go
src/runtime/os_nacl_arm.go
src/runtime/os_netbsd_arm.go
src/runtime/os_openbsd_arm.go
src/runtime/os_plan9_arm.go
src/runtime/vlop_arm.s