From: fanzha02 Date: Wed, 22 Apr 2020 02:03:00 +0000 (+0800) Subject: cmd/compile: rewrite some arm64 rules to use typed aux fields X-Git-Tag: go1.15beta1~333 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ac211c037d7a39a0723420a4937205008e8ae86e;p=gostls13.git cmd/compile: rewrite some arm64 rules to use typed aux fields Passes toolstash-check -all. Change-Id: Ibf8c2532b0de65901bf0dd9ef0d198dc54d56470 Reviewed-on: https://go-review.googlesource.com/c/go/+/229738 Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/ssa/gen/ARM64.rules b/src/cmd/compile/internal/ssa/gen/ARM64.rules index a51666a6c8..e7e6e75f64 100644 --- a/src/cmd/compile/internal/ssa/gen/ARM64.rules +++ b/src/cmd/compile/internal/ssa/gen/ARM64.rules @@ -1127,8 +1127,8 @@ (CMP x (MOVDconst [c])) -> (CMPconst [c] x) (CMP (MOVDconst [c]) x) -> (InvertFlags (CMPconst [c] x)) -(CMPW x (MOVDconst [c])) -> (CMPWconst [int64(int32(c))] x) -(CMPW (MOVDconst [c]) x) -> (InvertFlags (CMPWconst [int64(int32(c))] x)) +(CMPW x (MOVDconst [c])) => (CMPWconst [int32(c)] x) +(CMPW (MOVDconst [c]) x) => (InvertFlags (CMPWconst [int32(c)] x)) // Canonicalize the order of arguments to comparisons - helps with CSE. ((CMP|CMPW) x y) && x.ID > y.ID -> (InvertFlags ((CMP|CMPW) y x)) diff --git a/src/cmd/compile/internal/ssa/rewriteARM64.go b/src/cmd/compile/internal/ssa/rewriteARM64.go index f0af125e9e..461ae2f577 100644 --- a/src/cmd/compile/internal/ssa/rewriteARM64.go +++ b/src/cmd/compile/internal/ssa/rewriteARM64.go @@ -3011,29 +3011,29 @@ func rewriteValueARM64_OpARM64CMPW(v *Value) bool { v_0 := v.Args[0] b := v.Block // match: (CMPW x (MOVDconst [c])) - // result: (CMPWconst [int64(int32(c))] x) + // result: (CMPWconst [int32(c)] x) for { x := v_0 if v_1.Op != OpARM64MOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpARM64CMPWconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } // match: (CMPW (MOVDconst [c]) x) - // result: (InvertFlags (CMPWconst [int64(int32(c))] x)) + // result: (InvertFlags (CMPWconst [int32(c)] x)) for { if v_0.Op != OpARM64MOVDconst { break } - c := v_0.AuxInt + c := auxIntToInt64(v_0.AuxInt) x := v_1 v.reset(OpARM64InvertFlags) v0 := b.NewValue0(v.Pos, OpARM64CMPWconst, types.TypeFlags) - v0.AuxInt = int64(int32(c)) + v0.AuxInt = int32ToAuxInt(int32(c)) v0.AddArg(x) v.AddArg(v0) return true