aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2025-09-12 20:54:49 +1000
committerJoel Sing <joel@sing.id.au>2025-09-16 08:43:10 -0700
commite2cfc1eb3affe8bcdfeca4a9f0a2d7902dbb940f (patch)
tree81de0c326310136913139790ec9f144c6288e6bd /src/cmd/asm
parent281c632e6e3df290d4b0f92440cba10903a0295f (diff)
downloadgo-e2cfc1eb3affe8bcdfeca4a9f0a2d7902dbb940f.tar.xz
cmd/internal/obj/riscv: improve handling of float point moves
Translate moves from an integer register to a floating point register, or from a floating point register to an integer register, to the appropriate move instruction (i.e. FMVXW/FMVWX/FMVXD/FMVDX). Add support for MOVF with a constant - we previously added support for MOVD but not for MOVF. Add special handling for 0.0, which we can translate to a move from the zero register to a floating point register (leveraging the above mentioned change). Change-Id: If8df2f5610e69b4ec0af85efb884951024685f5b Reviewed-on: https://go-review.googlesource.com/c/go/+/703216 Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/testdata/riscv64.s13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/cmd/asm/internal/asm/testdata/riscv64.s b/src/cmd/asm/internal/asm/testdata/riscv64.s
index 4f7e7acd77..39d2faac25 100644
--- a/src/cmd/asm/internal/asm/testdata/riscv64.s
+++ b/src/cmd/asm/internal/asm/testdata/riscv64.s
@@ -1952,12 +1952,23 @@ start:
MOVF 4(X5), F0 // 07a04200
MOVF F0, 4(X5) // 27a20200
MOVF F0, F1 // d3000020
+ MOVF X1, F3 // d38100f0
+ MOVF F3, X1 // d38001e0
+ MOVF X0, F3 // d30100f0
+ MOVF $(0.0), F3 // d30100f0
+
+ // Converted to load of symbol (AUIPC + FLW)
+ MOVF $(709.78271289338397), F3 // 970f000087a10f00
MOVD 4(X5), F0 // 07b04200
MOVD F0, 4(X5) // 27b20200
MOVD F0, F1 // d3000022
+ MOVD F3, X1 // d38001e2
+ MOVD X1, F3 // d38100f2
+ MOVD X0, F3 // d30100f2
+ MOVD $(0.0), F3 // d30100f2
- // Convert to load of symbol (AUIPC + FLD)
+ // Converted to load of symbol (AUIPC + FLD)
MOVD $(709.78271289338397), F3 // 970f000087b10f00
// TLS load with local-exec (LUI + ADDIW + ADD of TP + load)