Shaves off a few instructions here and there.
file before after Δ %
go/types.s 322118 321851 -267 -0.083%
go/internal/gcimporter.s 34937 34909 -28 -0.080%
go/internal/gccgoimporter.s 56493 56474 -19 -0.034%
cmd/compile/internal/ssa.s
3926994 3927177 +183 +0.005%
total
18862670 18862539 -131 -0.001%
Change-Id: I724f32317b946b5138224808f85709d9c097a247
Reviewed-on: https://go-review.googlesource.com/c/go/+/221428
Reviewed-by: Keith Randall <khr@golang.org>
(Cvt64Fto64 (Const64F [c])) -> (Const64 [int64(auxTo64F(c))])
(Round32F x:(Const32F)) -> x
(Round64F x:(Const64F)) -> x
+(CvtBoolToUint8 (ConstBool [c])) -> (Const8 [c])
(Trunc16to8 (ZeroExt8to16 x)) -> x
(Trunc32to8 (ZeroExt8to32 x)) -> x
return rewriteValuegeneric_OpCvt64to32F(v)
case OpCvt64to64F:
return rewriteValuegeneric_OpCvt64to64F(v)
+ case OpCvtBoolToUint8:
+ return rewriteValuegeneric_OpCvtBoolToUint8(v)
case OpDiv16:
return rewriteValuegeneric_OpDiv16(v)
case OpDiv16u:
}
return false
}
+func rewriteValuegeneric_OpCvtBoolToUint8(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (CvtBoolToUint8 (ConstBool [c]))
+ // result: (Const8 [c])
+ for {
+ if v_0.Op != OpConstBool {
+ break
+ }
+ c := v_0.AuxInt
+ v.reset(OpConst8)
+ v.AuxInt = c
+ return true
+ }
+ return false
+}
func rewriteValuegeneric_OpDiv16(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]