[Bug tree-optimization/90768] better range analysis for converting bit tests into less-than greater-than

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Sep 5 08:32:19 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Just to make things clean these two functions should produce the same code:

#include <stdint.h>
#include <stdlib.h>
int bcmp_1(char *a, char *b, size_t s) {
    if (s < 16) {
        if (s >= 8)
            if (*(uint64_t *)a != *(uint64_t *)b)
                return 1;

    }
  return 0;
}
int bcmp_2(char *a, char *b, size_t s) {
    if (s < 16) {
        if (s & 8)
            if (*(uint64_t *)a != *(uint64_t *)b)
                return 1;

    }
    return 0;
}


More information about the Gcc-bugs mailing list