view gcc/testsuite/gcc.dg/vect/pr80631-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children 1830386684a0
line wrap: on
line source

/* PR tree-optimization/80631 */

#include "tree-vect.h"

int v[8] = { 77, 1, 79, 3, 4, 3, 6, 7 };

__attribute__((noipa)) void
f1 (void)
{
  int k, r = -1;
  for (k = 0; k < 8; k++)
    if (v[k] == 77)
      r = k;
  if (r != 0)
    abort ();
}

__attribute__((noipa)) void
f2 (void)
{
  int k, r = 4;
  for (k = 0; k < 8; k++)
    if (v[k] == 79)
      r = k;
  if (r != 2)
    abort ();
}

__attribute__((noipa)) void
f3 (void)
{
  int k, r = -17;
  for (k = 0; k < 8; k++)
    if (v[k] == 78)
      r = k;
  if (r != -17)
    abort ();
}

__attribute__((noipa)) void
f4 (void)
{
  int k, r = 7;
  for (k = 0; k < 8; k++)
    if (v[k] == 78)
      r = k;
  if (r != 7)
    abort ();
}

__attribute__((noipa)) void
f5 (void)
{
  int k, r = -1;
  for (k = 0; k < 8; k++)
    if (v[k] == 3)
      r = k;
  if (r != 5)
    abort ();
}

int
main ()
{
  check_vect ();
  f1 ();
  f2 ();
  f3 ();
  f4 ();
  f5 ();
  return 0;
}

/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 5 "vect" { target vect_condition } } } */
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 10 "vect" { target vect_fold_extract_last } } } */
/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 10 "vect" { target { { ! vect_fold_extract_last } && vect_condition } } } } */