]> Cypherpunks repositories - gostls13.git/commitdiff
math: implement Sqrt in assembly for riscv64
authorJoel Sing <joel@sing.id.au>
Tue, 25 Feb 2020 16:05:57 +0000 (03:05 +1100)
committerRobert Griesemer <gri@golang.org>
Tue, 25 Feb 2020 16:43:26 +0000 (16:43 +0000)
Change-Id: I9a5dc33271434e58335f5562a30cc131c6a8332c
Reviewed-on: https://go-review.googlesource.com/c/go/+/220918
Reviewed-by: Robert Griesemer <gri@golang.org>
src/math/sqrt_riscv64.s [new file with mode: 0644]
src/math/stubs_riscv64.s

diff --git a/src/math/sqrt_riscv64.s b/src/math/sqrt_riscv64.s
new file mode 100644 (file)
index 0000000..048171b
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build riscv64
+
+#include "textflag.h"
+
+// func Sqrt(x float64) float64
+TEXT ·Sqrt(SB),NOSPLIT,$0
+       MOVD    x+0(FP), F0
+       FSQRTD  F0, F0
+       MOVD    F0, ret+8(FP)
+       RET
index 6a122125e65b38b9fe6a8fba59e0a39c2f2b2234..ed2b5728647ce6b185ce79805c72662e12b00b74 100644 (file)
@@ -97,9 +97,6 @@ TEXT ·Cos(SB),NOSPLIT,$0
 TEXT ·Cosh(SB),NOSPLIT,$0
        JMP ·cosh(SB)
 
-TEXT ·Sqrt(SB),NOSPLIT,$0
-       JMP ·sqrt(SB)
-
 TEXT ·Tan(SB),NOSPLIT,$0
        JMP ·tan(SB)