aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2024-06-12 18:25:55 -0700
committerKeith Randall <khr@golang.org>2024-07-23 20:53:57 +0000
commitf66db499769002f1f804f52234b7c3e5917bbad6 (patch)
treef4a51d385077e00ee64d98f1561e69ee7ee290d7 /test/codegen
parentd15525d596eb49eba058178e3b633b5a2ebb4766 (diff)
downloadgo-f66db499769002f1f804f52234b7c3e5917bbad6.tar.xz
cmd/compile: store constant floats using integer constants
x86 is better at storing constant ints than constant floats. (It uses a constant directly in the instruction stream, instead of loading it from a constant global memory.) Noticed as part of #67957 Change-Id: I9b7b586ad8e0fe9ce245324f020e9526f82b209d Reviewed-on: https://go-review.googlesource.com/c/go/+/592596 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/floats.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/codegen/floats.go b/test/codegen/floats.go
index baa745bdee..d38df1cacb 100644
--- a/test/codegen/floats.go
+++ b/test/codegen/floats.go
@@ -227,3 +227,12 @@ func Float64DenormalFloat32Constant() float64 {
// ppc64x:"FMOVD\t[$]f64\\.3800000000000000\\(SB\\)"
return 0x1p-127
}
+
+func Float64ConstantStore(p *float64) {
+ // amd64: "MOVQ\t[$]4617801906721357038"
+ *p = 5.432
+}
+func Float32ConstantStore(p *float32) {
+ // amd64: "MOVL\t[$]1085133554"
+ *p = 5.432
+}