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

--- Comment #7 from Jeffrey A. Law <law at gcc dot gnu.org> ---
So fixing the single bit difference in C1 vs C2 is on old pending some slight
reworking of ifcvt.cc to address a regression caused by the patch that we'd
need to build on top of.

When I consider the more general case it seems like we ought to compute a C3
and C4.  C3 would be the difference between C1 and C2.  C4 is defined as C2 =
C1 ^ C4, so we'd just have to compute the proper value of C4.  We would then
compute the cost of C3 and C4 as an operand.  We'd build a sequence around
whichever is cheaper.

I suspect we'll see more optimizable cases with C3 than C4.  We could go a lot
further here  and look at shifts, shadd and other operations to capture cases
where the constants are related, but it's probably of minimal benefit unless
we're aware of meaningful cases from the real world.

Reply via email to