On 5/18/23 20:14, Andrew Pinski via Gcc-patches wrote:
This is a case which I noticed while working on the previous patch.
Sometimes we end up with `a == CST` instead of comparing against 0.
This happens in the following code:
```
unsigned f(unsigned t)
{
   if (t & ~(1<<30)) __builtin_unreachable();
   t ^= (1<<30);
   return t != 0;
}
```

We should handle the case where the nonzero bits is the same as the
comparison operand.

OK? Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

        * expr.cc (do_store_flag): Improve for single bit testing
        not against zero but against that single bit.
This looks like it can/should go forward independently of 1/2 and touches on my earlier comment about using bit extractions ;-)

So OK by me.

jeff

Reply via email to