summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/altivec-10.c
blob: f532eebbfab0b67ce1bbdb636989a1c84c814e9a (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec -mabi=altivec -fno-inline" } */

#include <altivec.h>

extern void exit (int);
extern void abort (void);

typedef union
{
  float         f[4];
  unsigned int  i[4];
  vector float  v;
} vec_float_t;

void 
check_vec_all_num ()
{
  vec_float_t a, b, c;

  a.i[0] = 0xfffa5a5a;
  a.f[1] = 1.0;
  a.f[2] = 1.0;
  a.f[3] = 1.0;

  b.f[0] = 1.0;
  b.f[1] = 1.0;
  b.f[2] = 1.0;
  b.f[3] = 1.0;

  c.i[0] = 0xfffa5a5a;
  c.i[1] = 0xfffa5a5a;
  c.i[2] = 0xfffa5a5a;
  c.i[3] = 0xfffa5a5a;

  if (vec_all_numeric (a.v))
    abort ();

  if (vec_all_nan (a.v))
    abort ();

  if (!vec_all_numeric (b.v))
    abort ();

  if (vec_all_nan (b.v))
    abort ();

  if (vec_all_numeric (c.v))
    abort ();

  if (!vec_all_nan (c.v))
    abort ();

}

void 
check_cmple()
{
  vector float a = {1.0, 2.0, 3.0, 4.0};
  vector float b = {1.0, 3.0, 2.0, 5.0};
  vector bool int aux;
  vector signed int le = {-1, -1, 0, -1};

  aux = vec_cmple (a, b);

  if (!vec_all_eq (aux, le))
    abort ();
}


int 
main()
{
  check_cmple ();
  check_vec_all_num ();
  exit (0);
}