[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / builtins-3.c
blobe048e8b2355544ad7f289b44e8f7334740df81e5
1 /* { dg-do compile } */
2 /* { dg-require-effective-target powerpc_altivec_ok } */
3 /* { dg-options "-maltivec" } */
5 #include <altivec.h>
7 vector bool char
8 test_eq_char (vector bool char x, vector bool char y)
10 return vec_cmpeq (x, y);
13 vector bool short
14 test_eq_short (vector bool short x, vector bool short y)
16 return vec_cmpeq (x, y);
19 vector bool int
20 test_eq_int (vector bool int x, vector bool int y)
22 return vec_cmpeq (x, y);
25 vector signed char
26 test_nabs_char (vector signed char x)
28 return vec_nabs (x);
31 vector short
32 test_nabs_short (vector short x)
34 return vec_nabs (x);
37 vector int
38 test_nabs_int (vector int x)
40 return vec_nabs (x);
43 vector signed char
44 test_sll_vsc_vsc_vsuc (vector signed char x, vector unsigned char y)
46 return vec_sll (x, y);
49 vector unsigned char
50 test_sll_vuc_vuc_vuc (vector unsigned char x, vector unsigned char y)
52 return vec_sll (x, y);
55 vector signed int
56 test_sll_vsi_vsi_vuc (vector signed int x, vector unsigned char y)
58 return vec_sll (x, y);
61 vector unsigned int
62 test_sll_vui_vui_vuc (vector unsigned int x, vector unsigned char y)
64 return vec_sll (x, y);
67 vector pixel
68 test_sll_vp_vp_vuc (vector pixel x, vector unsigned char y)
70 return vec_sll (x, y);
73 vector signed short int
74 test_sll_vssi_vssi_vuc (vector signed short x, vector unsigned char y)
76 return vec_sll (x, y);
79 vector unsigned short int
80 test_sll_vusi_vusi_vuc (vector unsigned short x, vector unsigned char y)
82 return vec_sll (x, y);
85 vector signed char
86 test_slo_vsc_vsc_vsc (vector signed char x, vector signed char y)
88 return vec_slo (x, y);
91 vector signed char
92 test_slo_vsc_vsc_vuc (vector signed char x, vector unsigned char y)
94 return vec_slo (x, y);
97 vector unsigned char
98 test_slo_vuc_vuc_vsc (vector unsigned char x, vector signed char y)
100 return vec_slo (x, y);
103 vector unsigned char
104 test_slo_vuc_vuc_vuc (vector unsigned char x, vector unsigned char y)
106 return vec_slo (x, y);
109 vector signed int
110 test_slo_vsi_vsi_vsc (vector signed int x, vector signed char y)
112 return vec_slo (x, y);
115 vector signed int
116 test_slo_vsi_vsi_vuc (vector signed int x, vector unsigned char y)
118 return vec_slo (x, y);
121 vector unsigned int
122 test_slo_vui_vui_vsc (vector unsigned int x, vector signed char y)
124 return vec_slo (x, y);
127 vector unsigned int
128 test_slo_vui_vui_vuc (vector unsigned int x, vector unsigned char y)
130 return vec_slo (x, y);
134 vector pixel
135 test_slo_vp_vp_vsc (vector pixel int x, vector signed char y)
137 return vec_slo (x, y);
140 vector pixel
141 test_slo_vp_vp_vuc (vector pixel int x, vector unsigned char y)
143 return vec_slo (x, y);
146 vector signed short int
147 test_slo_vssi_vssi_vsc (vector signed short int x, vector signed char y)
149 return vec_slo (x, y);
152 vector signed short int
153 test_slo_vssi_vssi_vuc (vector signed short int x, vector unsigned char y)
155 return vec_slo (x, y);
158 vector unsigned short int
159 test_slo_vusi_vusi_vsc (vector unsigned short int x, vector signed char y)
161 return vec_slo (x, y);
164 vector unsigned short int
165 test_slo_vusi_vusi_vuc (vector unsigned short int x, vector unsigned char y)
167 return vec_slo (x, y);
170 vector float
171 test_slo_vf_vf_vsc (vector float x, vector signed char y)
173 return vec_slo (x, y);
176 vector float
177 test_slo_vf_vf_vuc (vector float x, vector unsigned char y)
179 return vec_slo (x, y);
182 vector int
183 test_cmpb_float (vector float x, vector float y)
185 return vec_cmpb (x, y);
188 /* Expected test results:
190 test_eq_char 1 vcmpequb inst
191 test_eq_short 1 vcmpequh inst
192 test_eq_int 1 vcmpequw inst
193 test_nabs_char 1 vsububm, 1 vminsb
194 test_nabs_short 1 vsubuhm, 1 vminsh
195 test_nabs_int 1 vsubuwm, 1 vminsw
196 test_sll_vsc_vsc_vsuc 1 vsl
197 test_sll_vuc_vuc_vuc 1 vsl
198 test_sll_vsi_vsi_vuc 1 vsl
199 test_sll_vui_vui_vuc 1 vsl
200 test_sll_vp_vp_vuc 1 vsl
201 test_sll_vssi_vssi_vuc 1 vsl
202 test_sll_vusi_vusi_vuc 1 vsl
203 test_slo_vsc_vsc_vsc 1 vslo
204 test_slo_vsc_vsc_vuc 1 vslo
205 test_slo_vuc_vuc_vsc 1 vslo
206 test_slo_vuc_vuc_vuc 1 vslo
207 test_slo_vsi_vsi_vsc 1 vslo
208 test_slo_vsi_vsi_vuc 1 vslo
209 test_slo_vui_vui_vsc 1 vslo
210 test_slo_vui_vui_vuc 1 vslo
211 test_slo_vp_vp_vsc 1 vslo
212 test_slo_vp_vp_vuc 1 vslo
213 test_slo_vssi_vssi_vsc 1 vslo
214 test_slo_vssi_vssi_vuc 1 vslo
215 test_slo_vusi_vusi_vsc 1 vslo
216 test_slo_vusi_vusi_vuc 1 vslo
217 test_slo_vf_vf_vsc 1 vslo
218 test_slo_vf_vf_vuc 1 vslo
219 test_cmpb_float 1 vcmpbfp */
221 /* { dg-final { scan-assembler-times "vcmpequb" 1 } } */
222 /* { dg-final { scan-assembler-times "vcmpequh" 1 } } */
223 /* { dg-final { scan-assembler-times "vcmpequw" 1 } } */
224 /* { dg-final { scan-assembler-times "vsububm" 1 } } */
225 /* { dg-final { scan-assembler-times "vsubuhm" 1 } } */
226 /* { dg-final { scan-assembler-times "vsubuwm" 1 } } */
227 /* { dg-final { scan-assembler-times "vminsb" 1 } } */
228 /* { dg-final { scan-assembler-times "vminsh" 1 } } */
229 /* { dg-final { scan-assembler-times "vminsw" 1 } } */
230 /* { dg-final { scan-assembler-times "vslo" 16 } } */
231 /* { dg-final { scan-assembler-times "vcmpbfp" 1 } } */
232 /* { dg-final { scan-assembler-times "vsl" 23 } } */