mirror of https://github.com/golang/go.git
cmd/compile: don't store NaN in ppc64 floating point constant ops
Missed in CL 221790 This is the only remaining use of math.Float64frombits in the .rules file that isn't already guarded. Fixes #38880 Change-Id: I11f71e3a48516748d8d2701c6cf6920a7bc9e216 Reviewed-on: https://go-review.googlesource.com/c/go/+/232859 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
4fda7dc57f
commit
78aa4af239
|
|
@ -785,7 +785,7 @@
|
|||
(FMOVDstore [off] {sym} ptr (MTVSRD x) mem) => (MOVDstore [off] {sym} ptr x mem)
|
||||
(MOVDstore [off] {sym} ptr (MFVSRD x) mem) => (FMOVDstore [off] {sym} ptr x mem)
|
||||
|
||||
(MTVSRD (MOVDconst [c])) => (FMOVDconst [math.Float64frombits(uint64(c))])
|
||||
(MTVSRD (MOVDconst [c])) && !math.IsNaN(math.Float64frombits(uint64(c))) => (FMOVDconst [math.Float64frombits(uint64(c))])
|
||||
(MFVSRD (FMOVDconst [c])) => (MOVDconst [int64(math.Float64bits(c))])
|
||||
|
||||
(MTVSRD x:(MOVDload [off] {sym} ptr mem)) && x.Uses == 1 && clobber(x) => @x.Block (FMOVDload [off] {sym} ptr mem)
|
||||
|
|
|
|||
|
|
@ -10314,12 +10314,16 @@ func rewriteValuePPC64_OpPPC64MTVSRD(v *Value) bool {
|
|||
b := v.Block
|
||||
typ := &b.Func.Config.Types
|
||||
// match: (MTVSRD (MOVDconst [c]))
|
||||
// cond: !math.IsNaN(math.Float64frombits(uint64(c)))
|
||||
// result: (FMOVDconst [math.Float64frombits(uint64(c))])
|
||||
for {
|
||||
if v_0.Op != OpPPC64MOVDconst {
|
||||
break
|
||||
}
|
||||
c := auxIntToInt64(v_0.AuxInt)
|
||||
if !(!math.IsNaN(math.Float64frombits(uint64(c)))) {
|
||||
break
|
||||
}
|
||||
v.reset(OpPPC64FMOVDconst)
|
||||
v.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c)))
|
||||
return true
|
||||
|
|
|
|||
Loading…
Reference in New Issue