3 vector
short vshort
= {111, 222, 333, 444, 555, 666, 777, 888};
4 vector
unsigned short vushort
= {100, 200, 300, 400, 500, 600, 700, 800};
5 vector
int vint
= {-10, -20, -30, -40};
6 vector
unsigned int vuint
= {1111, 2222, 3333, 4444};
7 vector
char vchar
= {'a','b','c','d','e','f','g','h','i','l','m','n','o','p','q','r'};
8 vector
unsigned char vuchar
= {'A','B','C','D','E','F','G','H','I','L','M','N','O','P','Q','R'};
9 vector
float vfloat
= {1.25, 3.75, 5.5, 1.25};
11 vector
short vshort_d
= {0,0,0,0,0,0,0,0};
12 vector
unsigned short vushort_d
= {0,0,0,0,0,0,0,0};
13 vector
int vint_d
= {0,0,0,0};
14 vector
unsigned int vuint_d
= {0,0,0,0};
15 vector
char vchar_d
= {'z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z'};
16 vector
unsigned char vuchar_d
= {'Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z'};
17 vector
float vfloat_d
= {1.0, 1.0, 1.0, 1.0};
19 struct test_vec_struct
21 vector
signed short vshort1
;
22 vector
signed short vshort2
;
23 vector
signed short vshort3
;
24 vector
signed short vshort4
;
27 static vector
signed short test4
[4] =
29 (vector
signed short) {1, 2, 3, 4, 5, 6, 7, 8},
30 (vector
signed short) {11, 12, 13, 14, 15, 16, 17, 18},
31 (vector
signed short) {21, 22, 23, 24, 25, 26, 27, 28},
32 (vector
signed short) {31, 32, 33, 34, 35, 36, 37, 38}
36 struct_of_vector_func (struct test_vec_struct vector_struct
)
38 vector_struct
.vshort1
= vec_add (vector_struct
.vshort1
, vector_struct
.vshort2
);
39 vector_struct
.vshort3
= vec_add (vector_struct
.vshort3
, vector_struct
.vshort4
);
43 array_of_vector_func (vector
signed short *matrix
)
45 matrix
[0] = vec_add (matrix
[0], matrix
[1]);
46 matrix
[2] = vec_add (matrix
[2], matrix
[3]);
50 vec_func (vector
short vshort_f
, /* goes in v2 */
51 vector
unsigned short vushort_f
, /* goes in v3 */
52 vector
int vint_f
, /* goes in v4 */
53 vector
unsigned int vuint_f
, /* goes in v5 */
54 vector
char vchar_f
, /* goes in v6 */
55 vector
unsigned char vuchar_f
, /* goes in v7 */
56 vector
float vfloat_f
, /* goes in v8 */
57 vector
short x_f
, /* goes in v9 */
58 vector
int y_f
, /* goes in v10 */
59 vector
char a_f
, /* goes in v11 */
60 vector
float b_f
, /* goes in v12 */
61 vector
float c_f
, /* goes in v13 */
62 vector
int intv_on_stack_f
)
66 vector
unsigned int vuint_res
;
67 vector
short vshort_res
;
68 vector
unsigned short vushort_res
;
69 vector
char vchar_res
;
70 vector
float vfloat_res
;
71 vector
unsigned char vuchar_res
;
73 vint_res
= vec_add (vint_f
, intv_on_stack_f
);
74 vint_res
= vec_add (vint_res
, y_f
);
75 vuint_res
= vec_add (vuint_f
, ((vector
unsigned int) {5,6,7,8}));
76 vshort_res
= vec_add (vshort_f
, x_f
);
77 vushort_res
= vec_add (vushort_f
,
78 ((vector
unsigned short) {1,2,3,4,5,6,7,8}));
79 vchar_res
= vec_add (vchar_f
, a_f
);
80 vfloat_res
= vec_add (vfloat_f
, b_f
);
81 vfloat_res
= vec_add (c_f
, ((vector
float) {1.1,1.1,1.1,1.1}));
82 vuchar_res
= vec_add (vuchar_f
,
83 ((vector
unsigned char) {'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a'}));
93 vector
int result
= {-1,-1,-1,-1};
94 vector
short x
= {1,2,3,4,5,6,7,8};
95 vector
int y
= {12, 22, 32, 42};
96 vector
int intv_on_stack
= {12, 34, 56, 78};
97 vector
char a
= {'v','e','c','t','o','r',' ','o','f',' ','c','h','a','r','s','.' };
98 vector
float b
= {5.5, 4.5, 3.75, 2.25};
99 vector
float c
= {1.25, 3.5, 5.5, 7.75};
101 vector
short x_d
= {0,0,0,0,0,0,0,0};
102 vector
int y_d
= {0,0,0,0};
103 vector
int intv_on_stack_d
= {0,0,0,0};
104 vector
char a_d
= {'q','q','q','q','q','q','q','q','q','q','q','q','q','q','q','q'};
105 vector
float b_d
= {5.0, 5.0, 5.0, 5.0};
106 vector
float c_d
= {3.0, 3.0, 3.0, 3.0};
110 struct test_vec_struct vect_struct
;
112 vect_struct
.vshort1
= (vector
signed short){1, 2, 3, 4, 5, 6, 7, 8};
113 vect_struct
.vshort2
= (vector
signed short){11, 12, 13, 14, 15, 16, 17, 18};
114 vect_struct
.vshort3
= (vector
signed short){21, 22, 23, 24, 25, 26, 27, 28};
115 vect_struct
.vshort4
= (vector
signed short){31, 32, 33, 34, 35, 36, 37, 38};
119 /* This line is useful for cutting and pasting from the gdb command line. */
120 vec_func(vshort
,vushort
,vint
,vuint
,vchar
,vuchar
,vfloat
,x
,y
,a
,b
,c
,intv_on_stack
)
122 result
= vec_func (vshort
, /* goes in v2 */
123 vushort
, /* goes in v3 */
124 vint
, /* goes in v4 */
125 vuint
, /* goes in v5 */
126 vchar
, /* goes in v6 */
127 vuchar
, /* goes in v7 */
128 vfloat
, /* goes in v8 */
136 struct_of_vector_func (vect_struct
);
137 array_of_vector_func (test4
);