aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Munday <mike.munday@lowrisc.org>2021-09-09 23:47:14 +0100
committerMichael Munday <mike.munday@lowrisc.org>2021-09-10 10:45:59 +0000
commitc69f5c0d7632381dfc6dc78f0af4f54e7673176d (patch)
treeaa08f8077659f7401bd07cc11c7c90d06730c093 /test
parent2091bd3f26e5143bd050833b3558893e1bc34625 (diff)
downloadgo-c69f5c0d7632381dfc6dc78f0af4f54e7673176d.tar.gz
go-c69f5c0d7632381dfc6dc78f0af4f54e7673176d.zip
cmd/compile: add support for Abs and Copysign intrinsics on riscv64
Also, add the FABSS and FABSD pseudo instructions to the assembler. The compiler could use FSGNJX[SD] directly but there doesn't seem to be much advantage to doing so and the pseudo instructions are easier to understand. Change-Id: Ie8825b8aa8773c69cc4f07a32ef04abf4061d80d Reviewed-on: https://go-review.googlesource.com/c/go/+/348989 Trust: Michael Munday <mike.munday@lowrisc.org> Run-TryBot: Michael Munday <mike.munday@lowrisc.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Joel Sing <joel@sing.id.au>
Diffstat (limited to 'test')
-rw-r--r--test/codegen/math.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/codegen/math.go b/test/codegen/math.go
index cd573db7b3..df2ebd79e1 100644
--- a/test/codegen/math.go
+++ b/test/codegen/math.go
@@ -73,6 +73,7 @@ func abs(x, y float64) {
// s390x:"LPDFR\t",-"MOVD\t" (no integer load/store)
// ppc64:"FABS\t"
// ppc64le:"FABS\t"
+ // riscv64:"FABSD\t"
// wasm:"F64Abs"
// arm/6:"ABSD\t"
sink64[0] = math.Abs(x)
@@ -96,6 +97,7 @@ func copysign(a, b, c float64) {
// s390x:"CPSDR",-"MOVD" (no integer load/store)
// ppc64:"FCPSGN"
// ppc64le:"FCPSGN"
+ // riscv64:"FSGNJD"
// wasm:"F64Copysign"
sink64[0] = math.Copysign(a, b)
@@ -103,6 +105,7 @@ func copysign(a, b, c float64) {
// s390x:"LNDFR\t",-"MOVD\t" (no integer load/store)
// ppc64:"FCPSGN"
// ppc64le:"FCPSGN"
+ // riscv64:"FSGNJD"
// arm64:"ORR", -"AND"
sink64[1] = math.Copysign(c, -1)
@@ -115,6 +118,7 @@ func copysign(a, b, c float64) {
// s390x:"CPSDR\t",-"MOVD\t" (no integer load/store)
// ppc64:"FCPSGN"
// ppc64le:"FCPSGN"
+ // riscv64:"FSGNJD"
sink64[3] = math.Copysign(-1, c)
}