(CMPBconst (MOVBconst [x]) [y]) && int8(x)>int8(y) && uint8(x)>uint8(y) -> (FlagGT_UGT)
// Other known comparisons.
-(CMPQconst (ANDQconst _ [m]) [n]) && m+1==n && isPowerOfTwo(n) -> (FlagLT_ULT)
-(CMPLconst (ANDLconst _ [m]) [n]) && int32(m)+1==int32(n) && isPowerOfTwo(int64(int32(n))) -> (FlagLT_ULT)
-(CMPWconst (ANDWconst _ [m]) [n]) && int16(m)+1==int16(n) && isPowerOfTwo(int64(int16(n))) -> (FlagLT_ULT)
-(CMPBconst (ANDBconst _ [m]) [n]) && int8(m)+1==int8(n) && isPowerOfTwo(int64(int8(n))) -> (FlagLT_ULT)
+(CMPQconst (ANDQconst _ [m]) [n]) && 0 <= m && m < n -> (FlagLT_ULT)
+(CMPLconst (ANDLconst _ [m]) [n]) && 0 <= int32(m) && int32(m) < int32(n) -> (FlagLT_ULT)
+(CMPWconst (ANDWconst _ [m]) [n]) && 0 <= int16(m) && int16(m) < int16(n) -> (FlagLT_ULT)
+(CMPBconst (ANDBconst _ [m]) [n]) && 0 <= int8(m) && int8(m) < int8(n) -> (FlagLT_ULT)
// TODO: DIVxU also.
// Absorb flag constants into SBB ops.
return true
}
// match: (CMPBconst (ANDBconst _ [m]) [n])
- // cond: int8(m)+1==int8(n) && isPowerOfTwo(int64(int8(n)))
+ // cond: 0 <= int8(m) && int8(m) < int8(n)
// result: (FlagLT_ULT)
for {
v_0 := v.Args[0]
}
m := v_0.AuxInt
n := v.AuxInt
- if !(int8(m)+1 == int8(n) && isPowerOfTwo(int64(int8(n)))) {
+ if !(0 <= int8(m) && int8(m) < int8(n)) {
break
}
v.reset(OpAMD64FlagLT_ULT)
return true
}
// match: (CMPLconst (ANDLconst _ [m]) [n])
- // cond: int32(m)+1==int32(n) && isPowerOfTwo(int64(int32(n)))
+ // cond: 0 <= int32(m) && int32(m) < int32(n)
// result: (FlagLT_ULT)
for {
v_0 := v.Args[0]
}
m := v_0.AuxInt
n := v.AuxInt
- if !(int32(m)+1 == int32(n) && isPowerOfTwo(int64(int32(n)))) {
+ if !(0 <= int32(m) && int32(m) < int32(n)) {
break
}
v.reset(OpAMD64FlagLT_ULT)
return true
}
// match: (CMPQconst (ANDQconst _ [m]) [n])
- // cond: m+1==n && isPowerOfTwo(n)
+ // cond: 0 <= m && m < n
// result: (FlagLT_ULT)
for {
v_0 := v.Args[0]
}
m := v_0.AuxInt
n := v.AuxInt
- if !(m+1 == n && isPowerOfTwo(n)) {
+ if !(0 <= m && m < n) {
break
}
v.reset(OpAMD64FlagLT_ULT)
return true
}
// match: (CMPWconst (ANDWconst _ [m]) [n])
- // cond: int16(m)+1==int16(n) && isPowerOfTwo(int64(int16(n)))
+ // cond: 0 <= int16(m) && int16(m) < int16(n)
// result: (FlagLT_ULT)
for {
v_0 := v.Args[0]
}
m := v_0.AuxInt
n := v.AuxInt
- if !(int16(m)+1 == int16(n) && isPowerOfTwo(int64(int16(n)))) {
+ if !(0 <= int16(m) && int16(m) < int16(n)) {
break
}
v.reset(OpAMD64FlagLT_ULT)