diff --git a/src/cmd/compile/internal/ssa/gen/AMD64.rules b/src/cmd/compile/internal/ssa/gen/AMD64.rules index bda8429c5f..0b02301c7d 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64.rules +++ b/src/cmd/compile/internal/ssa/gen/AMD64.rules @@ -571,6 +571,10 @@ (SETB (TEST(Q|L|W|B) x x)) -> (ConstBool [0]) (SETAE (TEST(Q|L|W|B) x x)) -> (ConstBool [1]) +// x & 1 != 0 -> x & 1 +(SETNE (TEST(B|W)const [1] x)) => (AND(L|L)const [1] x) +(SETB (BT(L|Q)const [0] x)) => (AND(L|Q)const [1] x) + // Recognize bit tests: a&(1<