summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/vsx-builtin-4.c
blob: f639b907695fe65311ebb50fe62bbadf6b9a4a5b (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
/* { dg-options "-O2 -mcpu=power7" } */
/* { dg-final { scan-assembler "xvcmpeqdp." } } */
/* { dg-final { scan-assembler "xvcmpgtdp." } } */
/* { dg-final { scan-assembler "xvcmpgedp." } } */
/* { dg-final { scan-assembler "xvcmpeqsp." } } */
/* { dg-final { scan-assembler "xvcmpgtsp." } } */
/* { dg-final { scan-assembler "xvcmpgesp." } } */
/* { dg-final { scan-assembler "vcmpbfp." } } */
/* { dg-final { scan-assembler "vcmpequb." } } */
/* { dg-final { scan-assembler "vcmpequh." } } */
/* { dg-final { scan-assembler "vcmpequw." } } */
/* { dg-final { scan-assembler "vcmpgtub." } } */
/* { dg-final { scan-assembler "vcmpgtuh." } } */
/* { dg-final { scan-assembler "vcmpgtuw." } } */
/* { dg-final { scan-assembler "vcmpgtsb." } } */
/* { dg-final { scan-assembler "vcmpgtsh." } } */
/* { dg-final { scan-assembler "vcmpgtsw." } } */
/* { dg-final { scan-assembler-not "vcmpeqfp" } } */
/* { dg-final { scan-assembler-not "vcmpgtfp" } } */
/* { dg-final { scan-assembler-not "vcmpgefp" } } */

/* check that Altivec builtins generate VSX if -mvsx.  */

#include <altivec.h>

int *v16qi_s (vector signed char *a, vector signed char *b, int *p)
{
  if (vec_all_eq (*a, *b))
    *p++ = 1;

  if (vec_all_gt (*a, *b))
    *p++ = 2;

  if (vec_all_ge (*a, *b))
    *p++ = 2;

  return p;
}

int *v16qi_u (vector unsigned char *a, vector unsigned char *b, int *p)
{
  if (vec_all_eq (*a, *b))
    *p++ = 1;

  if (vec_all_gt (*a, *b))
    *p++ = 2;

  if (vec_all_ge (*a, *b))
    *p++ = 2;

  return p;
}

int *v8hi_s (vector short *a, vector short *b, int *p)
{
  if (vec_all_eq (*a, *b))
    *p++ = 1;

  if (vec_all_gt (*a, *b))
    *p++ = 2;

  if (vec_all_ge (*a, *b))
    *p++ = 2;

  return p;
}

int *v8hi_u (vector unsigned short *a, vector unsigned short *b, int *p)
{
  if (vec_all_eq (*a, *b))
    *p++ = 1;

  if (vec_all_gt (*a, *b))
    *p++ = 2;

  if (vec_all_ge (*a, *b))
    *p++ = 2;

  return p;
}

int *v4si_s (vector int *a, vector int *b, int *p)
{
  if (vec_all_eq (*a, *b))
    *p++ = 1;

  if (vec_all_gt (*a, *b))
    *p++ = 2;

  if (vec_all_ge (*a, *b))
    *p++ = 2;

  return p;
}

int *v4si_u (vector unsigned int *a, vector unsigned int *b, int *p)
{
  if (vec_all_eq (*a, *b))
    *p++ = 1;

  if (vec_all_gt (*a, *b))
    *p++ = 2;

  if (vec_all_ge (*a, *b))
    *p++ = 2;

  return p;
}

int *v4sf (vector float *a, vector float *b, int *p)
{
  if (vec_all_eq (*a, *b))
    *p++ = 1;

  if (vec_all_gt (*a, *b))
    *p++ = 2;

  if (vec_all_ge (*a, *b))
    *p++ = 3;

  if (vec_all_in (*a, *b))	/* veccmpbfp. */
    *p++ = 4;

  return p;
}

int *v2df (vector double *a, vector double *b, int *p)
{
  if (vec_all_eq (*a, *b))
    *p++ = 1;

  if (vec_all_gt (*a, *b))
    *p++ = 2;

  if (vec_all_ge (*a, *b))
    *p++ = 3;

  return p;
}