1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:14:39 -07:00

cmd/compile: move last of the generic rules to typed aux

Change-Id: I1193fff570ff2917979e5cb610fb14c3b347aa92
Reviewed-on: https://go-review.googlesource.com/c/go/+/230938
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Keith Randall 2020-04-29 15:15:37 -07:00
parent 9d812cfa5c
commit a7e539619e
2 changed files with 20 additions and 20 deletions

View File

@ -630,10 +630,10 @@
=> x
// Pass constants through math.Float{32,64}bits and math.Float{32,64}frombits
(Load <t1> p1 (Store {t2} p2 (Const64 [x]) _)) && isSamePtr(p1,p2) && sizeof(t2) == 8 && is64BitFloat(t1) && !math.IsNaN(math.Float64frombits(uint64(x))) -> (Const64F [x])
(Load <t1> p1 (Store {t2} p2 (Const32 [x]) _)) && isSamePtr(p1,p2) && sizeof(t2) == 4 && is32BitFloat(t1) && !math.IsNaN(float64(math.Float32frombits(uint32(x)))) -> (Const32F [auxFrom32F(math.Float32frombits(uint32(x)))])
(Load <t1> p1 (Store {t2} p2 (Const64F [x]) _)) && isSamePtr(p1,p2) && sizeof(t2) == 8 && is64BitInt(t1) -> (Const64 [x])
(Load <t1> p1 (Store {t2} p2 (Const32F [x]) _)) && isSamePtr(p1,p2) && sizeof(t2) == 4 && is32BitInt(t1) -> (Const32 [int64(int32(math.Float32bits(auxTo32F(x))))])
(Load <t1> p1 (Store {t2} p2 (Const64 [x]) _)) && isSamePtr(p1,p2) && sizeof(t2) == 8 && is64BitFloat(t1) && !math.IsNaN(math.Float64frombits(uint64(x))) => (Const64F [math.Float64frombits(uint64(x))])
(Load <t1> p1 (Store {t2} p2 (Const32 [x]) _)) && isSamePtr(p1,p2) && sizeof(t2) == 4 && is32BitFloat(t1) && !math.IsNaN(float64(math.Float32frombits(uint32(x)))) => (Const32F [math.Float32frombits(uint32(x))])
(Load <t1> p1 (Store {t2} p2 (Const64F [x]) _)) && isSamePtr(p1,p2) && sizeof(t2) == 8 && is64BitInt(t1) => (Const64 [int64(math.Float64bits(x))])
(Load <t1> p1 (Store {t2} p2 (Const32F [x]) _)) && isSamePtr(p1,p2) && sizeof(t2) == 4 && is32BitInt(t1) => (Const32 [int32(math.Float32bits(x))])
// Float Loads up to Zeros so they can be constant folded.
(Load <t1> op:(OffPtr [o1] p1)

View File

@ -10316,98 +10316,98 @@ func rewriteValuegeneric_OpLoad(v *Value) bool {
}
// match: (Load <t1> p1 (Store {t2} p2 (Const64 [x]) _))
// cond: isSamePtr(p1,p2) && sizeof(t2) == 8 && is64BitFloat(t1) && !math.IsNaN(math.Float64frombits(uint64(x)))
// result: (Const64F [x])
// result: (Const64F [math.Float64frombits(uint64(x))])
for {
t1 := v.Type
p1 := v_0
if v_1.Op != OpStore {
break
}
t2 := v_1.Aux
t2 := auxToType(v_1.Aux)
_ = v_1.Args[1]
p2 := v_1.Args[0]
v_1_1 := v_1.Args[1]
if v_1_1.Op != OpConst64 {
break
}
x := v_1_1.AuxInt
x := auxIntToInt64(v_1_1.AuxInt)
if !(isSamePtr(p1, p2) && sizeof(t2) == 8 && is64BitFloat(t1) && !math.IsNaN(math.Float64frombits(uint64(x)))) {
break
}
v.reset(OpConst64F)
v.AuxInt = x
v.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(x)))
return true
}
// match: (Load <t1> p1 (Store {t2} p2 (Const32 [x]) _))
// cond: isSamePtr(p1,p2) && sizeof(t2) == 4 && is32BitFloat(t1) && !math.IsNaN(float64(math.Float32frombits(uint32(x))))
// result: (Const32F [auxFrom32F(math.Float32frombits(uint32(x)))])
// result: (Const32F [math.Float32frombits(uint32(x))])
for {
t1 := v.Type
p1 := v_0
if v_1.Op != OpStore {
break
}
t2 := v_1.Aux
t2 := auxToType(v_1.Aux)
_ = v_1.Args[1]
p2 := v_1.Args[0]
v_1_1 := v_1.Args[1]
if v_1_1.Op != OpConst32 {
break
}
x := v_1_1.AuxInt
x := auxIntToInt32(v_1_1.AuxInt)
if !(isSamePtr(p1, p2) && sizeof(t2) == 4 && is32BitFloat(t1) && !math.IsNaN(float64(math.Float32frombits(uint32(x))))) {
break
}
v.reset(OpConst32F)
v.AuxInt = auxFrom32F(math.Float32frombits(uint32(x)))
v.AuxInt = float32ToAuxInt(math.Float32frombits(uint32(x)))
return true
}
// match: (Load <t1> p1 (Store {t2} p2 (Const64F [x]) _))
// cond: isSamePtr(p1,p2) && sizeof(t2) == 8 && is64BitInt(t1)
// result: (Const64 [x])
// result: (Const64 [int64(math.Float64bits(x))])
for {
t1 := v.Type
p1 := v_0
if v_1.Op != OpStore {
break
}
t2 := v_1.Aux
t2 := auxToType(v_1.Aux)
_ = v_1.Args[1]
p2 := v_1.Args[0]
v_1_1 := v_1.Args[1]
if v_1_1.Op != OpConst64F {
break
}
x := v_1_1.AuxInt
x := auxIntToFloat64(v_1_1.AuxInt)
if !(isSamePtr(p1, p2) && sizeof(t2) == 8 && is64BitInt(t1)) {
break
}
v.reset(OpConst64)
v.AuxInt = x
v.AuxInt = int64ToAuxInt(int64(math.Float64bits(x)))
return true
}
// match: (Load <t1> p1 (Store {t2} p2 (Const32F [x]) _))
// cond: isSamePtr(p1,p2) && sizeof(t2) == 4 && is32BitInt(t1)
// result: (Const32 [int64(int32(math.Float32bits(auxTo32F(x))))])
// result: (Const32 [int32(math.Float32bits(x))])
for {
t1 := v.Type
p1 := v_0
if v_1.Op != OpStore {
break
}
t2 := v_1.Aux
t2 := auxToType(v_1.Aux)
_ = v_1.Args[1]
p2 := v_1.Args[0]
v_1_1 := v_1.Args[1]
if v_1_1.Op != OpConst32F {
break
}
x := v_1_1.AuxInt
x := auxIntToFloat32(v_1_1.AuxInt)
if !(isSamePtr(p1, p2) && sizeof(t2) == 4 && is32BitInt(t1)) {
break
}
v.reset(OpConst32)
v.AuxInt = int64(int32(math.Float32bits(auxTo32F(x))))
v.AuxInt = int32ToAuxInt(int32(math.Float32bits(x)))
return true
}
// match: (Load <t1> op:(OffPtr [o1] p1) (Store {t2} p2 _ mem:(Zero [n] p3 _)))