]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: preserve shift boundedness information in dec64
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 24 Jan 2020 06:21:39 +0000 (22:21 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 21 Feb 2020 20:59:36 +0000 (20:59 +0000)
For clarity. No differences to generated code.

Change-Id: Ie4360681caac091eb82c59fb06e35b725b1850dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/217003
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/gen/dec64.rules
src/cmd/compile/internal/ssa/rewritedec64.go

index 018bb86602e85080ca4567159fb2bf9204c7bf0d..874ee471549a0ae3be9fc40c02a1519ef6cb298e 100644 (file)
 (Rsh8x64 x (Int64Make (Const32 [c]) _)) && c != 0 -> (Signmask (SignExt8to32 x))
 (Rsh8Ux64 _ (Int64Make (Const32 [c]) _)) && c != 0 -> (Const32 [0])
 
-(Lsh32x64 x (Int64Make (Const32 [0]) lo)) -> (Lsh32x32 x lo)
-(Rsh32x64 x (Int64Make (Const32 [0]) lo)) -> (Rsh32x32 x lo)
-(Rsh32Ux64 x (Int64Make (Const32 [0]) lo)) -> (Rsh32Ux32 x lo)
-(Lsh16x64 x (Int64Make (Const32 [0]) lo)) -> (Lsh16x32 x lo)
-(Rsh16x64 x (Int64Make (Const32 [0]) lo)) -> (Rsh16x32 x lo)
-(Rsh16Ux64 x (Int64Make (Const32 [0]) lo)) -> (Rsh16Ux32 x lo)
-(Lsh8x64 x (Int64Make (Const32 [0]) lo)) -> (Lsh8x32 x lo)
-(Rsh8x64 x (Int64Make (Const32 [0]) lo)) -> (Rsh8x32 x lo)
-(Rsh8Ux64 x (Int64Make (Const32 [0]) lo)) -> (Rsh8Ux32 x lo)
+(Lsh32x64 [c] x (Int64Make (Const32 [0]) lo)) -> (Lsh32x32 [c] x lo)
+(Rsh32x64 [c] x (Int64Make (Const32 [0]) lo)) -> (Rsh32x32 [c] x lo)
+(Rsh32Ux64 [c] x (Int64Make (Const32 [0]) lo)) -> (Rsh32Ux32 [c] x lo)
+(Lsh16x64 [c] x (Int64Make (Const32 [0]) lo)) -> (Lsh16x32 [c] x lo)
+(Rsh16x64 [c] x (Int64Make (Const32 [0]) lo)) -> (Rsh16x32 [c] x lo)
+(Rsh16Ux64 [c] x (Int64Make (Const32 [0]) lo)) -> (Rsh16Ux32 [c] x lo)
+(Lsh8x64 [c] x (Int64Make (Const32 [0]) lo)) -> (Lsh8x32 [c] x lo)
+(Rsh8x64 [c] x (Int64Make (Const32 [0]) lo)) -> (Rsh8x32 [c] x lo)
+(Rsh8Ux64 [c] x (Int64Make (Const32 [0]) lo)) -> (Rsh8Ux32 [c] x lo)
 
 (Lsh64x64 _ (Int64Make (Const32 [c]) _)) && c != 0 -> (Const64 [0])
 (Rsh64x64 x (Int64Make (Const32 [c]) _)) && c != 0 -> (Int64Make (Signmask (Int64Hi x)) (Signmask (Int64Hi x)))
 (Rsh64Ux64 _ (Int64Make (Const32 [c]) _)) && c != 0 -> (Const64 [0])
 
-(Lsh64x64 x (Int64Make (Const32 [0]) lo)) -> (Lsh64x32 x lo)
-(Rsh64x64 x (Int64Make (Const32 [0]) lo)) -> (Rsh64x32 x lo)
-(Rsh64Ux64 x (Int64Make (Const32 [0]) lo)) -> (Rsh64Ux32 x lo)
+(Lsh64x64 [c] x (Int64Make (Const32 [0]) lo)) -> (Lsh64x32 [c] x lo)
+(Rsh64x64 [c] x (Int64Make (Const32 [0]) lo)) -> (Rsh64x32 [c] x lo)
+(Rsh64Ux64 [c] x (Int64Make (Const32 [0]) lo)) -> (Rsh64Ux32 [c] x lo)
 
 // turn x64 non-constant shifts to x32 shifts
 // if high 32-bit of the shift is nonzero, make a huge shift
index f518ffcd3abd5febc24190755b1dbb11b89dbd19..9059904d54465ade58a71ffe70ee4f4c4da0cb8e 100644 (file)
@@ -954,9 +954,10 @@ func rewriteValuedec64_OpLsh16x64(v *Value) bool {
                v.AuxInt = 0
                return true
        }
-       // match: (Lsh16x64 x (Int64Make (Const32 [0]) lo))
-       // result: (Lsh16x32 x lo)
+       // match: (Lsh16x64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Lsh16x32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -967,6 +968,7 @@ func rewriteValuedec64_OpLsh16x64(v *Value) bool {
                        break
                }
                v.reset(OpLsh16x32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -1021,9 +1023,10 @@ func rewriteValuedec64_OpLsh32x64(v *Value) bool {
                v.AuxInt = 0
                return true
        }
-       // match: (Lsh32x64 x (Int64Make (Const32 [0]) lo))
-       // result: (Lsh32x32 x lo)
+       // match: (Lsh32x64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Lsh32x32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -1034,6 +1037,7 @@ func rewriteValuedec64_OpLsh32x64(v *Value) bool {
                        break
                }
                v.reset(OpLsh32x32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -1186,9 +1190,10 @@ func rewriteValuedec64_OpLsh64x64(v *Value) bool {
                v.AuxInt = 0
                return true
        }
-       // match: (Lsh64x64 x (Int64Make (Const32 [0]) lo))
-       // result: (Lsh64x32 x lo)
+       // match: (Lsh64x64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Lsh64x32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -1199,6 +1204,7 @@ func rewriteValuedec64_OpLsh64x64(v *Value) bool {
                        break
                }
                v.reset(OpLsh64x32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -1302,9 +1308,10 @@ func rewriteValuedec64_OpLsh8x64(v *Value) bool {
                v.AuxInt = 0
                return true
        }
-       // match: (Lsh8x64 x (Int64Make (Const32 [0]) lo))
-       // result: (Lsh8x32 x lo)
+       // match: (Lsh8x64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Lsh8x32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -1315,6 +1322,7 @@ func rewriteValuedec64_OpLsh8x64(v *Value) bool {
                        break
                }
                v.reset(OpLsh8x32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -1499,9 +1507,10 @@ func rewriteValuedec64_OpRsh16Ux64(v *Value) bool {
                v.AuxInt = 0
                return true
        }
-       // match: (Rsh16Ux64 x (Int64Make (Const32 [0]) lo))
-       // result: (Rsh16Ux32 x lo)
+       // match: (Rsh16Ux64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Rsh16Ux32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -1512,6 +1521,7 @@ func rewriteValuedec64_OpRsh16Ux64(v *Value) bool {
                        break
                }
                v.reset(OpRsh16Ux32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -1569,9 +1579,10 @@ func rewriteValuedec64_OpRsh16x64(v *Value) bool {
                v.AddArg(v0)
                return true
        }
-       // match: (Rsh16x64 x (Int64Make (Const32 [0]) lo))
-       // result: (Rsh16x32 x lo)
+       // match: (Rsh16x64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Rsh16x32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -1582,6 +1593,7 @@ func rewriteValuedec64_OpRsh16x64(v *Value) bool {
                        break
                }
                v.reset(OpRsh16x32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -1636,9 +1648,10 @@ func rewriteValuedec64_OpRsh32Ux64(v *Value) bool {
                v.AuxInt = 0
                return true
        }
-       // match: (Rsh32Ux64 x (Int64Make (Const32 [0]) lo))
-       // result: (Rsh32Ux32 x lo)
+       // match: (Rsh32Ux64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Rsh32Ux32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -1649,6 +1662,7 @@ func rewriteValuedec64_OpRsh32Ux64(v *Value) bool {
                        break
                }
                v.reset(OpRsh32Ux32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -1704,9 +1718,10 @@ func rewriteValuedec64_OpRsh32x64(v *Value) bool {
                v.AddArg(x)
                return true
        }
-       // match: (Rsh32x64 x (Int64Make (Const32 [0]) lo))
-       // result: (Rsh32x32 x lo)
+       // match: (Rsh32x64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Rsh32x32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -1717,6 +1732,7 @@ func rewriteValuedec64_OpRsh32x64(v *Value) bool {
                        break
                }
                v.reset(OpRsh32x32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -1869,9 +1885,10 @@ func rewriteValuedec64_OpRsh64Ux64(v *Value) bool {
                v.AuxInt = 0
                return true
        }
-       // match: (Rsh64Ux64 x (Int64Make (Const32 [0]) lo))
-       // result: (Rsh64Ux32 x lo)
+       // match: (Rsh64Ux64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Rsh64Ux32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -1882,6 +1899,7 @@ func rewriteValuedec64_OpRsh64Ux64(v *Value) bool {
                        break
                }
                v.reset(OpRsh64Ux32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -2115,9 +2133,10 @@ func rewriteValuedec64_OpRsh64x64(v *Value) bool {
                v.AddArg(v2)
                return true
        }
-       // match: (Rsh64x64 x (Int64Make (Const32 [0]) lo))
-       // result: (Rsh64x32 x lo)
+       // match: (Rsh64x64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Rsh64x32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -2128,6 +2147,7 @@ func rewriteValuedec64_OpRsh64x64(v *Value) bool {
                        break
                }
                v.reset(OpRsh64x32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -2243,9 +2263,10 @@ func rewriteValuedec64_OpRsh8Ux64(v *Value) bool {
                v.AuxInt = 0
                return true
        }
-       // match: (Rsh8Ux64 x (Int64Make (Const32 [0]) lo))
-       // result: (Rsh8Ux32 x lo)
+       // match: (Rsh8Ux64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Rsh8Ux32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -2256,6 +2277,7 @@ func rewriteValuedec64_OpRsh8Ux64(v *Value) bool {
                        break
                }
                v.reset(OpRsh8Ux32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true
@@ -2313,9 +2335,10 @@ func rewriteValuedec64_OpRsh8x64(v *Value) bool {
                v.AddArg(v0)
                return true
        }
-       // match: (Rsh8x64 x (Int64Make (Const32 [0]) lo))
-       // result: (Rsh8x32 x lo)
+       // match: (Rsh8x64 [c] x (Int64Make (Const32 [0]) lo))
+       // result: (Rsh8x32 [c] x lo)
        for {
+               c := v.AuxInt
                x := v_0
                if v_1.Op != OpInt64Make {
                        break
@@ -2326,6 +2349,7 @@ func rewriteValuedec64_OpRsh8x64(v *Value) bool {
                        break
                }
                v.reset(OpRsh8x32)
+               v.AuxInt = c
                v.AddArg(x)
                v.AddArg(lo)
                return true