https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91540
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- In summary, clang is trying to produce xor always for similar value reductions (or still branches) while GCC produce plus and minus; though producing xor or ior might lead to better code in general.