(CMPQconst (ANDQconst _ [m]) [n]) && 0 <= m && m < n => (FlagLT_ULT)
(CMPQconst (ANDLconst _ [m]) [n]) && 0 <= m && m < n => (FlagLT_ULT)
(CMPLconst (ANDLconst _ [m]) [n]) && 0 <= m && m < n => (FlagLT_ULT)
-(CMPWconst (ANDLconst _ [m]) [n]) && 0 <= m && int16(m) < n => (FlagLT_ULT)
-(CMPBconst (ANDLconst _ [m]) [n]) && 0 <= m && int8(m) < n => (FlagLT_ULT)
+(CMPWconst (ANDLconst _ [m]) [n]) && 0 <= int16(m) && int16(m) < n => (FlagLT_ULT)
+(CMPBconst (ANDLconst _ [m]) [n]) && 0 <= int8(m) && int8(m) < n => (FlagLT_ULT)
// TESTQ c c sets flags like CMPQ c 0.
(TESTQconst [c] (MOVQconst [d])) && int64(c) == d && c == 0 => (FlagEQ)
return true
}
// match: (CMPBconst (ANDLconst _ [m]) [n])
- // cond: 0 <= m && int8(m) < n
+ // cond: 0 <= int8(m) && int8(m) < n
// result: (FlagLT_ULT)
for {
n := auxIntToInt8(v.AuxInt)
break
}
m := auxIntToInt32(v_0.AuxInt)
- if !(0 <= m && int8(m) < n) {
+ if !(0 <= int8(m) && int8(m) < n) {
break
}
v.reset(OpAMD64FlagLT_ULT)
return true
}
// match: (CMPWconst (ANDLconst _ [m]) [n])
- // cond: 0 <= m && int16(m) < n
+ // cond: 0 <= int16(m) && int16(m) < n
// result: (FlagLT_ULT)
for {
n := auxIntToInt16(v.AuxInt)
break
}
m := auxIntToInt32(v_0.AuxInt)
- if !(0 <= m && int16(m) < n) {
+ if !(0 <= int16(m) && int16(m) < n) {
break
}
v.reset(OpAMD64FlagLT_ULT)
--- /dev/null
+// run
+
+// Copyright 2020 The Go Authors. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in
+// the LICENSE file.
+
+package main
+
+//go:noinline
+func f8(x int32) bool {
+ return byte(x&0xc0) == 64
+}
+
+//go:noinline
+func f16(x int32) bool {
+ return uint16(x&0x8040) == 64
+}
+
+func main() {
+ if !f8(64) {
+ panic("wanted true, got false")
+ }
+ if !f16(64) {
+ panic("wanted true, got false")
+ }
+}