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

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 <khr@golang.org>
This commit is contained in:
fanzha02 2020-04-22 10:03:00 +08:00 committed by Keith Randall
parent 5c22c01d45
commit ac211c037d
2 changed files with 8 additions and 8 deletions

View File

@ -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))

View File

@ -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