]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: rewrite some arm64 rules to use typed aux fields
authorfanzha02 <fannie.zhang@arm.com>
Wed, 22 Apr 2020 02:03:00 +0000 (10:03 +0800)
committerKeith Randall <khr@golang.org>
Tue, 28 Apr 2020 02:36:39 +0000 (02:36 +0000)
Passes toolstash-check -all.

Change-Id: Ibf8c2532b0de65901bf0dd9ef0d198dc54d56470
Reviewed-on: https://go-review.googlesource.com/c/go/+/229738
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/gen/ARM64.rules
src/cmd/compile/internal/ssa/rewriteARM64.go

index a51666a6c8dc5d308bc68a6f1323ed4ba4ace06a..e7e6e75f64fbca81f96d00da69d8bf27837e4e1e 100644 (file)
 
 (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))
index f0af125e9edce7232912c32f94ac9a96ffdd3ace..461ae2f577a984fe78cbfacb151fb31f12b8ad3d 100644 (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