]> Cypherpunks repositories - gostls13.git/commitdiff
math: ARM assembly implementation for Abs
authorShenghou Ma <minux.ma@gmail.com>
Mon, 23 Apr 2012 15:47:36 +0000 (23:47 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Mon, 23 Apr 2012 15:47:36 +0000 (23:47 +0800)
Obtained on 700MHz OMAP4460:
benchmark       old ns/op    new ns/op    delta
BenchmarkAbs           61           23  -61.63%

R=dave, remyoudompheng, mtj, rsc
CC=golang-dev
https://golang.org/cl/6094047

src/pkg/math/abs_arm.s

index 23f6a2a2de444b8f6ce7ed980d0da6a188f6ad15..d7a406bec12430f77e9c8d21d3fb3147536ae8bc 100644 (file)
@@ -3,4 +3,9 @@
 // license that can be found in the LICENSE file.
 
 TEXT ·Abs(SB),7,$0
-       B ·abs(SB)
+       MOVW    lo+0(FP), R0
+       MOVW    hi+4(FP), R1
+       AND     $((1<<31)-1), R1
+       MOVW    R0, resultlo+8(FP)
+       MOVW    R1, resulthi+12(FP)
+       RET