view gcc/testsuite/gcc.dg/vect/pr65947-7.c @ 131:84e7813d76e9

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

/* { dg-require-effective-target vect_condition } */

#include "tree-vect.h"

extern void abort (void) __attribute__ ((noreturn));

#define N 43

/* Condition reduction with comparison is a different type to the data.  Will
   fail to vectorize.  */

int
condition_reduction (short *a, int min_v, int *b)
{
  int last = N + 65;
  short aval;

  for (int i = 0; i < N; i++)
    {
      aval = a[i];
      if (b[i] < min_v)
	last = aval;
    }
  return last;
}

int
main (void)
{
  short a[N] = {
  31, -32, 133, 324, 335, 36, 37, 45, 11, 65,
  1, -28, 3, 48, 5, -68, 7, 88, 89, 180,
  121, -122, 123, 124, -125, 126, 127, 128, 129, 130,
  11, 12, 13, 14, -15, -16, 17, 18, 19, 20,
  33, 27, 99
  };
  int b[N] = {
  11, -12, -13, 14, 15, 16, 17, 18, 19, 20,
  21, -22, 23, 24, -25, 26, 27, 28, 29, 30,
  1, 62, 3, 14, -15, 6, 37, 48, 99, 10,
  31, -32, 33, 34, -35, 36, 37, 56, 54, 22,
  73, 2, 87
  };

  check_vect ();

  int ret = condition_reduction (a, 16, b);

  if (ret != 27)
    abort ();

  return 0;
}

/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */