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

            Bug ID: 65951
           Summary: [AArch64] Will not vectorize multiplication by long
                    constant
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alalaw01 at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

This loop:
void
foo (long *arr)
{
  for (int i = 0; i < 256; i++)
    arr[i] *= 19594L;
}

will not vectorize on AArch64, but does on x86. On AArch64,
-fdump-tree-vect-details reveals:
test.c:4:3: note: ==> examining statement: _9 = _8 * 19594;
test.c:4:3: note: vect_is_simple_use: operand _8
test.c:4:3: note: def_stmt: _8 = *_7;
test.c:4:3: note: type of def: 3.
test.c:4:3: note: vect_is_simple_use: operand 19594
test.c:4:3: note: op not supported by target.
test.c:4:3: note: not vectorized: relevant stmt not supported: _9 = _8 * 19594;

on x86, vectorization fails with vectorization_factor = 4 (V4DI), but succeeds
at V2DI.

We could vectorize this on AArch64 even if we have to perform a
multiple-instruction load of that constant (invariant!) before the
loop...right?

Reply via email to