summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/altivec-4.c
blob: 2c78f6586d61ceb05df7f97097b94b06c79ae884 (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
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec -O0 -Wall" } */

#define vector __attribute__((vector_size(16)))

static int vector x, y, z;

static vector signed int i,j;
static vector signed short s,t;
static vector signed char c,d;
static vector float f,g;

static vector unsigned char uc;

static vector signed int *pi;

static int int1, int2;

void
b()
{
  z = __builtin_altivec_vadduwm (x, y);

  /* Make sure the predicates accept correct argument types.  */
  
  int1 = __builtin_altivec_vcmpbfp_p (0, f, g);
  int1 = __builtin_altivec_vcmpeqfp_p (0, f, g);
  int1 = __builtin_altivec_vcmpequb_p (0, c, d);
  int1 = __builtin_altivec_vcmpequh_p (0, s, t);
  int1 = __builtin_altivec_vcmpequw_p (0, i, j);
  int1 = __builtin_altivec_vcmpgefp_p (0, f, g);
  int1 = __builtin_altivec_vcmpgtfp_p (0, f, g);
  int1 = __builtin_altivec_vcmpgtsb_p (0, c, d);
  int1 = __builtin_altivec_vcmpgtsh_p (0, s, t);
  int1 = __builtin_altivec_vcmpgtsw_p (0, i, j);
  int1 = __builtin_altivec_vcmpgtub_p (0, c, d);
  int1 = __builtin_altivec_vcmpgtuh_p (0, s, t);
  int1 = __builtin_altivec_vcmpgtuw_p (0, i, j);

  __builtin_altivec_mtvscr (i);
  __builtin_altivec_dssall ();
  s = __builtin_altivec_mfvscr ();
  __builtin_altivec_dss (3);

  __builtin_altivec_dst (pi, int1 + int2, 3);
  __builtin_altivec_dstst (pi, int1 + int2, 3);
  __builtin_altivec_dststt (pi, int1 + int2, 3);
  __builtin_altivec_dstt (pi, int1 + int2, 3);

  uc = (vector unsigned char) __builtin_altivec_lvsl (int1 + 69, pi);
  uc = (vector unsigned char) __builtin_altivec_lvsr (int1 + 69, pi);

  c = __builtin_altivec_lvebx (int1, pi);
  s = __builtin_altivec_lvehx (int1, pi);
  i = __builtin_altivec_lvewx (int1, pi);
  i = __builtin_altivec_lvxl (int1, pi);
  i = __builtin_altivec_lvx (int1, pi);

  __builtin_altivec_stvx (i, int2, pi);
  __builtin_altivec_stvebx (c, int2, pi);
  __builtin_altivec_stvehx (s, int2, pi);
  __builtin_altivec_stvewx (i, int2, pi);
  __builtin_altivec_stvxl (i, int2, pi);
}