[Bug tree-optimization/108477] fwprop over-optimizes conversion from + to |

roger at nextmovesoftware dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108477

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roger at nextmovesoftware dot com
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-08-09

--- Comment #3 from Roger Sayle <roger at nextmovesoftware dot com> ---
One solution might be to introduce a BIT_AOP_EXPR which behaves like
BIT_IOR_EXPR and BIT_XOR_EXPR and PLUS_EXPR, relying on the semantics that the
bits in its two operands are disjoint (i.e. (op0 & op1) == 0).  The backend can
then decide which operation to actually use during RTL expansion.

[But I also agree with Uros; on x86 the PLUS is more useful than the IOR.]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.