https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100864
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I have a patch,
(for bitop (bit_and bit_ior)
rbitop (bit_ior bit_and)
....
/* Similar but for comparisons which have been inverted already,
Note it is hard to similulate inverted tcc_comparison due to NaNs
so a double for loop is needed and then compare the inverse code
with the result of invert_tree_comparison is needed. */
(for cmp (tcc_comparison)
(for icmp (tcc_comparison)
(simplify
(bitop:c (rbitop:c (icmp @0 @1) @2) (cmp@3 @0 @1))
(with { enum tree_code ic = invert_tree_comparison
(cmp, HONOR_NANS (@0)); }
(if (ic == icmp)
(bitop @3 @2)))))))
It is more complex than I had liked but it does solve the issue. There is no
way really of simplifying the pattern either, just because of the way match.pd
works :(