1 /* { dg-require-effective-target powerpc_altivec_ok } */
2 /* { dg-options "-maltivec" } */
3
4 /* Test vec_ld and vec_st can support both scalar and vector
5 type address points, the list is:
6 - address of unsigned char/short/int
7 - address of signed char/short/int
8 - address of float
9 - address of vector unsigned char/short/int
10 - address of vector signed char/short/int
11 - address of vector float */
12 #include <altivec.h>
13
14 /* Test vec_ld can allow scalar and vector type address. */
15 vector unsigned char
test_vld_scalar_uc(const unsigned char * address)16 test_vld_scalar_uc (const unsigned char *address)
17 {
18 return __builtin_vec_ld (0, address);
19 }
20
21 vector unsigned short
test_vld_scalar_us(const unsigned short * address)22 test_vld_scalar_us (const unsigned short *address)
23 {
24 return __builtin_vec_ld (0, address);
25 }
26
27 vector unsigned int
test_vld_scalar_ui(const unsigned int * address)28 test_vld_scalar_ui (const unsigned int *address)
29 {
30 return __builtin_vec_ld (0, address);
31 }
32
33 vector signed char
test_vld_scalar_sc(const signed char * address)34 test_vld_scalar_sc (const signed char *address)
35 {
36 return __builtin_vec_ld (0, address);
37 }
38
39 vector signed short
test_vld_scalar_ss(const signed short * address)40 test_vld_scalar_ss (const signed short *address)
41 {
42 return __builtin_vec_ld (0, address);
43 }
44
45 vector signed int
test_vld_scalar_si(const signed int * address)46 test_vld_scalar_si (const signed int *address)
47 {
48 return __builtin_vec_ld (0, address);
49 }
50
51 vector float
test_vld_scalar_f(const float * address)52 test_vld_scalar_f (const float *address)
53 {
54 return __builtin_vec_ld (0, address);
55 }
56
57 vector unsigned char
test_vld_vector_uc(const vector unsigned char * address)58 test_vld_vector_uc (const vector unsigned char *address)
59 {
60 return __builtin_vec_ld (0, address);
61 }
62
63 vector unsigned short
test_vld_vector_us(const vector unsigned short * address)64 test_vld_vector_us (const vector unsigned short *address)
65 {
66 return __builtin_vec_ld (0, address);
67 }
68
69 vector unsigned int
test_vld_vector_ui(const vector unsigned int * address)70 test_vld_vector_ui (const vector unsigned int *address)
71 {
72 return __builtin_vec_ld (0, address);
73 }
74
75 vector signed char
test_vld_vector_sc(const vector signed char * address)76 test_vld_vector_sc (const vector signed char *address)
77 {
78 return __builtin_vec_ld (0, address);
79 }
80
81 vector signed short
test_vld_vector_ss(const vector signed short * address)82 test_vld_vector_ss (const vector signed short *address)
83 {
84 return __builtin_vec_ld (0, address);
85 }
86
87 vector signed int
test_vld_vector_si(const vector signed int * address)88 test_vld_vector_si (const vector signed int *address)
89 {
90 return __builtin_vec_ld (0, address);
91 }
92
93 vector float
test_vld_vector_f(const vector float * address)94 test_vld_vector_f (const vector float *address)
95 {
96 return __builtin_vec_ld (0, address);
97 }
98
99 /* Test vec_st can allow scalar and vector type address. */
100
101 void
test_vst_scalar_uc(vector unsigned char v,unsigned char * address)102 test_vst_scalar_uc (vector unsigned char v, unsigned char *address)
103 {
104 __builtin_vec_st (v, 0, address);
105 }
106
107 void
test_vst_scalar_us(vector unsigned short v,unsigned short * address)108 test_vst_scalar_us (vector unsigned short v, unsigned short *address)
109 {
110 __builtin_vec_st (v, 0, address);
111 }
112
113 void
test_vst_scalar_ui(vector unsigned int v,unsigned int * address)114 test_vst_scalar_ui (vector unsigned int v, unsigned int *address)
115 {
116 __builtin_vec_st (v, 0, address);
117 }
118
119 void
test_vst_scalar_sc(vector signed char v,signed char * address)120 test_vst_scalar_sc (vector signed char v, signed char *address)
121 {
122 __builtin_vec_st (v, 0, address);
123 }
124
125 void
test_vst_scalar_ss(vector signed short v,signed short * address)126 test_vst_scalar_ss (vector signed short v, signed short *address)
127 {
128 __builtin_vec_st (v, 0, address);
129 }
130
131 void
test_vst_scalar_si(vector signed int v,signed int * address)132 test_vst_scalar_si (vector signed int v, signed int *address)
133 {
134 __builtin_vec_st (v, 0, address);
135 }
136
137 void
test_vst_scalar_f(vector float v,float * address)138 test_vst_scalar_f (vector float v, float *address)
139 {
140 __builtin_vec_st (v, 0, address);
141 }
142
143 void
test_vst_vector_uc(vector unsigned char v,vector unsigned char * address)144 test_vst_vector_uc (vector unsigned char v, vector unsigned char *address)
145 {
146 __builtin_vec_st (v, 0, address);
147 }
148
149 void
test_vst_vector_us(vector unsigned short v,vector unsigned short * address)150 test_vst_vector_us (vector unsigned short v, vector unsigned short *address)
151 {
152 __builtin_vec_st (v, 0, address);
153 }
154
155 void
test_vst_vector_ui(vector unsigned int v,vector unsigned int * address)156 test_vst_vector_ui (vector unsigned int v, vector unsigned int *address)
157 {
158 __builtin_vec_st (v, 0, address);
159 }
160
161 void
test_vst_vector_sc(vector signed char v,vector signed char * address)162 test_vst_vector_sc (vector signed char v, vector signed char *address)
163 {
164 __builtin_vec_st (v, 0, address);
165 }
166
167 void
test_vst_vector_ss(vector signed short v,vector signed short * address)168 test_vst_vector_ss (vector signed short v, vector signed short *address)
169 {
170 __builtin_vec_st (v, 0, address);
171 }
172
173 void
test_vst_vector_si(vector signed int v,vector signed int * address)174 test_vst_vector_si (vector signed int v, vector signed int *address)
175 {
176 __builtin_vec_st (v, 0, address);
177 }
178
179 void
test_vst_vector_f(vector float v,vector float * address)180 test_vst_vector_f (vector float v, vector float *address)
181 {
182 __builtin_vec_st (v, 0, address);
183 }
184
185