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

            Bug ID: 115950
           Summary: Missed SVE fold to INCP
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

#include <arm_sve.h>

using u64 = uint64_t;

u64 foo2(u64 x, svbool_t pg)
{
  return x+svcntp_b8(pg, pg);
}

compiled with -O3 -march=armv9-a generates:
foo2(unsigned long, __SVBool_t, __SVBool_t):
        cntp    x1, p0, p0.b
        add     x0, x1, x0
        ret

but that should be folded to:
foo2(unsigned long, __SVBool_t, __SVBool_t):                // @foo2(unsigned
long, __SVBool_t, __SVBool_t)
        incp    x0, p0.b
        ret

Like LLVM does.

Reply via email to