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

            Bug ID: 114063
           Summary: Use IFN_CHECK_RAW_PTRS/IFN_CHECK_WAR_PTRS for
                    Advanced. SIMD
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64*

The following example:

void fn (short *a, short *b, short *c, int n)
{
    for (int i = 0; i < n; i += 2)
    {
        short b0 = b[i + 0];
        short b1 = b[i + 1];
        a[i + 0] = b0 + 2;
        a[i + 1] = b1 + 3;
    }
}

when compiled with -O3 -march=armv9-a

will generate an alias check using whilewr which is the corresponding
instruction for doing alias checks using CHECK_WAR_PTRS.

But when compiling for a known CPU, such as -mcpu=neoveser-v2 the vectorizer
chooses to use Adv. SIMD for the main loop, and so the check for supporting
IFN_CHECK_WAR_PTRS fails as we only support SVE modes.

Since all that really matters is the element size, I believe we can still use
IFN_CHECK_WAR_PTRS for Adv. SIMD using the SVE instruction if SVE is allowed.

That is, we should implement the pattern for Advanced SIMD modes as well gated
on TARGET_SVE.

Reply via email to