[Bug tree-optimization/101590] New: (len & - N) <= len is not optimized to 1

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 23 03:40:49 GMT 2021


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

            Bug ID: 101590
           Summary: (len & - N) <= len is not optimized to 1
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

#include <stddef.h>

const size_t N = 4;

bool foo(size_t len) {
        size_t newlen = len & -N;
        return newlen <= len;
}


More information about the Gcc-bugs mailing list