aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/torture/vector-compare-2.c
blob: 628a699034815820aa914390b173b56058f5b89a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* { dg-do run } */
/* { dg-options "-Wno-psabi -w" } */
#define vector(elcount, type)  \
__attribute__((vector_size((elcount)*sizeof(type)))) type

/* Check that constant folding in 
   these simple cases works.  */
vector (4, int)
foo (vector (4, int) x)
{
  return   (x == x) + (x != x) + (x >  x) 
	 + (x <  x) + (x >= x) + (x <= x);
}

int 
main (int argc, char *argv[])
{
  vector (4, int) t = {argc, 2, argc, 42};
  vector (4, int) r;
  int i;

  r = foo (t);

  for (i = 0; i < 4; i++)
    if (r[i] != -3)
      __builtin_abort ();

  return 0;
}