(Select1 (CALLudiv x (MOVWconst [c]))) && isPowerOfTwo(c) -> (ANDconst [c-1] x)
// constant comparisons
-(CMPconst (MOVWconst [x]) [y]) && int32(x)==int32(y) -> (FlagEQ)
-(CMPconst (MOVWconst [x]) [y]) && int32(x)<int32(y) && uint32(x)<uint32(y) -> (FlagLT_ULT)
-(CMPconst (MOVWconst [x]) [y]) && int32(x)<int32(y) && uint32(x)>uint32(y) -> (FlagLT_UGT)
-(CMPconst (MOVWconst [x]) [y]) && int32(x)>int32(y) && uint32(x)<uint32(y) -> (FlagGT_ULT)
-(CMPconst (MOVWconst [x]) [y]) && int32(x)>int32(y) && uint32(x)>uint32(y) -> (FlagGT_UGT)
-(CMNconst (MOVWconst [x]) [y]) && int32(x)==int32(-y) -> (FlagEQ)
-(CMNconst (MOVWconst [x]) [y]) && int32(x)<int32(-y) && uint32(x)<uint32(-y) -> (FlagLT_ULT)
-(CMNconst (MOVWconst [x]) [y]) && int32(x)<int32(-y) && uint32(x)>uint32(-y) -> (FlagLT_UGT)
-(CMNconst (MOVWconst [x]) [y]) && int32(x)>int32(-y) && uint32(x)<uint32(-y) -> (FlagGT_ULT)
-(CMNconst (MOVWconst [x]) [y]) && int32(x)>int32(-y) && uint32(x)>uint32(-y) -> (FlagGT_UGT)
-(TSTconst (MOVWconst [x]) [y]) && int32(x&y)==0 -> (FlagEQ)
-(TSTconst (MOVWconst [x]) [y]) && int32(x&y)<0 -> (FlagLT_UGT)
-(TSTconst (MOVWconst [x]) [y]) && int32(x&y)>0 -> (FlagGT_UGT)
-(TEQconst (MOVWconst [x]) [y]) && int32(x^y)==0 -> (FlagEQ)
-(TEQconst (MOVWconst [x]) [y]) && int32(x^y)<0 -> (FlagLT_UGT)
-(TEQconst (MOVWconst [x]) [y]) && int32(x^y)>0 -> (FlagGT_UGT)
+(CMPconst (MOVWconst [x]) [y]) => (FlagConstant [subFlags32(x,y)])
+(CMNconst (MOVWconst [x]) [y]) => (FlagConstant [addFlags32(x,y)])
+(TSTconst (MOVWconst [x]) [y]) => (FlagConstant [logicFlags32(x&y)])
+(TEQconst (MOVWconst [x]) [y]) => (FlagConstant [logicFlags32(x^y)])
// other known comparisons
-(CMPconst (MOVBUreg _) [c]) && 0xff < c -> (FlagLT_ULT)
-(CMPconst (MOVHUreg _) [c]) && 0xffff < c -> (FlagLT_ULT)
-(CMPconst (ANDconst _ [m]) [n]) && 0 <= int32(m) && int32(m) < int32(n) -> (FlagLT_ULT)
-(CMPconst (SRLconst _ [c]) [n]) && 0 <= n && 0 < c && c <= 32 && (1<<uint32(32-c)) <= uint32(n) -> (FlagLT_ULT)
+(CMPconst (MOVBUreg _) [c]) && 0xff < c => (FlagConstant [subFlags32(0,1)])
+(CMPconst (MOVHUreg _) [c]) && 0xffff < c => (FlagConstant [subFlags32(0,1)])
+(CMPconst (ANDconst _ [m]) [n]) && 0 <= m && m < n => (FlagConstant [subFlags32(0,1)])
+(CMPconst (SRLconst _ [c]) [n]) && 0 <= n && 0 < c && c <= 32 && (1<<uint32(32-c)) <= uint32(n) => (FlagConstant [subFlags32(0,1)])
// absorb flag constants into branches
-(EQ (FlagEQ) yes no) -> (First yes no)
-(EQ (FlagLT_ULT) yes no) -> (First no yes)
-(EQ (FlagLT_UGT) yes no) -> (First no yes)
-(EQ (FlagGT_ULT) yes no) -> (First no yes)
-(EQ (FlagGT_UGT) yes no) -> (First no yes)
-
-(NE (FlagEQ) yes no) -> (First no yes)
-(NE (FlagLT_ULT) yes no) -> (First yes no)
-(NE (FlagLT_UGT) yes no) -> (First yes no)
-(NE (FlagGT_ULT) yes no) -> (First yes no)
-(NE (FlagGT_UGT) yes no) -> (First yes no)
-
-(LT (FlagEQ) yes no) -> (First no yes)
-(LT (FlagLT_ULT) yes no) -> (First yes no)
-(LT (FlagLT_UGT) yes no) -> (First yes no)
-(LT (FlagGT_ULT) yes no) -> (First no yes)
-(LT (FlagGT_UGT) yes no) -> (First no yes)
-
-(LE (FlagEQ) yes no) -> (First yes no)
-(LE (FlagLT_ULT) yes no) -> (First yes no)
-(LE (FlagLT_UGT) yes no) -> (First yes no)
-(LE (FlagGT_ULT) yes no) -> (First no yes)
-(LE (FlagGT_UGT) yes no) -> (First no yes)
-
-(GT (FlagEQ) yes no) -> (First no yes)
-(GT (FlagLT_ULT) yes no) -> (First no yes)
-(GT (FlagLT_UGT) yes no) -> (First no yes)
-(GT (FlagGT_ULT) yes no) -> (First yes no)
-(GT (FlagGT_UGT) yes no) -> (First yes no)
-
-(GE (FlagEQ) yes no) -> (First yes no)
-(GE (FlagLT_ULT) yes no) -> (First no yes)
-(GE (FlagLT_UGT) yes no) -> (First no yes)
-(GE (FlagGT_ULT) yes no) -> (First yes no)
-(GE (FlagGT_UGT) yes no) -> (First yes no)
-
-(ULT (FlagEQ) yes no) -> (First no yes)
-(ULT (FlagLT_ULT) yes no) -> (First yes no)
-(ULT (FlagLT_UGT) yes no) -> (First no yes)
-(ULT (FlagGT_ULT) yes no) -> (First yes no)
-(ULT (FlagGT_UGT) yes no) -> (First no yes)
-
-(ULE (FlagEQ) yes no) -> (First yes no)
-(ULE (FlagLT_ULT) yes no) -> (First yes no)
-(ULE (FlagLT_UGT) yes no) -> (First no yes)
-(ULE (FlagGT_ULT) yes no) -> (First yes no)
-(ULE (FlagGT_UGT) yes no) -> (First no yes)
-
-(UGT (FlagEQ) yes no) -> (First no yes)
-(UGT (FlagLT_ULT) yes no) -> (First no yes)
-(UGT (FlagLT_UGT) yes no) -> (First yes no)
-(UGT (FlagGT_ULT) yes no) -> (First no yes)
-(UGT (FlagGT_UGT) yes no) -> (First yes no)
-
-(UGE (FlagEQ) yes no) -> (First yes no)
-(UGE (FlagLT_ULT) yes no) -> (First no yes)
-(UGE (FlagLT_UGT) yes no) -> (First yes no)
-(UGE (FlagGT_ULT) yes no) -> (First no yes)
-(UGE (FlagGT_UGT) yes no) -> (First yes no)
+(EQ (FlagConstant [fc]) yes no) && fc.eq() => (First yes no)
+(EQ (FlagConstant [fc]) yes no) && !fc.eq() => (First no yes)
+
+(NE (FlagConstant [fc]) yes no) && fc.ne() => (First yes no)
+(NE (FlagConstant [fc]) yes no) && !fc.ne() => (First no yes)
+
+(LT (FlagConstant [fc]) yes no) && fc.lt() => (First yes no)
+(LT (FlagConstant [fc]) yes no) && !fc.lt() => (First no yes)
+
+(LE (FlagConstant [fc]) yes no) && fc.le() => (First yes no)
+(LE (FlagConstant [fc]) yes no) && !fc.le() => (First no yes)
+
+(GT (FlagConstant [fc]) yes no) && fc.gt() => (First yes no)
+(GT (FlagConstant [fc]) yes no) && !fc.gt() => (First no yes)
+
+(GE (FlagConstant [fc]) yes no) && fc.ge() => (First yes no)
+(GE (FlagConstant [fc]) yes no) && !fc.ge() => (First no yes)
+
+(ULT (FlagConstant [fc]) yes no) && fc.ult() => (First yes no)
+(ULT (FlagConstant [fc]) yes no) && !fc.ult() => (First no yes)
+
+(ULE (FlagConstant [fc]) yes no) && fc.ule() => (First yes no)
+(ULE (FlagConstant [fc]) yes no) && !fc.ule() => (First no yes)
+
+(UGT (FlagConstant [fc]) yes no) && fc.ugt() => (First yes no)
+(UGT (FlagConstant [fc]) yes no) && !fc.ugt() => (First no yes)
+
+(UGE (FlagConstant [fc]) yes no) && fc.uge() => (First yes no)
+(UGE (FlagConstant [fc]) yes no) && !fc.uge() => (First no yes)
+
+(LTnoov (FlagConstant [fc]) yes no) && fc.ltNoov() => (First yes no)
+(LTnoov (FlagConstant [fc]) yes no) && !fc.ltNoov() => (First no yes)
+
+(LEnoov (FlagConstant [fc]) yes no) && fc.leNoov() => (First yes no)
+(LEnoov (FlagConstant [fc]) yes no) && !fc.leNoov() => (First no yes)
+
+(GTnoov (FlagConstant [fc]) yes no) && fc.gtNoov() => (First yes no)
+(GTnoov (FlagConstant [fc]) yes no) && !fc.gtNoov() => (First no yes)
+
+(GEnoov (FlagConstant [fc]) yes no) && fc.geNoov() => (First yes no)
+(GEnoov (FlagConstant [fc]) yes no) && !fc.geNoov() => (First no yes)
// absorb InvertFlags into branches
(LT (InvertFlags cmp) yes no) -> (GT cmp yes no)
(GTnoov (InvertFlags cmp) yes no) => (LTnoov cmp yes no)
// absorb flag constants into boolean values
-(Equal (FlagEQ)) -> (MOVWconst [1])
-(Equal (FlagLT_ULT)) -> (MOVWconst [0])
-(Equal (FlagLT_UGT)) -> (MOVWconst [0])
-(Equal (FlagGT_ULT)) -> (MOVWconst [0])
-(Equal (FlagGT_UGT)) -> (MOVWconst [0])
-
-(NotEqual (FlagEQ)) -> (MOVWconst [0])
-(NotEqual (FlagLT_ULT)) -> (MOVWconst [1])
-(NotEqual (FlagLT_UGT)) -> (MOVWconst [1])
-(NotEqual (FlagGT_ULT)) -> (MOVWconst [1])
-(NotEqual (FlagGT_UGT)) -> (MOVWconst [1])
-
-(LessThan (FlagEQ)) -> (MOVWconst [0])
-(LessThan (FlagLT_ULT)) -> (MOVWconst [1])
-(LessThan (FlagLT_UGT)) -> (MOVWconst [1])
-(LessThan (FlagGT_ULT)) -> (MOVWconst [0])
-(LessThan (FlagGT_UGT)) -> (MOVWconst [0])
-
-(LessThanU (FlagEQ)) -> (MOVWconst [0])
-(LessThanU (FlagLT_ULT)) -> (MOVWconst [1])
-(LessThanU (FlagLT_UGT)) -> (MOVWconst [0])
-(LessThanU (FlagGT_ULT)) -> (MOVWconst [1])
-(LessThanU (FlagGT_UGT)) -> (MOVWconst [0])
-
-(LessEqual (FlagEQ)) -> (MOVWconst [1])
-(LessEqual (FlagLT_ULT)) -> (MOVWconst [1])
-(LessEqual (FlagLT_UGT)) -> (MOVWconst [1])
-(LessEqual (FlagGT_ULT)) -> (MOVWconst [0])
-(LessEqual (FlagGT_UGT)) -> (MOVWconst [0])
-
-(LessEqualU (FlagEQ)) -> (MOVWconst [1])
-(LessEqualU (FlagLT_ULT)) -> (MOVWconst [1])
-(LessEqualU (FlagLT_UGT)) -> (MOVWconst [0])
-(LessEqualU (FlagGT_ULT)) -> (MOVWconst [1])
-(LessEqualU (FlagGT_UGT)) -> (MOVWconst [0])
-
-(GreaterThan (FlagEQ)) -> (MOVWconst [0])
-(GreaterThan (FlagLT_ULT)) -> (MOVWconst [0])
-(GreaterThan (FlagLT_UGT)) -> (MOVWconst [0])
-(GreaterThan (FlagGT_ULT)) -> (MOVWconst [1])
-(GreaterThan (FlagGT_UGT)) -> (MOVWconst [1])
-
-(GreaterThanU (FlagEQ)) -> (MOVWconst [0])
-(GreaterThanU (FlagLT_ULT)) -> (MOVWconst [0])
-(GreaterThanU (FlagLT_UGT)) -> (MOVWconst [1])
-(GreaterThanU (FlagGT_ULT)) -> (MOVWconst [0])
-(GreaterThanU (FlagGT_UGT)) -> (MOVWconst [1])
-
-(GreaterEqual (FlagEQ)) -> (MOVWconst [1])
-(GreaterEqual (FlagLT_ULT)) -> (MOVWconst [0])
-(GreaterEqual (FlagLT_UGT)) -> (MOVWconst [0])
-(GreaterEqual (FlagGT_ULT)) -> (MOVWconst [1])
-(GreaterEqual (FlagGT_UGT)) -> (MOVWconst [1])
-
-(GreaterEqualU (FlagEQ)) -> (MOVWconst [1])
-(GreaterEqualU (FlagLT_ULT)) -> (MOVWconst [0])
-(GreaterEqualU (FlagLT_UGT)) -> (MOVWconst [1])
-(GreaterEqualU (FlagGT_ULT)) -> (MOVWconst [0])
-(GreaterEqualU (FlagGT_UGT)) -> (MOVWconst [1])
+(Equal (FlagConstant [fc])) => (MOVWconst [b2i32(fc.eq())])
+(NotEqual (FlagConstant [fc])) => (MOVWconst [b2i32(fc.ne())])
+(LessThan (FlagConstant [fc])) => (MOVWconst [b2i32(fc.lt())])
+(LessThanU (FlagConstant [fc])) => (MOVWconst [b2i32(fc.ult())])
+(LessEqual (FlagConstant [fc])) => (MOVWconst [b2i32(fc.le())])
+(LessEqualU (FlagConstant [fc])) => (MOVWconst [b2i32(fc.ule())])
+(GreaterThan (FlagConstant [fc])) => (MOVWconst [b2i32(fc.gt())])
+(GreaterThanU (FlagConstant [fc])) => (MOVWconst [b2i32(fc.ugt())])
+(GreaterEqual (FlagConstant [fc])) => (MOVWconst [b2i32(fc.ge())])
+(GreaterEqualU (FlagConstant [fc])) => (MOVWconst [b2i32(fc.uge())])
// absorb InvertFlags into boolean values
(Equal (InvertFlags x)) -> (Equal x)
(GreaterEqualU (InvertFlags x)) -> (LessEqualU x)
// absorb flag constants into conditional instructions
-(CMOVWLSconst _ (FlagEQ) [c]) -> (MOVWconst [c])
-(CMOVWLSconst _ (FlagLT_ULT) [c]) -> (MOVWconst [c])
-(CMOVWLSconst x (FlagLT_UGT)) -> x
-(CMOVWLSconst _ (FlagGT_ULT) [c]) -> (MOVWconst [c])
-(CMOVWLSconst x (FlagGT_UGT)) -> x
-
-(CMOVWHSconst _ (FlagEQ) [c]) -> (MOVWconst [c])
-(CMOVWHSconst x (FlagLT_ULT)) -> x
-(CMOVWHSconst _ (FlagLT_UGT) [c]) -> (MOVWconst [c])
-(CMOVWHSconst x (FlagGT_ULT)) -> x
-(CMOVWHSconst _ (FlagGT_UGT) [c]) -> (MOVWconst [c])
+(CMOVWLSconst _ (FlagConstant [fc]) [c]) && fc.ule() => (MOVWconst [c])
+(CMOVWLSconst x (FlagConstant [fc]) [c]) && fc.ugt() => x
+
+(CMOVWHSconst _ (FlagConstant [fc]) [c]) && fc.uge() => (MOVWconst [c])
+(CMOVWHSconst x (FlagConstant [fc]) [c]) && fc.ult() => x
(CMOVWLSconst x (InvertFlags flags) [c]) -> (CMOVWHSconst x flags [c])
(CMOVWHSconst x (InvertFlags flags) [c]) -> (CMOVWLSconst x flags [c])
-(SRAcond x _ (FlagEQ)) -> (SRAconst x [31])
-(SRAcond x y (FlagLT_ULT)) -> (SRA x y)
-(SRAcond x _ (FlagLT_UGT)) -> (SRAconst x [31])
-(SRAcond x y (FlagGT_ULT)) -> (SRA x y)
-(SRAcond x _ (FlagGT_UGT)) -> (SRAconst x [31])
+(SRAcond x _ (FlagConstant [fc])) && fc.uge() => (SRAconst x [31])
+(SRAcond x y (FlagConstant [fc])) && fc.ult() => (SRA x y)
// remove redundant *const ops
(ADDconst [0] x) -> x
func rewriteValueARM_OpARMCMNconst(v *Value) bool {
v_0 := v.Args[0]
// match: (CMNconst (MOVWconst [x]) [y])
- // cond: int32(x)==int32(-y)
- // result: (FlagEQ)
+ // result: (FlagConstant [addFlags32(x,y)])
for {
- y := v.AuxInt
+ y := auxIntToInt32(v.AuxInt)
if v_0.Op != OpARMMOVWconst {
break
}
- x := v_0.AuxInt
- if !(int32(x) == int32(-y)) {
- break
- }
- v.reset(OpARMFlagEQ)
- return true
- }
- // match: (CMNconst (MOVWconst [x]) [y])
- // cond: int32(x)<int32(-y) && uint32(x)<uint32(-y)
- // result: (FlagLT_ULT)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x) < int32(-y) && uint32(x) < uint32(-y)) {
- break
- }
- v.reset(OpARMFlagLT_ULT)
- return true
- }
- // match: (CMNconst (MOVWconst [x]) [y])
- // cond: int32(x)<int32(-y) && uint32(x)>uint32(-y)
- // result: (FlagLT_UGT)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x) < int32(-y) && uint32(x) > uint32(-y)) {
- break
- }
- v.reset(OpARMFlagLT_UGT)
- return true
- }
- // match: (CMNconst (MOVWconst [x]) [y])
- // cond: int32(x)>int32(-y) && uint32(x)<uint32(-y)
- // result: (FlagGT_ULT)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x) > int32(-y) && uint32(x) < uint32(-y)) {
- break
- }
- v.reset(OpARMFlagGT_ULT)
- return true
- }
- // match: (CMNconst (MOVWconst [x]) [y])
- // cond: int32(x)>int32(-y) && uint32(x)>uint32(-y)
- // result: (FlagGT_UGT)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x) > int32(-y) && uint32(x) > uint32(-y)) {
- break
- }
- v.reset(OpARMFlagGT_UGT)
+ x := auxIntToInt32(v_0.AuxInt)
+ v.reset(OpARMFlagConstant)
+ v.AuxInt = flagConstantToAuxInt(addFlags32(x, y))
return true
}
return false
func rewriteValueARM_OpARMCMOVWHSconst(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
- // match: (CMOVWHSconst _ (FlagEQ) [c])
+ // match: (CMOVWHSconst _ (FlagConstant [fc]) [c])
+ // cond: fc.uge()
// result: (MOVWconst [c])
for {
- c := v.AuxInt
- if v_1.Op != OpARMFlagEQ {
+ c := auxIntToInt32(v.AuxInt)
+ if v_1.Op != OpARMFlagConstant {
break
}
- v.reset(OpARMMOVWconst)
- v.AuxInt = c
- return true
- }
- // match: (CMOVWHSconst x (FlagLT_ULT))
- // result: x
- for {
- x := v_0
- if v_1.Op != OpARMFlagLT_ULT {
- break
- }
- v.copyOf(x)
- return true
- }
- // match: (CMOVWHSconst _ (FlagLT_UGT) [c])
- // result: (MOVWconst [c])
- for {
- c := v.AuxInt
- if v_1.Op != OpARMFlagLT_UGT {
+ fc := auxIntToFlagConstant(v_1.AuxInt)
+ if !(fc.uge()) {
break
}
v.reset(OpARMMOVWconst)
- v.AuxInt = c
+ v.AuxInt = int32ToAuxInt(c)
return true
}
- // match: (CMOVWHSconst x (FlagGT_ULT))
+ // match: (CMOVWHSconst x (FlagConstant [fc]) [c])
+ // cond: fc.ult()
// result: x
for {
x := v_0
- if v_1.Op != OpARMFlagGT_ULT {
+ if v_1.Op != OpARMFlagConstant {
break
}
- v.copyOf(x)
- return true
- }
- // match: (CMOVWHSconst _ (FlagGT_UGT) [c])
- // result: (MOVWconst [c])
- for {
- c := v.AuxInt
- if v_1.Op != OpARMFlagGT_UGT {
+ fc := auxIntToFlagConstant(v_1.AuxInt)
+ if !(fc.ult()) {
break
}
- v.reset(OpARMMOVWconst)
- v.AuxInt = c
+ v.copyOf(x)
return true
}
// match: (CMOVWHSconst x (InvertFlags flags) [c])
func rewriteValueARM_OpARMCMOVWLSconst(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
- // match: (CMOVWLSconst _ (FlagEQ) [c])
+ // match: (CMOVWLSconst _ (FlagConstant [fc]) [c])
+ // cond: fc.ule()
// result: (MOVWconst [c])
for {
- c := v.AuxInt
- if v_1.Op != OpARMFlagEQ {
+ c := auxIntToInt32(v.AuxInt)
+ if v_1.Op != OpARMFlagConstant {
break
}
- v.reset(OpARMMOVWconst)
- v.AuxInt = c
- return true
- }
- // match: (CMOVWLSconst _ (FlagLT_ULT) [c])
- // result: (MOVWconst [c])
- for {
- c := v.AuxInt
- if v_1.Op != OpARMFlagLT_ULT {
+ fc := auxIntToFlagConstant(v_1.AuxInt)
+ if !(fc.ule()) {
break
}
v.reset(OpARMMOVWconst)
- v.AuxInt = c
+ v.AuxInt = int32ToAuxInt(c)
return true
}
- // match: (CMOVWLSconst x (FlagLT_UGT))
+ // match: (CMOVWLSconst x (FlagConstant [fc]) [c])
+ // cond: fc.ugt()
// result: x
for {
x := v_0
- if v_1.Op != OpARMFlagLT_UGT {
+ if v_1.Op != OpARMFlagConstant {
break
}
- v.copyOf(x)
- return true
- }
- // match: (CMOVWLSconst _ (FlagGT_ULT) [c])
- // result: (MOVWconst [c])
- for {
- c := v.AuxInt
- if v_1.Op != OpARMFlagGT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = c
- return true
- }
- // match: (CMOVWLSconst x (FlagGT_UGT))
- // result: x
- for {
- x := v_0
- if v_1.Op != OpARMFlagGT_UGT {
+ fc := auxIntToFlagConstant(v_1.AuxInt)
+ if !(fc.ugt()) {
break
}
v.copyOf(x)
func rewriteValueARM_OpARMCMPconst(v *Value) bool {
v_0 := v.Args[0]
// match: (CMPconst (MOVWconst [x]) [y])
- // cond: int32(x)==int32(y)
- // result: (FlagEQ)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x) == int32(y)) {
- break
- }
- v.reset(OpARMFlagEQ)
- return true
- }
- // match: (CMPconst (MOVWconst [x]) [y])
- // cond: int32(x)<int32(y) && uint32(x)<uint32(y)
- // result: (FlagLT_ULT)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x) < int32(y) && uint32(x) < uint32(y)) {
- break
- }
- v.reset(OpARMFlagLT_ULT)
- return true
- }
- // match: (CMPconst (MOVWconst [x]) [y])
- // cond: int32(x)<int32(y) && uint32(x)>uint32(y)
- // result: (FlagLT_UGT)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x) < int32(y) && uint32(x) > uint32(y)) {
- break
- }
- v.reset(OpARMFlagLT_UGT)
- return true
- }
- // match: (CMPconst (MOVWconst [x]) [y])
- // cond: int32(x)>int32(y) && uint32(x)<uint32(y)
- // result: (FlagGT_ULT)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x) > int32(y) && uint32(x) < uint32(y)) {
- break
- }
- v.reset(OpARMFlagGT_ULT)
- return true
- }
- // match: (CMPconst (MOVWconst [x]) [y])
- // cond: int32(x)>int32(y) && uint32(x)>uint32(y)
- // result: (FlagGT_UGT)
+ // result: (FlagConstant [subFlags32(x,y)])
for {
- y := v.AuxInt
+ y := auxIntToInt32(v.AuxInt)
if v_0.Op != OpARMMOVWconst {
break
}
- x := v_0.AuxInt
- if !(int32(x) > int32(y) && uint32(x) > uint32(y)) {
- break
- }
- v.reset(OpARMFlagGT_UGT)
+ x := auxIntToInt32(v_0.AuxInt)
+ v.reset(OpARMFlagConstant)
+ v.AuxInt = flagConstantToAuxInt(subFlags32(x, y))
return true
}
// match: (CMPconst (MOVBUreg _) [c])
// cond: 0xff < c
- // result: (FlagLT_ULT)
+ // result: (FlagConstant [subFlags32(0, 1)])
for {
- c := v.AuxInt
+ c := auxIntToInt32(v.AuxInt)
if v_0.Op != OpARMMOVBUreg || !(0xff < c) {
break
}
- v.reset(OpARMFlagLT_ULT)
+ v.reset(OpARMFlagConstant)
+ v.AuxInt = flagConstantToAuxInt(subFlags32(0, 1))
return true
}
// match: (CMPconst (MOVHUreg _) [c])
// cond: 0xffff < c
- // result: (FlagLT_ULT)
+ // result: (FlagConstant [subFlags32(0, 1)])
for {
- c := v.AuxInt
+ c := auxIntToInt32(v.AuxInt)
if v_0.Op != OpARMMOVHUreg || !(0xffff < c) {
break
}
- v.reset(OpARMFlagLT_ULT)
+ v.reset(OpARMFlagConstant)
+ v.AuxInt = flagConstantToAuxInt(subFlags32(0, 1))
return true
}
// match: (CMPconst (ANDconst _ [m]) [n])
- // cond: 0 <= int32(m) && int32(m) < int32(n)
- // result: (FlagLT_ULT)
+ // cond: 0 <= m && m < n
+ // result: (FlagConstant [subFlags32(0, 1)])
for {
- n := v.AuxInt
+ n := auxIntToInt32(v.AuxInt)
if v_0.Op != OpARMANDconst {
break
}
- m := v_0.AuxInt
- if !(0 <= int32(m) && int32(m) < int32(n)) {
+ m := auxIntToInt32(v_0.AuxInt)
+ if !(0 <= m && m < n) {
break
}
- v.reset(OpARMFlagLT_ULT)
+ v.reset(OpARMFlagConstant)
+ v.AuxInt = flagConstantToAuxInt(subFlags32(0, 1))
return true
}
// match: (CMPconst (SRLconst _ [c]) [n])
// cond: 0 <= n && 0 < c && c <= 32 && (1<<uint32(32-c)) <= uint32(n)
- // result: (FlagLT_ULT)
+ // result: (FlagConstant [subFlags32(0, 1)])
for {
- n := v.AuxInt
+ n := auxIntToInt32(v.AuxInt)
if v_0.Op != OpARMSRLconst {
break
}
- c := v_0.AuxInt
+ c := auxIntToInt32(v_0.AuxInt)
if !(0 <= n && 0 < c && c <= 32 && (1<<uint32(32-c)) <= uint32(n)) {
break
}
- v.reset(OpARMFlagLT_ULT)
+ v.reset(OpARMFlagConstant)
+ v.AuxInt = flagConstantToAuxInt(subFlags32(0, 1))
return true
}
return false
c := v_2.AuxInt
v.reset(OpARMCMPshiftRL)
v.AuxInt = c
- v.AddArg2(x, y)
- return true
- }
- return false
-}
-func rewriteValueARM_OpARMEqual(v *Value) bool {
- v_0 := v.Args[0]
- // match: (Equal (FlagEQ))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagEQ {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (Equal (FlagLT_ULT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagLT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (Equal (FlagLT_UGT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagLT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (Equal (FlagGT_ULT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagGT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (Equal (FlagGT_UGT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagGT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (Equal (InvertFlags x))
- // result: (Equal x)
- for {
- if v_0.Op != OpARMInvertFlags {
- break
- }
- x := v_0.Args[0]
- v.reset(OpARMEqual)
- v.AddArg(x)
- return true
- }
- return false
-}
-func rewriteValueARM_OpARMGreaterEqual(v *Value) bool {
- v_0 := v.Args[0]
- // match: (GreaterEqual (FlagEQ))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagEQ {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterEqual (FlagLT_ULT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagLT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterEqual (FlagLT_UGT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagLT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterEqual (FlagGT_ULT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagGT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterEqual (FlagGT_UGT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagGT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterEqual (InvertFlags x))
- // result: (LessEqual x)
- for {
- if v_0.Op != OpARMInvertFlags {
- break
- }
- x := v_0.Args[0]
- v.reset(OpARMLessEqual)
- v.AddArg(x)
- return true
- }
- return false
-}
-func rewriteValueARM_OpARMGreaterEqualU(v *Value) bool {
- v_0 := v.Args[0]
- // match: (GreaterEqualU (FlagEQ))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagEQ {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterEqualU (FlagLT_ULT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagLT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterEqualU (FlagLT_UGT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagLT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterEqualU (FlagGT_ULT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagGT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterEqualU (FlagGT_UGT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagGT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterEqualU (InvertFlags x))
- // result: (LessEqualU x)
- for {
- if v_0.Op != OpARMInvertFlags {
- break
- }
- x := v_0.Args[0]
- v.reset(OpARMLessEqualU)
- v.AddArg(x)
- return true
- }
- return false
-}
-func rewriteValueARM_OpARMGreaterThan(v *Value) bool {
- v_0 := v.Args[0]
- // match: (GreaterThan (FlagEQ))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagEQ {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterThan (FlagLT_ULT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagLT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterThan (FlagLT_UGT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagLT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterThan (FlagGT_ULT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagGT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterThan (FlagGT_UGT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagGT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterThan (InvertFlags x))
- // result: (LessThan x)
- for {
- if v_0.Op != OpARMInvertFlags {
- break
- }
- x := v_0.Args[0]
- v.reset(OpARMLessThan)
- v.AddArg(x)
- return true
- }
- return false
-}
-func rewriteValueARM_OpARMGreaterThanU(v *Value) bool {
- v_0 := v.Args[0]
- // match: (GreaterThanU (FlagEQ))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagEQ {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterThanU (FlagLT_ULT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagLT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterThanU (FlagLT_UGT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagLT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterThanU (FlagGT_ULT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagGT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (GreaterThanU (FlagGT_UGT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagGT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (GreaterThanU (InvertFlags x))
- // result: (LessThanU x)
- for {
- if v_0.Op != OpARMInvertFlags {
- break
- }
- x := v_0.Args[0]
- v.reset(OpARMLessThanU)
- v.AddArg(x)
- return true
- }
- return false
-}
-func rewriteValueARM_OpARMLessEqual(v *Value) bool {
- v_0 := v.Args[0]
- // match: (LessEqual (FlagEQ))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagEQ {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (LessEqual (FlagLT_ULT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagLT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
+ v.AddArg2(x, y)
return true
}
- // match: (LessEqual (FlagLT_UGT))
- // result: (MOVWconst [1])
+ return false
+}
+func rewriteValueARM_OpARMEqual(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (Equal (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.eq())])
for {
- if v_0.Op != OpARMFlagLT_UGT {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 1
+ v.AuxInt = int32ToAuxInt(b2i32(fc.eq()))
return true
}
- // match: (LessEqual (FlagGT_ULT))
- // result: (MOVWconst [0])
+ // match: (Equal (InvertFlags x))
+ // result: (Equal x)
for {
- if v_0.Op != OpARMFlagGT_ULT {
+ if v_0.Op != OpARMInvertFlags {
break
}
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
+ x := v_0.Args[0]
+ v.reset(OpARMEqual)
+ v.AddArg(x)
return true
}
- // match: (LessEqual (FlagGT_UGT))
- // result: (MOVWconst [0])
+ return false
+}
+func rewriteValueARM_OpARMGreaterEqual(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (GreaterEqual (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.ge())])
for {
- if v_0.Op != OpARMFlagGT_UGT {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 0
+ v.AuxInt = int32ToAuxInt(b2i32(fc.ge()))
return true
}
- // match: (LessEqual (InvertFlags x))
- // result: (GreaterEqual x)
+ // match: (GreaterEqual (InvertFlags x))
+ // result: (LessEqual x)
for {
if v_0.Op != OpARMInvertFlags {
break
}
x := v_0.Args[0]
- v.reset(OpARMGreaterEqual)
+ v.reset(OpARMLessEqual)
v.AddArg(x)
return true
}
return false
}
-func rewriteValueARM_OpARMLessEqualU(v *Value) bool {
+func rewriteValueARM_OpARMGreaterEqualU(v *Value) bool {
v_0 := v.Args[0]
- // match: (LessEqualU (FlagEQ))
- // result: (MOVWconst [1])
+ // match: (GreaterEqualU (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.uge())])
for {
- if v_0.Op != OpARMFlagEQ {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 1
+ v.AuxInt = int32ToAuxInt(b2i32(fc.uge()))
return true
}
- // match: (LessEqualU (FlagLT_ULT))
- // result: (MOVWconst [1])
+ // match: (GreaterEqualU (InvertFlags x))
+ // result: (LessEqualU x)
for {
- if v_0.Op != OpARMFlagLT_ULT {
+ if v_0.Op != OpARMInvertFlags {
break
}
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
+ x := v_0.Args[0]
+ v.reset(OpARMLessEqualU)
+ v.AddArg(x)
return true
}
- // match: (LessEqualU (FlagLT_UGT))
- // result: (MOVWconst [0])
+ return false
+}
+func rewriteValueARM_OpARMGreaterThan(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (GreaterThan (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.gt())])
for {
- if v_0.Op != OpARMFlagLT_UGT {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 0
+ v.AuxInt = int32ToAuxInt(b2i32(fc.gt()))
return true
}
- // match: (LessEqualU (FlagGT_ULT))
- // result: (MOVWconst [1])
+ // match: (GreaterThan (InvertFlags x))
+ // result: (LessThan x)
for {
- if v_0.Op != OpARMFlagGT_ULT {
+ if v_0.Op != OpARMInvertFlags {
break
}
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
+ x := v_0.Args[0]
+ v.reset(OpARMLessThan)
+ v.AddArg(x)
return true
}
- // match: (LessEqualU (FlagGT_UGT))
- // result: (MOVWconst [0])
+ return false
+}
+func rewriteValueARM_OpARMGreaterThanU(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (GreaterThanU (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.ugt())])
for {
- if v_0.Op != OpARMFlagGT_UGT {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 0
+ v.AuxInt = int32ToAuxInt(b2i32(fc.ugt()))
return true
}
- // match: (LessEqualU (InvertFlags x))
- // result: (GreaterEqualU x)
+ // match: (GreaterThanU (InvertFlags x))
+ // result: (LessThanU x)
for {
if v_0.Op != OpARMInvertFlags {
break
}
x := v_0.Args[0]
- v.reset(OpARMGreaterEqualU)
+ v.reset(OpARMLessThanU)
v.AddArg(x)
return true
}
return false
}
-func rewriteValueARM_OpARMLessThan(v *Value) bool {
+func rewriteValueARM_OpARMLessEqual(v *Value) bool {
v_0 := v.Args[0]
- // match: (LessThan (FlagEQ))
- // result: (MOVWconst [0])
+ // match: (LessEqual (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.le())])
for {
- if v_0.Op != OpARMFlagEQ {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 0
+ v.AuxInt = int32ToAuxInt(b2i32(fc.le()))
return true
}
- // match: (LessThan (FlagLT_ULT))
- // result: (MOVWconst [1])
+ // match: (LessEqual (InvertFlags x))
+ // result: (GreaterEqual x)
for {
- if v_0.Op != OpARMFlagLT_ULT {
+ if v_0.Op != OpARMInvertFlags {
break
}
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
+ x := v_0.Args[0]
+ v.reset(OpARMGreaterEqual)
+ v.AddArg(x)
return true
}
- // match: (LessThan (FlagLT_UGT))
- // result: (MOVWconst [1])
+ return false
+}
+func rewriteValueARM_OpARMLessEqualU(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (LessEqualU (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.ule())])
for {
- if v_0.Op != OpARMFlagLT_UGT {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 1
+ v.AuxInt = int32ToAuxInt(b2i32(fc.ule()))
return true
}
- // match: (LessThan (FlagGT_ULT))
- // result: (MOVWconst [0])
+ // match: (LessEqualU (InvertFlags x))
+ // result: (GreaterEqualU x)
for {
- if v_0.Op != OpARMFlagGT_ULT {
+ if v_0.Op != OpARMInvertFlags {
break
}
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
+ x := v_0.Args[0]
+ v.reset(OpARMGreaterEqualU)
+ v.AddArg(x)
return true
}
- // match: (LessThan (FlagGT_UGT))
- // result: (MOVWconst [0])
+ return false
+}
+func rewriteValueARM_OpARMLessThan(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (LessThan (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.lt())])
for {
- if v_0.Op != OpARMFlagGT_UGT {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 0
+ v.AuxInt = int32ToAuxInt(b2i32(fc.lt()))
return true
}
// match: (LessThan (InvertFlags x))
}
func rewriteValueARM_OpARMLessThanU(v *Value) bool {
v_0 := v.Args[0]
- // match: (LessThanU (FlagEQ))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagEQ {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (LessThanU (FlagLT_ULT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagLT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (LessThanU (FlagLT_UGT))
- // result: (MOVWconst [0])
+ // match: (LessThanU (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.ult())])
for {
- if v_0.Op != OpARMFlagLT_UGT {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (LessThanU (FlagGT_ULT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagGT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (LessThanU (FlagGT_UGT))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagGT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
+ v.AuxInt = int32ToAuxInt(b2i32(fc.ult()))
return true
}
// match: (LessThanU (InvertFlags x))
}
func rewriteValueARM_OpARMNotEqual(v *Value) bool {
v_0 := v.Args[0]
- // match: (NotEqual (FlagEQ))
- // result: (MOVWconst [0])
- for {
- if v_0.Op != OpARMFlagEQ {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 0
- return true
- }
- // match: (NotEqual (FlagLT_ULT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagLT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (NotEqual (FlagLT_UGT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagLT_UGT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (NotEqual (FlagGT_ULT))
- // result: (MOVWconst [1])
- for {
- if v_0.Op != OpARMFlagGT_ULT {
- break
- }
- v.reset(OpARMMOVWconst)
- v.AuxInt = 1
- return true
- }
- // match: (NotEqual (FlagGT_UGT))
- // result: (MOVWconst [1])
+ // match: (NotEqual (FlagConstant [fc]))
+ // result: (MOVWconst [b2i32(fc.ne())])
for {
- if v_0.Op != OpARMFlagGT_UGT {
+ if v_0.Op != OpARMFlagConstant {
break
}
+ fc := auxIntToFlagConstant(v_0.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = 1
+ v.AuxInt = int32ToAuxInt(b2i32(fc.ne()))
return true
}
// match: (NotEqual (InvertFlags x))
v_2 := v.Args[2]
v_1 := v.Args[1]
v_0 := v.Args[0]
- // match: (SRAcond x _ (FlagEQ))
+ // match: (SRAcond x _ (FlagConstant [fc]))
+ // cond: fc.uge()
// result: (SRAconst x [31])
for {
x := v_0
- if v_2.Op != OpARMFlagEQ {
- break
- }
- v.reset(OpARMSRAconst)
- v.AuxInt = 31
- v.AddArg(x)
- return true
- }
- // match: (SRAcond x y (FlagLT_ULT))
- // result: (SRA x y)
- for {
- x := v_0
- y := v_1
- if v_2.Op != OpARMFlagLT_ULT {
+ if v_2.Op != OpARMFlagConstant {
break
}
- v.reset(OpARMSRA)
- v.AddArg2(x, y)
- return true
- }
- // match: (SRAcond x _ (FlagLT_UGT))
- // result: (SRAconst x [31])
- for {
- x := v_0
- if v_2.Op != OpARMFlagLT_UGT {
+ fc := auxIntToFlagConstant(v_2.AuxInt)
+ if !(fc.uge()) {
break
}
v.reset(OpARMSRAconst)
- v.AuxInt = 31
+ v.AuxInt = int32ToAuxInt(31)
v.AddArg(x)
return true
}
- // match: (SRAcond x y (FlagGT_ULT))
+ // match: (SRAcond x y (FlagConstant [fc]))
+ // cond: fc.ult()
// result: (SRA x y)
for {
x := v_0
y := v_1
- if v_2.Op != OpARMFlagGT_ULT {
+ if v_2.Op != OpARMFlagConstant {
break
}
- v.reset(OpARMSRA)
- v.AddArg2(x, y)
- return true
- }
- // match: (SRAcond x _ (FlagGT_UGT))
- // result: (SRAconst x [31])
- for {
- x := v_0
- if v_2.Op != OpARMFlagGT_UGT {
+ fc := auxIntToFlagConstant(v_2.AuxInt)
+ if !(fc.ult()) {
break
}
- v.reset(OpARMSRAconst)
- v.AuxInt = 31
- v.AddArg(x)
+ v.reset(OpARMSRA)
+ v.AddArg2(x, y)
return true
}
return false
func rewriteValueARM_OpARMTEQconst(v *Value) bool {
v_0 := v.Args[0]
// match: (TEQconst (MOVWconst [x]) [y])
- // cond: int32(x^y)==0
- // result: (FlagEQ)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x^y) == 0) {
- break
- }
- v.reset(OpARMFlagEQ)
- return true
- }
- // match: (TEQconst (MOVWconst [x]) [y])
- // cond: int32(x^y)<0
- // result: (FlagLT_UGT)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x^y) < 0) {
- break
- }
- v.reset(OpARMFlagLT_UGT)
- return true
- }
- // match: (TEQconst (MOVWconst [x]) [y])
- // cond: int32(x^y)>0
- // result: (FlagGT_UGT)
+ // result: (FlagConstant [logicFlags32(x^y)])
for {
- y := v.AuxInt
+ y := auxIntToInt32(v.AuxInt)
if v_0.Op != OpARMMOVWconst {
break
}
- x := v_0.AuxInt
- if !(int32(x^y) > 0) {
- break
- }
- v.reset(OpARMFlagGT_UGT)
+ x := auxIntToInt32(v_0.AuxInt)
+ v.reset(OpARMFlagConstant)
+ v.AuxInt = flagConstantToAuxInt(logicFlags32(x ^ y))
return true
}
return false
func rewriteValueARM_OpARMTSTconst(v *Value) bool {
v_0 := v.Args[0]
// match: (TSTconst (MOVWconst [x]) [y])
- // cond: int32(x&y)==0
- // result: (FlagEQ)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x&y) == 0) {
- break
- }
- v.reset(OpARMFlagEQ)
- return true
- }
- // match: (TSTconst (MOVWconst [x]) [y])
- // cond: int32(x&y)<0
- // result: (FlagLT_UGT)
- for {
- y := v.AuxInt
- if v_0.Op != OpARMMOVWconst {
- break
- }
- x := v_0.AuxInt
- if !(int32(x&y) < 0) {
- break
- }
- v.reset(OpARMFlagLT_UGT)
- return true
- }
- // match: (TSTconst (MOVWconst [x]) [y])
- // cond: int32(x&y)>0
- // result: (FlagGT_UGT)
+ // result: (FlagConstant [logicFlags32(x&y)])
for {
- y := v.AuxInt
+ y := auxIntToInt32(v.AuxInt)
if v_0.Op != OpARMMOVWconst {
break
}
- x := v_0.AuxInt
- if !(int32(x&y) > 0) {
- break
- }
- v.reset(OpARMFlagGT_UGT)
+ x := auxIntToInt32(v_0.AuxInt)
+ v.reset(OpARMFlagConstant)
+ v.AuxInt = flagConstantToAuxInt(logicFlags32(x & y))
return true
}
return false
// result: (SRAconst (RSBshiftRL <typ.Int32> x x [1]) [31])
for {
x := v_0
- v.reset(OpARMSRAconst)
- v.AuxInt = 31
- v0 := b.NewValue0(v.Pos, OpARMRSBshiftRL, typ.Int32)
- v0.AuxInt = 1
- v0.AddArg2(x, x)
- v.AddArg(v0)
- return true
- }
-}
-func rewriteBlockARM(b *Block) bool {
- switch b.Kind {
- case BlockARMEQ:
- // match: (EQ (FlagEQ) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagEQ {
- b.Reset(BlockFirst)
- return true
- }
- // match: (EQ (FlagLT_ULT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
- b.Reset(BlockFirst)
- b.swapSuccessors()
- return true
- }
- // match: (EQ (FlagLT_UGT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
- b.Reset(BlockFirst)
- b.swapSuccessors()
- return true
- }
- // match: (EQ (FlagGT_ULT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
+ v.reset(OpARMSRAconst)
+ v.AuxInt = 31
+ v0 := b.NewValue0(v.Pos, OpARMRSBshiftRL, typ.Int32)
+ v0.AuxInt = 1
+ v0.AddArg2(x, x)
+ v.AddArg(v0)
+ return true
+ }
+}
+func rewriteBlockARM(b *Block) bool {
+ switch b.Kind {
+ case BlockARMEQ:
+ // match: (EQ (FlagConstant [fc]) yes no)
+ // cond: fc.eq()
+ // result: (First yes no)
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.eq()) {
+ break
+ }
b.Reset(BlockFirst)
- b.swapSuccessors()
return true
}
- // match: (EQ (FlagGT_UGT) yes no)
+ // match: (EQ (FlagConstant [fc]) yes no)
+ // cond: !fc.eq()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.eq()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true
return true
}
case BlockARMGE:
- // match: (GE (FlagEQ) yes no)
+ // match: (GE (FlagConstant [fc]) yes no)
+ // cond: fc.ge()
// result: (First yes no)
- for b.Controls[0].Op == OpARMFlagEQ {
- b.Reset(BlockFirst)
- return true
- }
- // match: (GE (FlagLT_ULT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.ge()) {
+ break
+ }
b.Reset(BlockFirst)
- b.swapSuccessors()
return true
}
- // match: (GE (FlagLT_UGT) yes no)
+ // match: (GE (FlagConstant [fc]) yes no)
+ // cond: !fc.ge()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.ge()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true
}
- // match: (GE (FlagGT_ULT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
- b.Reset(BlockFirst)
- return true
- }
- // match: (GE (FlagGT_UGT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
- b.Reset(BlockFirst)
- return true
- }
// match: (GE (InvertFlags cmp) yes no)
// result: (LE cmp yes no)
for b.Controls[0].Op == OpARMInvertFlags {
return true
}
case BlockARMGEnoov:
- // match: (GEnoov (InvertFlags cmp) yes no)
- // result: (LEnoov cmp yes no)
- for b.Controls[0].Op == OpARMInvertFlags {
+ // match: (GEnoov (FlagConstant [fc]) yes no)
+ // cond: fc.geNoov()
+ // result: (First yes no)
+ for b.Controls[0].Op == OpARMFlagConstant {
v_0 := b.Controls[0]
- cmp := v_0.Args[0]
- b.resetWithControl(BlockARMLEnoov, cmp)
- return true
- }
- case BlockARMGT:
- // match: (GT (FlagEQ) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagEQ {
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.geNoov()) {
+ break
+ }
b.Reset(BlockFirst)
- b.swapSuccessors()
return true
}
- // match: (GT (FlagLT_ULT) yes no)
+ // match: (GEnoov (FlagConstant [fc]) yes no)
+ // cond: !fc.geNoov()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.geNoov()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true
}
- // match: (GT (FlagLT_UGT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
- b.Reset(BlockFirst)
- b.swapSuccessors()
+ // match: (GEnoov (InvertFlags cmp) yes no)
+ // result: (LEnoov cmp yes no)
+ for b.Controls[0].Op == OpARMInvertFlags {
+ v_0 := b.Controls[0]
+ cmp := v_0.Args[0]
+ b.resetWithControl(BlockARMLEnoov, cmp)
return true
}
- // match: (GT (FlagGT_ULT) yes no)
+ case BlockARMGT:
+ // match: (GT (FlagConstant [fc]) yes no)
+ // cond: fc.gt()
// result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.gt()) {
+ break
+ }
b.Reset(BlockFirst)
return true
}
- // match: (GT (FlagGT_UGT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
+ // match: (GT (FlagConstant [fc]) yes no)
+ // cond: !fc.gt()
+ // result: (First no yes)
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.gt()) {
+ break
+ }
b.Reset(BlockFirst)
+ b.swapSuccessors()
return true
}
// match: (GT (InvertFlags cmp) yes no)
return true
}
case BlockARMGTnoov:
+ // match: (GTnoov (FlagConstant [fc]) yes no)
+ // cond: fc.gtNoov()
+ // result: (First yes no)
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.gtNoov()) {
+ break
+ }
+ b.Reset(BlockFirst)
+ return true
+ }
+ // match: (GTnoov (FlagConstant [fc]) yes no)
+ // cond: !fc.gtNoov()
+ // result: (First no yes)
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.gtNoov()) {
+ break
+ }
+ b.Reset(BlockFirst)
+ b.swapSuccessors()
+ return true
+ }
// match: (GTnoov (InvertFlags cmp) yes no)
// result: (LTnoov cmp yes no)
for b.Controls[0].Op == OpARMInvertFlags {
return true
}
case BlockARMLE:
- // match: (LE (FlagEQ) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagEQ {
- b.Reset(BlockFirst)
- return true
- }
- // match: (LE (FlagLT_ULT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
- b.Reset(BlockFirst)
- return true
- }
- // match: (LE (FlagLT_UGT) yes no)
+ // match: (LE (FlagConstant [fc]) yes no)
+ // cond: fc.le()
// result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
- b.Reset(BlockFirst)
- return true
- }
- // match: (LE (FlagGT_ULT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.le()) {
+ break
+ }
b.Reset(BlockFirst)
- b.swapSuccessors()
return true
}
- // match: (LE (FlagGT_UGT) yes no)
+ // match: (LE (FlagConstant [fc]) yes no)
+ // cond: !fc.le()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.le()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true
return true
}
case BlockARMLEnoov:
- // match: (LEnoov (InvertFlags cmp) yes no)
- // result: (GEnoov cmp yes no)
- for b.Controls[0].Op == OpARMInvertFlags {
+ // match: (LEnoov (FlagConstant [fc]) yes no)
+ // cond: fc.leNoov()
+ // result: (First yes no)
+ for b.Controls[0].Op == OpARMFlagConstant {
v_0 := b.Controls[0]
- cmp := v_0.Args[0]
- b.resetWithControl(BlockARMGEnoov, cmp)
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.leNoov()) {
+ break
+ }
+ b.Reset(BlockFirst)
return true
}
- case BlockARMLT:
- // match: (LT (FlagEQ) yes no)
+ // match: (LEnoov (FlagConstant [fc]) yes no)
+ // cond: !fc.leNoov()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagEQ {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.leNoov()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true
}
- // match: (LT (FlagLT_ULT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
- b.Reset(BlockFirst)
+ // match: (LEnoov (InvertFlags cmp) yes no)
+ // result: (GEnoov cmp yes no)
+ for b.Controls[0].Op == OpARMInvertFlags {
+ v_0 := b.Controls[0]
+ cmp := v_0.Args[0]
+ b.resetWithControl(BlockARMGEnoov, cmp)
return true
}
- // match: (LT (FlagLT_UGT) yes no)
+ case BlockARMLT:
+ // match: (LT (FlagConstant [fc]) yes no)
+ // cond: fc.lt()
// result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
- b.Reset(BlockFirst)
- return true
- }
- // match: (LT (FlagGT_ULT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.lt()) {
+ break
+ }
b.Reset(BlockFirst)
- b.swapSuccessors()
return true
}
- // match: (LT (FlagGT_UGT) yes no)
+ // match: (LT (FlagConstant [fc]) yes no)
+ // cond: !fc.lt()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.lt()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true
return true
}
case BlockARMLTnoov:
+ // match: (LTnoov (FlagConstant [fc]) yes no)
+ // cond: fc.ltNoov()
+ // result: (First yes no)
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.ltNoov()) {
+ break
+ }
+ b.Reset(BlockFirst)
+ return true
+ }
+ // match: (LTnoov (FlagConstant [fc]) yes no)
+ // cond: !fc.ltNoov()
+ // result: (First no yes)
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.ltNoov()) {
+ break
+ }
+ b.Reset(BlockFirst)
+ b.swapSuccessors()
+ return true
+ }
// match: (LTnoov (InvertFlags cmp) yes no)
// result: (GTnoov cmp yes no)
for b.Controls[0].Op == OpARMInvertFlags {
b.resetWithControl(BlockARMUGE, cc)
return true
}
- // match: (NE (FlagEQ) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagEQ {
- b.Reset(BlockFirst)
- b.swapSuccessors()
- return true
- }
- // match: (NE (FlagLT_ULT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
- b.Reset(BlockFirst)
- return true
- }
- // match: (NE (FlagLT_UGT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
- b.Reset(BlockFirst)
- return true
- }
- // match: (NE (FlagGT_ULT) yes no)
+ // match: (NE (FlagConstant [fc]) yes no)
+ // cond: fc.ne()
// result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.ne()) {
+ break
+ }
b.Reset(BlockFirst)
return true
}
- // match: (NE (FlagGT_UGT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
+ // match: (NE (FlagConstant [fc]) yes no)
+ // cond: !fc.ne()
+ // result: (First no yes)
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.ne()) {
+ break
+ }
b.Reset(BlockFirst)
+ b.swapSuccessors()
return true
}
// match: (NE (InvertFlags cmp) yes no)
return true
}
case BlockARMUGE:
- // match: (UGE (FlagEQ) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagEQ {
- b.Reset(BlockFirst)
- return true
- }
- // match: (UGE (FlagLT_ULT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
- b.Reset(BlockFirst)
- b.swapSuccessors()
- return true
- }
- // match: (UGE (FlagLT_UGT) yes no)
+ // match: (UGE (FlagConstant [fc]) yes no)
+ // cond: fc.uge()
// result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.uge()) {
+ break
+ }
b.Reset(BlockFirst)
return true
}
- // match: (UGE (FlagGT_ULT) yes no)
+ // match: (UGE (FlagConstant [fc]) yes no)
+ // cond: !fc.uge()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.uge()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true
}
- // match: (UGE (FlagGT_UGT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
- b.Reset(BlockFirst)
- return true
- }
// match: (UGE (InvertFlags cmp) yes no)
// result: (ULE cmp yes no)
for b.Controls[0].Op == OpARMInvertFlags {
return true
}
case BlockARMUGT:
- // match: (UGT (FlagEQ) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagEQ {
- b.Reset(BlockFirst)
- b.swapSuccessors()
- return true
- }
- // match: (UGT (FlagLT_ULT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
- b.Reset(BlockFirst)
- b.swapSuccessors()
- return true
- }
- // match: (UGT (FlagLT_UGT) yes no)
+ // match: (UGT (FlagConstant [fc]) yes no)
+ // cond: fc.ugt()
// result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.ugt()) {
+ break
+ }
b.Reset(BlockFirst)
return true
}
- // match: (UGT (FlagGT_ULT) yes no)
+ // match: (UGT (FlagConstant [fc]) yes no)
+ // cond: !fc.ugt()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.ugt()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true
}
- // match: (UGT (FlagGT_UGT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
- b.Reset(BlockFirst)
- return true
- }
// match: (UGT (InvertFlags cmp) yes no)
// result: (ULT cmp yes no)
for b.Controls[0].Op == OpARMInvertFlags {
return true
}
case BlockARMULE:
- // match: (ULE (FlagEQ) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagEQ {
- b.Reset(BlockFirst)
- return true
- }
- // match: (ULE (FlagLT_ULT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
- b.Reset(BlockFirst)
- return true
- }
- // match: (ULE (FlagLT_UGT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
- b.Reset(BlockFirst)
- b.swapSuccessors()
- return true
- }
- // match: (ULE (FlagGT_ULT) yes no)
+ // match: (ULE (FlagConstant [fc]) yes no)
+ // cond: fc.ule()
// result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.ule()) {
+ break
+ }
b.Reset(BlockFirst)
return true
}
- // match: (ULE (FlagGT_UGT) yes no)
+ // match: (ULE (FlagConstant [fc]) yes no)
+ // cond: !fc.ule()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.ule()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true
return true
}
case BlockARMULT:
- // match: (ULT (FlagEQ) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagEQ {
- b.Reset(BlockFirst)
- b.swapSuccessors()
- return true
- }
- // match: (ULT (FlagLT_ULT) yes no)
- // result: (First yes no)
- for b.Controls[0].Op == OpARMFlagLT_ULT {
- b.Reset(BlockFirst)
- return true
- }
- // match: (ULT (FlagLT_UGT) yes no)
- // result: (First no yes)
- for b.Controls[0].Op == OpARMFlagLT_UGT {
- b.Reset(BlockFirst)
- b.swapSuccessors()
- return true
- }
- // match: (ULT (FlagGT_ULT) yes no)
+ // match: (ULT (FlagConstant [fc]) yes no)
+ // cond: fc.ult()
// result: (First yes no)
- for b.Controls[0].Op == OpARMFlagGT_ULT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(fc.ult()) {
+ break
+ }
b.Reset(BlockFirst)
return true
}
- // match: (ULT (FlagGT_UGT) yes no)
+ // match: (ULT (FlagConstant [fc]) yes no)
+ // cond: !fc.ult()
// result: (First no yes)
- for b.Controls[0].Op == OpARMFlagGT_UGT {
+ for b.Controls[0].Op == OpARMFlagConstant {
+ v_0 := b.Controls[0]
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ if !(!fc.ult()) {
+ break
+ }
b.Reset(BlockFirst)
b.swapSuccessors()
return true