summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vmx/debug-4.c
blob: e30ba2674f1c29a965c1ed17a5f58e3b44189ef8 (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
#include <altivec.h>
vector unsigned char u8;
vector signed char s8;
vector bool char b8;
vector unsigned short u16;
vector signed short s16;
vector bool short b16;
vector unsigned int u32;
vector signed int s32;
vector bool int b32;
vector float f32;
vector pixel p16;

void f_u8(vector unsigned char *p) {
  u8 = vec_add(*p, *p);
}
void f_s8(vector signed char *p) {
  s8 = vec_add(*p, *p);
}
void f_b8(vector bool char *p) {
  b8 = vec_cmpgt(s8, s8);
  b8 = vec_xor(b8, *p);
}
void f_u16(vector unsigned short *p) {
  u16 = vec_add(*p, *p);
}
void f_s16(vector signed short *p) {
  s16 = vec_add(*p, *p);
}
void f_b16(vector bool short *p) {
  b16 = vec_cmpgt(s16, s16);
  b16 = vec_xor(b16, *p);
}
void f_u32(vector unsigned int *p) {
  u32 = vec_add(*p, *p);
}
void f_s32(vector signed int *p) {
  s32 = vec_add(*p, *p);
}
void f_b32(vector bool int *p) {
  b32 = vec_cmpgt(s32, s32);
  b32 = vec_xor(b32, *p);
}
void f_f32(vector float *p) {
  f32 = vec_add(*p, *p);
}
void f_p16(vector pixel *p) {
  p16 = *p;
}

int main() {
  vector unsigned char u8 = ((vector unsigned char){1, 2, 3, 4, 5, 6, 7, 8,
						   9, 10,11,12,13,14,15,16});
  vector signed char s8 = ((vector signed char){1, 2, 3, 4, 5, 6, 7, 8,
					       9, 10,11,12,13,14,15,16});
  vector bool char b8 = ((vector bool char){0, -1, 0, -1, 0, 0, 0, 0,
					   -1, -1, -1, -1, 0, -1, 0, -1});
  vector unsigned short u16 = ((vector unsigned short){1, 2, 3, 4, 5, 6, 7, 8});
  vector signed short s16 = ((vector signed short){1, 2, 3, 4, 5, 6, 7, 8});
  vector bool short b16 = ((vector bool short){-1, 0, -1, 0, -1, -1, 0, 0});
  vector unsigned int u32 = ((vector unsigned int){1, 2, 3, 4});
  vector signed int s32 = ((vector signed int){1, 2, 3, 4});
  vector bool int b32 = ((vector bool int){0, -1, -1, 0});
  vector float f32 = ((vector float){1, 2, 3, 4});
  vector pixel p16 = ((vector pixel){1, 2, 3, 4, 5, 6, 7, 8});
  f_u8(&u8);
  f_s8(&s8);
  f_b8(&b8);
  f_u16(&u16);
  f_s16(&s16);
  f_b16(&b16);
  f_u32(&u32);
  f_s32(&s32);
  f_b32(&b32);
  f_f32(&f32);
  f_p16(&p16);
  return 0;
}