https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125814

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-06-16
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
`5 - v1_u8` is the same as `v1_u8^1` because of the range.

So
(simplify
 (bit_xor (minus INTEGER_CST@0 @1) @1)
 (check range of @1 to only 2 numbers which add up to @0)
 { build_one_cst (type); })

But there has to be a better way than the above where we need to treat `5-a` as
`a^1` like this:

```
int src(int v1_u8) {
  if (!((2 <= v1_u8) && (v1_u8 <= 3))) __builtin_unreachable();
  int i0_u8 = 5 - v1_u8; // v1_u8^1
  int i1_u8 = v1_u8 | i0_u8;
  return i1_u8;
}
``

Which is just 3.

Reply via email to