]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: coalesce a few shift rules for wasm
authorAgniva De Sarker <agnivade@yahoo.co.in>
Sun, 16 Jun 2019 06:14:17 +0000 (11:44 +0530)
committerAgniva De Sarker <agniva.quicksilver@gmail.com>
Wed, 28 Aug 2019 04:43:53 +0000 (04:43 +0000)
Change-Id: I1b76daba90afd474390db8d9c238445abaac7ca6
Reviewed-on: https://go-review.googlesource.com/c/go/+/182557
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/gen/Wasm.rules

index 72bf01ba99f17fc8300d5597ee3b66bbc61e247d..a8b7cf48a24e6f519de667f998da6b9ead9c28fb 100644 (file)
 // Unsigned shifts need to return 0 if shift amount is >= width of shifted value.
 
 (Lsh64x64 x y) -> (Select (I64Shl x y) (I64Const [0]) (I64LtU y (I64Const [64])))
-(Lsh64x32 x y) -> (Lsh64x64 x (ZeroExt32to64 y))
-(Lsh64x16 x y) -> (Lsh64x64 x (ZeroExt16to64 y))
-(Lsh64x8  x y) -> (Lsh64x64 x (ZeroExt8to64  y))
+(Lsh64x(32|16|8) x y) -> (Lsh64x64 x (ZeroExt(32|16|8)to64 y))
 
 (Lsh32x64 x y) -> (Lsh64x64 x y)
-(Lsh32x32 x y) -> (Lsh64x64 x (ZeroExt32to64 y))
-(Lsh32x16 x y) -> (Lsh64x64 x (ZeroExt16to64 y))
-(Lsh32x8  x y) -> (Lsh64x64 x (ZeroExt8to64  y))
+(Lsh32x(32|16|8) x y) -> (Lsh64x64 x (ZeroExt(32|16|8)to64 y))
 
 (Lsh16x64 x y) -> (Lsh64x64 x y)
-(Lsh16x32 x y) -> (Lsh64x64 x (ZeroExt32to64 y))
-(Lsh16x16 x y) -> (Lsh64x64 x (ZeroExt16to64 y))
-(Lsh16x8  x y) -> (Lsh64x64 x (ZeroExt8to64  y))
+(Lsh16x(32|16|8) x y) -> (Lsh64x64 x (ZeroExt(32|16|8)to64 y))
 
 (Lsh8x64  x y) -> (Lsh64x64 x y)
-(Lsh8x32  x y) -> (Lsh64x64 x (ZeroExt32to64 y))
-(Lsh8x16  x y) -> (Lsh64x64 x (ZeroExt16to64 y))
-(Lsh8x8   x y) -> (Lsh64x64 x (ZeroExt8to64  y))
+(Lsh8x(32|16|8)  x y) -> (Lsh64x64 x (ZeroExt(32|16|8)to64 y))
 
 (Rsh64Ux64 x y) -> (Select (I64ShrU x y) (I64Const [0]) (I64LtU y (I64Const [64])))
-(Rsh64Ux32 x y) -> (Rsh64Ux64 x (ZeroExt32to64 y))
-(Rsh64Ux16 x y) -> (Rsh64Ux64 x (ZeroExt16to64 y))
-(Rsh64Ux8  x y) -> (Rsh64Ux64 x (ZeroExt8to64  y))
+(Rsh64Ux(32|16|8) x y) -> (Rsh64Ux64 x (ZeroExt(32|16|8)to64 y))
 
 (Rsh32Ux64 x y) -> (Rsh64Ux64 (ZeroExt32to64 x) y)
-(Rsh32Ux32 x y) -> (Rsh64Ux64 (ZeroExt32to64 x) (ZeroExt32to64 y))
-(Rsh32Ux16 x y) -> (Rsh64Ux64 (ZeroExt32to64 x) (ZeroExt16to64 y))
-(Rsh32Ux8  x y) -> (Rsh64Ux64 (ZeroExt32to64 x) (ZeroExt8to64  y))
+(Rsh32Ux(32|16|8) x y) -> (Rsh64Ux64 (ZeroExt32to64 x) (ZeroExt(32|16|8)to64 y))
 
 (Rsh16Ux64 x y) -> (Rsh64Ux64 (ZeroExt16to64 x) y)
-(Rsh16Ux32 x y) -> (Rsh64Ux64 (ZeroExt16to64 x) (ZeroExt32to64 y))
-(Rsh16Ux16 x y) -> (Rsh64Ux64 (ZeroExt16to64 x) (ZeroExt16to64 y))
-(Rsh16Ux8  x y) -> (Rsh64Ux64 (ZeroExt16to64 x) (ZeroExt8to64  y))
+(Rsh16Ux(32|16|8) x y) -> (Rsh64Ux64 (ZeroExt16to64 x) (ZeroExt(32|16|8)to64 y))
 
 (Rsh8Ux64  x y) -> (Rsh64Ux64 (ZeroExt8to64 x) y)
-(Rsh8Ux32  x y) -> (Rsh64Ux64 (ZeroExt8to64 x) (ZeroExt32to64 y))
-(Rsh8Ux16  x y) -> (Rsh64Ux64 (ZeroExt8to64 x) (ZeroExt16to64 y))
-(Rsh8Ux8   x y) -> (Rsh64Ux64 (ZeroExt8to64 x) (ZeroExt8to64  y))
+(Rsh8Ux(32|16|8)  x y) -> (Rsh64Ux64 (ZeroExt8to64 x) (ZeroExt(32|16|8)to64 y))
 
 // Signed right shift needs to return 0/-1 if shift amount is >= width of shifted value.
 // We implement this by setting the shift value to (width - 1) if the shift value is >= width.
 
 (Rsh64x64 x y) -> (I64ShrS x (Select <typ.Int64> y (I64Const [63]) (I64LtU y (I64Const [64]))))
-(Rsh64x32 x y) -> (Rsh64x64 x (ZeroExt32to64 y))
-(Rsh64x16 x y) -> (Rsh64x64 x (ZeroExt16to64 y))
-(Rsh64x8  x y) -> (Rsh64x64 x (ZeroExt8to64  y))
+(Rsh64x(32|16|8) x y) -> (Rsh64x64 x (ZeroExt(32|16|8)to64 y))
 
 (Rsh32x64 x y) -> (Rsh64x64 (SignExt32to64 x) y)
-(Rsh32x32 x y) -> (Rsh64x64 (SignExt32to64 x) (ZeroExt32to64 y))
-(Rsh32x16 x y) -> (Rsh64x64 (SignExt32to64 x) (ZeroExt16to64 y))
-(Rsh32x8  x y) -> (Rsh64x64 (SignExt32to64 x) (ZeroExt8to64  y))
+(Rsh32x(32|16|8) x y) -> (Rsh64x64 (SignExt32to64 x) (ZeroExt(32|16|8)to64 y))
 
 (Rsh16x64 x y) -> (Rsh64x64 (SignExt16to64 x) y)
-(Rsh16x32 x y) -> (Rsh64x64 (SignExt16to64 x) (ZeroExt32to64 y))
-(Rsh16x16 x y) -> (Rsh64x64 (SignExt16to64 x) (ZeroExt16to64 y))
-(Rsh16x8  x y) -> (Rsh64x64 (SignExt16to64 x) (ZeroExt8to64  y))
+(Rsh16x(32|16|8) x y) -> (Rsh64x64 (SignExt16to64 x) (ZeroExt(32|16|8)to64 y))
 
 (Rsh8x64 x y)  -> (Rsh64x64 (SignExt8to64 x) y)
-(Rsh8x32 x y)  -> (Rsh64x64 (SignExt8to64 x) (ZeroExt32to64 y))
-(Rsh8x16 x y)  -> (Rsh64x64 (SignExt8to64 x) (ZeroExt16to64 y))
-(Rsh8x8  x y)  -> (Rsh64x64 (SignExt8to64 x) (ZeroExt8to64  y))
+(Rsh8x(32|16|8) x y)  -> (Rsh64x64 (SignExt8to64 x) (ZeroExt(32|16|8)to64 y))
 
 // Lowering rotates
 (RotateLeft8 <t> x (I64Const [c])) -> (Or8 (Lsh8x64 <t> x (I64Const [c&7])) (Rsh8Ux64 <t> x (I64Const [-c&7])))