| 1 |
#include <altivec.h> |
| 2 |
vector unsigned char u8; |
| 3 |
vector signed char s8; |
| 4 |
vector bool char b8; |
| 5 |
vector unsigned short u16; |
| 6 |
vector signed short s16; |
| 7 |
vector bool short b16; |
| 8 |
vector unsigned int u32; |
| 9 |
vector signed int s32; |
| 10 |
vector bool int b32; |
| 11 |
vector float f32; |
| 12 |
vector pixel p16; |
| 13 |
|
| 14 |
void f_u8(vector unsigned char *p) { |
| 15 |
u8 = vec_add(*p, *p); |
| 16 |
} |
| 17 |
void f_s8(vector signed char *p) { |
| 18 |
s8 = vec_add(*p, *p); |
| 19 |
} |
| 20 |
void f_b8(vector bool char *p) { |
| 21 |
b8 = vec_cmpgt(s8, s8); |
| 22 |
b8 = vec_xor(b8, *p); |
| 23 |
} |
| 24 |
void f_u16(vector unsigned short *p) { |
| 25 |
u16 = vec_add(*p, *p); |
| 26 |
} |
| 27 |
void f_s16(vector signed short *p) { |
| 28 |
s16 = vec_add(*p, *p); |
| 29 |
} |
| 30 |
void f_b16(vector bool short *p) { |
| 31 |
b16 = vec_cmpgt(s16, s16); |
| 32 |
b16 = vec_xor(b16, *p); |
| 33 |
} |
| 34 |
void f_u32(vector unsigned int *p) { |
| 35 |
u32 = vec_add(*p, *p); |
| 36 |
} |
| 37 |
void f_s32(vector signed int *p) { |
| 38 |
s32 = vec_add(*p, *p); |
| 39 |
} |
| 40 |
void f_b32(vector bool int *p) { |
| 41 |
b32 = vec_cmpgt(s32, s32); |
| 42 |
b32 = vec_xor(b32, *p); |
| 43 |
} |
| 44 |
void f_f32(vector float *p) { |
| 45 |
f32 = vec_add(*p, *p); |
| 46 |
} |
| 47 |
void f_p16(vector pixel *p) { |
| 48 |
p16 = *p; |
| 49 |
} |
| 50 |
|
| 51 |
int main() { |
| 52 |
vector unsigned char u8 = ((vector unsigned char){1, 2, 3, 4, 5, 6, 7, 8, |
| 53 |
9, 10,11,12,13,14,15,16}); |
| 54 |
vector signed char s8 = ((vector signed char){1, 2, 3, 4, 5, 6, 7, 8, |
| 55 |
9, 10,11,12,13,14,15,16}); |
| 56 |
vector bool char b8 = ((vector bool char){0, -1, 0, -1, 0, 0, 0, 0, |
| 57 |
-1, -1, -1, -1, 0, -1, 0, -1}); |
| 58 |
vector unsigned short u16 = ((vector unsigned short){1, 2, 3, 4, 5, 6, 7, 8}); |
| 59 |
vector signed short s16 = ((vector signed short){1, 2, 3, 4, 5, 6, 7, 8}); |
| 60 |
vector bool short b16 = ((vector bool short){-1, 0, -1, 0, -1, -1, 0, 0}); |
| 61 |
vector unsigned int u32 = ((vector unsigned int){1, 2, 3, 4}); |
| 62 |
vector signed int s32 = ((vector signed int){1, 2, 3, 4}); |
| 63 |
vector bool int b32 = ((vector bool int){0, -1, -1, 0}); |
| 64 |
vector float f32 = ((vector float){1, 2, 3, 4}); |
| 65 |
vector pixel p16 = ((vector pixel){1, 2, 3, 4, 5, 6, 7, 8}); |
| 66 |
f_u8(&u8); |
| 67 |
f_s8(&s8); |
| 68 |
f_b8(&b8); |
| 69 |
f_u16(&u16); |
| 70 |
f_s16(&s16); |
| 71 |
f_b16(&b16); |
| 72 |
f_u32(&u32); |
| 73 |
f_s32(&s32); |
| 74 |
f_b32(&b32); |
| 75 |
f_f32(&f32); |
| 76 |
f_p16(&p16); |
| 77 |
return 0; |
| 78 |
} |