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

            Bug ID: 90644
           Summary: Call to __builtin_memcmp not folded for identical
                    vectors
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: prathamesh3492 at gcc dot gnu.org
  Target Milestone: ---

Hi,
For following test-case:

#include <stdint.h>

typedef int32_t vnx4si __attribute__((vector_size (32)));

void foo(int a, int b)
{
  vnx4si v = (vnx4si) { a, b, 1, 2 };
  vnx4si expected = (vnx4si) { a, b, 1, 2 };

  if (__builtin_memcmp (&v, &expected, sizeof (vnx4si)) != 0)
    __builtin_abort ();
}

-O2 -ftree-vectorize -march=armv8.2-a+sve folds call to __builtin_memcmp
correctly, since both vectors are identical.

But with -msve-vector-bits=256, it fails to fold the call to
__builtin_memcmp().

The issue can also be reproduced with AdvSIMD: Fails to fold the call to
__builtin_memcmp with vector_size == 16 but folds with vector_size == 32.

Thanks,
Prathamesh

Reply via email to