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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |target

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Actually SRA is fine.  vect_compute_data_ref_alignment is, too, leaving
DR_MISALIGNMENT at -1.  The target then tells us via

      bool is_packed = false;
      tree type = (TREE_TYPE (DR_REF (dr)));

      if (!known_alignment_for_access_p (dr))
        is_packed = not_size_aligned (DR_REF (dr));

     if ((TYPE_USER_ALIGN (type) && !is_packed)
         || targetm.vectorize.
              support_vector_misalignment (mode, type,
                                           DR_MISALIGNMENT (dr), is_packed))
       return dr_unaligned_supported;

rm_builtin_support_vector_misalignment (mode=V2DImode, type=0x7ffff68280a8, 
    misalignment=-1, is_packed=true)
    at /space/rguenther/tramp3d/trunk/gcc/config/arm/arm.c:27218
27218     if (TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access)
27217   {
27218     if (TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access)
27219       {
27220         HOST_WIDE_INT align = TYPE_ALIGN_UNIT (type);
27221
27222         if (is_packed)
(gdb) p unaligned_access
No symbol "unaligned_access" in current context.
(gdb) n
27220         HOST_WIDE_INT align = TYPE_ALIGN_UNIT (type);
(gdb) 
27222         if (is_packed)
(gdb) 
27223           return align == 1;

oops.  That's obviously buggy.  Not sure what the ARM hook expects in 'type',
but appearantly it's not what the vectorizer passes in here.

Docs say

This hook should return true if the target supports misaligned vector\n\
store/load of a specific factor denoted in the @var{misalignment}\n\
parameter.  The vector store/load should be of machine mode @var{mode} and\n\
the elements in the vectors should be of type @var{type}.  @var{is_packed}\n\
parameter is true if the memory access is defined in a packed struct.

but the arm hook seems to say "yes, I can vectorize with V2DImode
for a vector with element type unsigned long long __attribute__((aligned(1)))"
which it obviously cannot.

IMHO the hook should compare required mode alignment with type alignment.

This seems to be the arm hook trying to be too clever.

-> target bug.

Reply via email to