Re: [x86 PATCH] Pre-reload splitter to transform and; cmp into not; test.

2022-05-26 Thread Uros Bizjak via Gcc-patches
On Thu, May 26, 2022 at 8:41 PM Roger Sayle wrote: > > > A common idiom for testing if a specific set of bits is set in a value > is to use "(X & Y) == Y", which on x86 results in an AND followed by a > CMP. A slightly improved implementation is to instead use (~X & Y)==0, > that uses a NOT and a

[x86 PATCH] Pre-reload splitter to transform and;cmp into not;test.

2022-05-26 Thread Roger Sayle
A common idiom for testing if a specific set of bits is set in a value is to use "(X & Y) == Y", which on x86 results in an AND followed by a CMP. A slightly improved implementation is to instead use (~X & Y)==0, that uses a NOT and a TEST (or ANDN where available); still two "fast" instructions,