// TODO: more of this
(ADD x (NEG y)) => (SUB x y)
(ADDW x (NEGW y)) => (SUBW x y)
+(SUB x (NEG y)) => (ADD x y)
+(SUBW x (NEGW y)) => (ADDW x y)
(SUB x x) => (MOVDconst [0])
(SUBW x x) => (MOVDconst [0])
(AND x x) => x
(ORW x x) => x
(XOR x x) => (MOVDconst [0])
(XORW x x) => (MOVDconst [0])
+(NEG (NEG x)) => x
(NEG (ADDconst [c] (NEG x))) && c != -(1<<31) => (ADDconst [-c] x)
(MOVBZreg (ANDWconst [m] x)) => (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x))
(MOVHZreg (ANDWconst [m] x)) => (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x))
v.AuxInt = int64ToAuxInt(-c)
return true
}
+ // match: (NEG (NEG x))
+ // result: x
+ for {
+ if v_0.Op != OpS390XNEG {
+ break
+ }
+ x := v_0.Args[0]
+ v.copyOf(x)
+ return true
+ }
// match: (NEG (ADDconst [c] (NEG x)))
// cond: c != -(1<<31)
// result: (ADDconst [-c] x)
v.AddArg(v0)
return true
}
+ // match: (SUB x (NEG y))
+ // result: (ADD x y)
+ for {
+ x := v_0
+ if v_1.Op != OpS390XNEG {
+ break
+ }
+ y := v_1.Args[0]
+ v.reset(OpS390XADD)
+ v.AddArg2(x, y)
+ return true
+ }
// match: (SUB x x)
// result: (MOVDconst [0])
for {
v.AddArg(v0)
return true
}
+ // match: (SUBW x (NEGW y))
+ // result: (ADDW x y)
+ for {
+ x := v_0
+ if v_1.Op != OpS390XNEGW {
+ break
+ }
+ y := v_1.Args[0]
+ v.reset(OpS390XADDW)
+ v.AddArg2(x, y)
+ return true
+ }
// match: (SUBW x x)
// result: (MOVDconst [0])
for {