mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: use proved bounds to remove signed division fix-ups
prove is able to find 94 occurrences in std cmd where a divisor can't have the value -1. The change removes the extraneous fix-up code for these cases. Fixes #25239 Change-Id: Ic184de971f47cc57c702eb72805b8e291c14035d Reviewed-on: https://go-review.googlesource.com/c/130215 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
47cc59f31f
commit
13d5cd7847
14 changed files with 299 additions and 98 deletions
|
|
@ -451,6 +451,16 @@ func extend32Fto64F(f float32) float64 {
|
|||
return math.Float64frombits(r)
|
||||
}
|
||||
|
||||
// NeedsFixUp reports whether the division needs fix-up code.
|
||||
func NeedsFixUp(v *Value) bool {
|
||||
return v.AuxInt == 0
|
||||
}
|
||||
|
||||
// i2f is used in rules for converting from an AuxInt to a float.
|
||||
func i2f(i int64) float64 {
|
||||
return math.Float64frombits(uint64(i))
|
||||
}
|
||||
|
||||
// auxFrom64F encodes a float64 value so it can be stored in an AuxInt.
|
||||
func auxFrom64F(f float64) int64 {
|
||||
return int64(math.Float64bits(f))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue