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

            Bug ID: 68532
           Summary: [ARM] Incorrect code result on arm big endian
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michael.collison at linaro dot org
  Target Milestone: ---

The following test case produces the incorrect answer on arm big endian with
the following options:  -O2 -ftree-vectorize -fno-vect-cost-model 
-mcpu=cortex-a8 -mfpu=neon

Result should be '960', armbe generate '992' as the result.

#include <stdio.h>
#include <stdalign.h>

#define SIZE 128
unsigned short alignas(16) in[SIZE];

__attribute__ ((noinline)) int
test (unsigned short diff, unsigned short *in, int x)
{
    for (int j = 0; j < SIZE; j+=8)
      diff += in[j] * x;
    return diff;
}

int main()
{
    for (int i = 0; i<SIZE; i++) in[i] = i;
    printf("%d\n", test(0, in, 1));
    return 0;
}

Reply via email to