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

Alan Lawrence <alan.lawrence at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alan.lawrence at arm dot com

--- Comment #8 from Alan Lawrence <alan.lawrence at arm dot com> ---
Here's a simpler testcase that shows the "if (BYTES_BIG_ENDIAN)" in
tree-vect-loop.c is wrong:

static unsigned char in[16];

int
main ( unsigned char argc, char **argv)
{
  unsigned char i = 0;
  unsigned char sum = 0;
  for (i = 0; i < 16; i++)
    in[i] = i;

  for (i = 0; i < 16; i++)
    sum += in[i];

  if (sum != (unsigned char) 120)
    __builtin_printf ("Failed\n");  
}

On AArch64 or x86, compiling with -O3, there is no output.
On AArch64_be or PowerPC (compiling with -O3 -maltivec), it prints "Failed!".

The output from dom2 shows the problem:

Optimizing statement vect_sum_13.10_27 = [reduc_plus_expr] vect_sum_13.8_4;
  Replaced 'vect_sum_13.8_4' with constant '{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15 }'
  Folded to: vect_sum_13.10_27 = { 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0 };
LKUP STMT vect_sum_13.10_27 = { 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0 }
          vect_sum_13.10_27 = { 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0 };
==== ASGN vect_sum_13.10_27 = { 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0 }
Optimizing statement stmp_sum_13.9_28 = BIT_FIELD_REF <vect_sum_13.10_27, 8,
120>;
  Replaced 'vect_sum_13.10_27' with constant '{ 120, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 }'
  Folded to: stmp_sum_13.9_28 = 0;
LKUP STMT stmp_sum_13.9_28 = 0
          stmp_sum_13.9_28 = 0;
==== ASGN stmp_sum_13.9_28 = 0
Optimizing statement vect_sum_13.11_29 = stmp_sum_13.9_28;
  Replaced 'stmp_sum_13.9_28' with constant '0'
LKUP STMT vect_sum_13.11_29 = 0
          vect_sum_13.11_29 = 0;
==== ASGN vect_sum_13.11_29 = 0
Optimizing statement if (vect_sum_13.11_29 != 120)
  Replaced 'vect_sum_13.11_29' with constant '0'
  Folded to: if (1 != 0)

Reply via email to