]> Cypherpunks repositories - gostls13.git/commitdiff
test/codegen: codify handling of floating point constants on arm64
authorJoel Sing <joel@sing.id.au>
Mon, 15 Sep 2025 10:10:05 +0000 (20:10 +1000)
committerGopher Robot <gobot@golang.org>
Tue, 30 Sep 2025 21:49:25 +0000 (14:49 -0700)
While here, reorder Float32ConstantStore/Float64ConstantStore for
consistency.

Change-Id: Ic1b3e9f9474965d15bc94518d78d1a4a7bda93f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/703756
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@google.com>
test/codegen/floats.go

index 29969c8dc08eaa5aa21962c0b97aa17e2c9ccd51..666c983b56ac04dd9b9f30d66ba654ded6362e58 100644 (file)
@@ -217,14 +217,36 @@ func Float32Max(a, b float32) float32 {
 //  Constant Optimizations  //
 // ------------------------ //
 
+func Float32ConstantZero() float32 {
+       // arm64:"FMOVS\tZR,"
+       return 0.0
+}
+
+func Float32ConstantChipFloat() float32 {
+       // arm64:"FMOVS\t[$]\\(2\\.25\\),"
+       return 2.25
+}
+
 func Float32Constant() float32 {
+       // arm64:"FMOVS\t[$]f32\\.42440000\\(SB\\)"
        // ppc64x/power8:"FMOVS\t[$]f32\\.42440000\\(SB\\)"
        // ppc64x/power9:"FMOVS\t[$]f32\\.42440000\\(SB\\)"
        // ppc64x/power10:"XXSPLTIDP\t[$]1111752704,"
        return 49.0
 }
 
+func Float64ConstantZero() float64 {
+       // arm64:"FMOVD\tZR,"
+       return 0.0
+}
+
+func Float64ConstantChipFloat() float64 {
+       // arm64:"FMOVD\t[$]\\(2\\.25\\),"
+       return 2.25
+}
+
 func Float64Constant() float64 {
+       // arm64:"FMOVD\t[$]f64\\.4048800000000000\\(SB\\)"
        // ppc64x/power8:"FMOVD\t[$]f64\\.4048800000000000\\(SB\\)"
        // ppc64x/power9:"FMOVD\t[$]f64\\.4048800000000000\\(SB\\)"
        // ppc64x/power10:"XXSPLTIDP\t[$]1111752704,"
@@ -244,11 +266,12 @@ func Float64DenormalFloat32Constant() float64 {
        return 0x1p-127
 }
 
-func Float64ConstantStore(p *float64) {
-       // amd64: "MOVQ\t[$]4617801906721357038"
+func Float32ConstantStore(p *float32) {
+       // amd64:"MOVL\t[$]1085133554"
        *p = 5.432
 }
-func Float32ConstantStore(p *float32) {
-       // amd64: "MOVL\t[$]1085133554"
+
+func Float64ConstantStore(p *float64) {
+       // amd64:"MOVQ\t[$]4617801906721357038"
        *p = 5.432
 }