1 IN: math.vectors.simd.tests
2 USING: math math.vectors.simd math.vectors.simd.private
3 math.vectors math.functions math.private kernel.private compiler
4 sequences tools.test compiler.tree.debugger accessors kernel
7 [ float-4{ 0 0 0 0 } ] [ float-4 new ] unit-test
9 [ float-4{ 0 0 0 0 } ] [ [ float-4 new ] compile-call ] unit-test
11 [ V{ float } ] [ [ { float-4 } declare norm-sq ] final-classes ] unit-test
13 [ V{ float } ] [ [ { float-4 } declare norm ] final-classes ] unit-test
15 [ float-4{ 12 12 12 12 } ] [
16 12 [ float-4-with ] compile-call
19 [ float-4{ 1 2 3 4 } ] [
20 1 2 3 4 [ float-4-boa ] compile-call
23 [ float-4{ 11 22 33 44 } ] [
24 float-4{ 1 2 3 4 } float-4{ 10 20 30 40 }
25 [ { float-4 float-4 } declare v+ ] compile-call
28 [ float-4{ -9 -18 -27 -36 } ] [
29 float-4{ 1 2 3 4 } float-4{ 10 20 30 40 }
30 [ { float-4 float-4 } declare v- ] compile-call
33 [ float-4{ 10 40 90 160 } ] [
34 float-4{ 1 2 3 4 } float-4{ 10 20 30 40 }
35 [ { float-4 float-4 } declare v* ] compile-call
38 [ float-4{ 10 100 1000 10000 } ] [
39 float-4{ 100 2000 30000 400000 } float-4{ 10 20 30 40 }
40 [ { float-4 float-4 } declare v/ ] compile-call
43 [ float-4{ -10 -20 -30 -40 } ] [
44 float-4{ -10 20 -30 40 } float-4{ 10 -20 30 -40 }
45 [ { float-4 float-4 } declare vmin ] compile-call
48 [ float-4{ 10 20 30 40 } ] [
49 float-4{ -10 20 -30 40 } float-4{ 10 -20 30 -40 }
50 [ { float-4 float-4 } declare vmax ] compile-call
55 [ { float-4 } declare sum ] compile-call
60 [ { float-4 } declare sum 3.0 + ] compile-call
64 float-4{ 1 2 3 4 } float-4{ 2 0 2 0 }
65 [ { float-4 float-4 } declare v. ] compile-call
68 [ float-4{ 5 10 15 20 } ] [
69 5.0 float-4{ 1 2 3 4 }
70 [ { float float-4 } declare n*v ] compile-call
73 [ float-4{ 5 10 15 20 } ] [
74 float-4{ 1 2 3 4 } 5.0
75 [ { float float-4 } declare v*n ] compile-call
78 [ float-4{ 10 5 2 5 } ] [
79 10.0 float-4{ 1 2 5 2 }
80 [ { float float-4 } declare n/v ] compile-call
83 [ float-4{ 0.5 1 1.5 2 } ] [
85 [ { float float-4 } declare v/n ] compile-call
88 [ float-4{ 1 0 0 0 } ] [
90 [ { float-4 } declare normalize ] compile-call
95 [ { float-4 } declare norm-sq ] compile-call
101 [ { float-4 float-4 } declare distance ] compile-call
105 [ double-2{ 12 12 } ] [
106 12 [ double-2-with ] compile-call
109 [ double-2{ 1 2 } ] [
110 1 2 [ double-2-boa ] compile-call
113 [ double-2{ 11 22 } ] [
114 double-2{ 1 2 } double-2{ 10 20 }
115 [ { double-2 double-2 } declare v+ ] compile-call
118 [ double-2{ -9 -18 } ] [
119 double-2{ 1 2 } double-2{ 10 20 }
120 [ { double-2 double-2 } declare v- ] compile-call
123 [ double-2{ 10 40 } ] [
124 double-2{ 1 2 } double-2{ 10 20 }
125 [ { double-2 double-2 } declare v* ] compile-call
128 [ double-2{ 10 100 } ] [
129 double-2{ 100 2000 } double-2{ 10 20 }
130 [ { double-2 double-2 } declare v/ ] compile-call
133 [ double-2{ -10 -20 } ] [
134 double-2{ -10 20 } double-2{ 10 -20 }
135 [ { double-2 double-2 } declare vmin ] compile-call
138 [ double-2{ 10 20 } ] [
139 double-2{ -10 20 } double-2{ 10 -20 }
140 [ { double-2 double-2 } declare vmax ] compile-call
145 [ { double-2 } declare sum ] compile-call
150 [ { double-2 } declare sum 4.0 + ] compile-call
154 double-2{ 1 2 } double-2{ 2 7 }
155 [ { double-2 double-2 } declare v. ] compile-call
158 [ double-2{ 5 10 } ] [
160 [ { float double-2 } declare n*v ] compile-call
163 [ double-2{ 5 10 } ] [
165 [ { float double-2 } declare v*n ] compile-call
168 [ double-2{ 10 5 } ] [
170 [ { float double-2 } declare n/v ] compile-call
173 [ double-2{ 0.5 1 } ] [
175 [ { float double-2 } declare v/n ] compile-call
178 [ double-2{ 0 0 } ] [ double-2 new ] unit-test
180 [ double-2{ 1 0 } ] [
182 [ { double-2 } declare normalize ] compile-call
187 [ { double-2 } declare norm-sq ] compile-call
193 [ { double-2 double-2 } declare distance ] compile-call
197 [ double-4{ 0 0 0 0 } ] [ double-4 new ] unit-test
199 [ double-4{ 1 2 3 4 } ] [
203 [ double-4{ 1 1 1 1 } ] [
207 [ double-4{ 0 1 2 3 } ] [
208 1 double-4-with [ * ] map-index
211 [ V{ float } ] [ [ { double-4 } declare norm-sq ] final-classes ] unit-test
213 [ V{ float } ] [ [ { double-4 } declare norm ] final-classes ] unit-test
215 [ double-4{ 12 12 12 12 } ] [
216 12 [ double-4-with ] compile-call
219 [ double-4{ 1 2 3 4 } ] [
220 1 2 3 4 [ double-4-boa ] compile-call
223 [ double-4{ 11 22 33 44 } ] [
224 double-4{ 1 2 3 4 } double-4{ 10 20 30 40 }
225 [ { double-4 double-4 } declare v+ ] compile-call
228 [ double-4{ -9 -18 -27 -36 } ] [
229 double-4{ 1 2 3 4 } double-4{ 10 20 30 40 }
230 [ { double-4 double-4 } declare v- ] compile-call
233 [ double-4{ 10 40 90 160 } ] [
234 double-4{ 1 2 3 4 } double-4{ 10 20 30 40 }
235 [ { double-4 double-4 } declare v* ] compile-call
238 [ double-4{ 10 100 1000 10000 } ] [
239 double-4{ 100 2000 30000 400000 } double-4{ 10 20 30 40 }
240 [ { double-4 double-4 } declare v/ ] compile-call
243 [ double-4{ -10 -20 -30 -40 } ] [
244 double-4{ -10 20 -30 40 } double-4{ 10 -20 30 -40 }
245 [ { double-4 double-4 } declare vmin ] compile-call
248 [ double-4{ 10 20 30 40 } ] [
249 double-4{ -10 20 -30 40 } double-4{ 10 -20 30 -40 }
250 [ { double-4 double-4 } declare vmax ] compile-call
255 [ { double-4 } declare sum ] compile-call
260 [ { double-4 } declare sum 3.0 + ] compile-call
264 double-4{ 1 2 3 4 } double-4{ 2 0 2 0 }
265 [ { double-4 double-4 } declare v. ] compile-call
268 [ double-4{ 5 10 15 20 } ] [
269 5.0 double-4{ 1 2 3 4 }
270 [ { float double-4 } declare n*v ] compile-call
273 [ double-4{ 5 10 15 20 } ] [
274 double-4{ 1 2 3 4 } 5.0
275 [ { float double-4 } declare v*n ] compile-call
278 [ double-4{ 10 5 2 5 } ] [
279 10.0 double-4{ 1 2 5 2 }
280 [ { float double-4 } declare n/v ] compile-call
283 [ double-4{ 0.5 1 1.5 2 } ] [
284 double-4{ 1 2 3 4 } 2
285 [ { float double-4 } declare v/n ] compile-call
288 [ double-4{ 1 0 0 0 } ] [
290 [ { double-4 } declare normalize ] compile-call
295 [ { double-4 } declare norm-sq ] compile-call
301 [ { double-4 double-4 } declare distance ] compile-call
305 [ float-8{ 0 0 0 0 0 0 0 0 } ] [ float-8 new ] unit-test
307 [ float-8{ 0 0 0 0 0 0 0 0 } ] [ [ float-8 new ] compile-call ] unit-test
309 [ float-8{ 1 1 1 1 1 1 1 1 } ] [ 1 float-8-with ] unit-test
311 [ float-8{ 1 1 1 1 1 1 1 1 } ] [ [ 1 float-8-with ] compile-call ] unit-test
313 [ float-8{ 1 2 3 4 5 6 7 8 } ] [ 1 2 3 4 5 6 7 8 float-8-boa ] unit-test
315 [ float-8{ 1 2 3 4 5 6 7 8 } ] [ [ 1 2 3 4 5 6 7 8 float-8-boa ] compile-call ] unit-test
317 [ float-8{ 3 6 9 12 15 18 21 24 } ] [
318 float-8{ 1 2 3 4 5 6 7 8 }
319 float-8{ 2 4 6 8 10 12 14 16 }
320 [ { float-8 float-8 } declare v+ ] compile-call
323 [ float-8{ -1 -2 -3 -4 -5 -6 -7 -8 } ] [
324 float-8{ 1 2 3 4 5 6 7 8 }
325 float-8{ 2 4 6 8 10 12 14 16 }
326 [ { float-8 float-8 } declare v- ] compile-call
329 [ float-8{ -1 -2 -3 -4 -5 -6 -7 -8 } ] [
331 float-8{ 2 4 6 8 10 12 14 16 }
332 [ { float float-8 } declare n*v ] compile-call
335 [ float-8{ -1 -2 -3 -4 -5 -6 -7 -8 } ] [
336 float-8{ 2 4 6 8 10 12 14 16 }
338 [ { float-8 float } declare v*n ] compile-call
341 [ float-8{ 256 128 64 32 16 8 4 2 } ] [
343 float-8{ 1 2 4 8 16 32 64 128 }
344 [ { float float-8 } declare n/v ] compile-call
347 [ float-8{ -1 -2 -3 -4 -5 -6 -7 -8 } ] [
348 float-8{ 2 4 6 8 10 12 14 16 }
350 [ { float-8 float } declare v/n ] compile-call
353 ! Test puns; only on x86
355 [ double-2{ 4 1024 } ] [
357 [ { float-4 } declare dup v+ underlying>> double-2 boa dup v+ ] compile-call
361 double-2{ 1 2 } double-2{ 10 20 }
362 [ { double-2 double-2 } declare v+ underlying>> 3.0 float* ] compile-call