Skip to content

Commit 4ff8a45

Browse files
4a6f656cgopherbot
authored andcommitted
test/codegen: codify handling of floating point constants on arm64
While here, reorder Float32ConstantStore/Float64ConstantStore for consistency. Change-Id: Ic1b3e9f9474965d15bc94518d78d1a4a7bda93f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/703756 Reviewed-by: Keith Randall <[email protected]> Auto-Submit: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> Auto-Submit: Joel Sing <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent fcb893f commit 4ff8a45

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

test/codegen/floats.go

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,36 @@ func Float32Max(a, b float32) float32 {
217217
// Constant Optimizations //
218218
// ------------------------ //
219219

220+
func Float32ConstantZero() float32 {
221+
// arm64:"FMOVS\tZR,"
222+
return 0.0
223+
}
224+
225+
func Float32ConstantChipFloat() float32 {
226+
// arm64:"FMOVS\t[$]\\(2\\.25\\),"
227+
return 2.25
228+
}
229+
220230
func Float32Constant() float32 {
231+
// arm64:"FMOVS\t[$]f32\\.42440000\\(SB\\)"
221232
// ppc64x/power8:"FMOVS\t[$]f32\\.42440000\\(SB\\)"
222233
// ppc64x/power9:"FMOVS\t[$]f32\\.42440000\\(SB\\)"
223234
// ppc64x/power10:"XXSPLTIDP\t[$]1111752704,"
224235
return 49.0
225236
}
226237

238+
func Float64ConstantZero() float64 {
239+
// arm64:"FMOVD\tZR,"
240+
return 0.0
241+
}
242+
243+
func Float64ConstantChipFloat() float64 {
244+
// arm64:"FMOVD\t[$]\\(2\\.25\\),"
245+
return 2.25
246+
}
247+
227248
func Float64Constant() float64 {
249+
// arm64:"FMOVD\t[$]f64\\.4048800000000000\\(SB\\)"
228250
// ppc64x/power8:"FMOVD\t[$]f64\\.4048800000000000\\(SB\\)"
229251
// ppc64x/power9:"FMOVD\t[$]f64\\.4048800000000000\\(SB\\)"
230252
// ppc64x/power10:"XXSPLTIDP\t[$]1111752704,"
@@ -244,11 +266,12 @@ func Float64DenormalFloat32Constant() float64 {
244266
return 0x1p-127
245267
}
246268

247-
func Float64ConstantStore(p *float64) {
248-
// amd64: "MOVQ\t[$]4617801906721357038"
269+
func Float32ConstantStore(p *float32) {
270+
// amd64:"MOVL\t[$]1085133554"
249271
*p = 5.432
250272
}
251-
func Float32ConstantStore(p *float32) {
252-
// amd64: "MOVL\t[$]1085133554"
273+
274+
func Float64ConstantStore(p *float64) {
275+
// amd64:"MOVQ\t[$]4617801906721357038"
253276
*p = 5.432
254277
}

0 commit comments

Comments
 (0)