numexpr 2.10.2__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,543 @@
1
+ /*********************************************************************
2
+ Numexpr - Fast numerical array expression evaluator for NumPy.
3
+
4
+ License: MIT
5
+ Author: See AUTHORS.txt
6
+
7
+ See LICENSE.txt for details about copyright and rights to use.
8
+ **********************************************************************/
9
+
10
+ // WARNING: This file is included multiple times in `interpreter.cpp`. It is
11
+ // essentially a very macro-heavy jump table. Interpretation is best done by
12
+ // the developer by expanding all macros (e.g. adding `'-E'` to the `extra_cflags`
13
+ // argument in `setup.py` and looking at the resulting `interpreter.cpp`.
14
+ //
15
+ // Changes made to this file will not be recognized by the compile, so the developer
16
+ // must make a trivial change is made to `interpreter.cpp` or delete the `build/`
17
+ // directory in-between each build.
18
+ {
19
+ #define VEC_LOOP(expr) for(j = 0; j < BLOCK_SIZE; j++) { \
20
+ expr; \
21
+ }
22
+
23
+ #define VEC_ARG0(expr) \
24
+ BOUNDS_CHECK(store_in); \
25
+ { \
26
+ char *dest = mem[store_in]; \
27
+ VEC_LOOP(expr); \
28
+ } break
29
+
30
+ #define VEC_ARG1(expr) \
31
+ BOUNDS_CHECK(store_in); \
32
+ BOUNDS_CHECK(arg1); \
33
+ { \
34
+ char *dest = mem[store_in]; \
35
+ char *x1 = mem[arg1]; \
36
+ npy_intp ss1 = params.memsizes[arg1]; \
37
+ npy_intp sb1 = memsteps[arg1]; \
38
+ /* nowarns is defined and used so as to \
39
+ avoid compiler warnings about unused \
40
+ variables */ \
41
+ npy_intp nowarns = ss1+sb1+*x1; \
42
+ nowarns += 1; \
43
+ VEC_LOOP(expr); \
44
+ } break
45
+
46
+ #define VEC_ARG2(expr) \
47
+ BOUNDS_CHECK(store_in); \
48
+ BOUNDS_CHECK(arg1); \
49
+ BOUNDS_CHECK(arg2); \
50
+ { \
51
+ char *dest = mem[store_in]; \
52
+ char *x1 = mem[arg1]; \
53
+ npy_intp ss1 = params.memsizes[arg1]; \
54
+ npy_intp sb1 = memsteps[arg1]; \
55
+ /* nowarns is defined and used so as to \
56
+ avoid compiler warnings about unused \
57
+ variables */ \
58
+ npy_intp nowarns = ss1+sb1+*x1; \
59
+ char *x2 = mem[arg2]; \
60
+ npy_intp ss2 = params.memsizes[arg2]; \
61
+ npy_intp sb2 = memsteps[arg2]; \
62
+ nowarns += ss2+sb2+*x2; \
63
+ VEC_LOOP(expr); \
64
+ } break
65
+
66
+ #define VEC_ARG3(expr) \
67
+ BOUNDS_CHECK(store_in); \
68
+ BOUNDS_CHECK(arg1); \
69
+ BOUNDS_CHECK(arg2); \
70
+ BOUNDS_CHECK(arg3); \
71
+ { \
72
+ char *dest = mem[store_in]; \
73
+ char *x1 = mem[arg1]; \
74
+ npy_intp ss1 = params.memsizes[arg1]; \
75
+ npy_intp sb1 = memsteps[arg1]; \
76
+ /* nowarns is defined and used so as to \
77
+ avoid compiler warnings about unused \
78
+ variables */ \
79
+ npy_intp nowarns = ss1+sb1+*x1; \
80
+ char *x2 = mem[arg2]; \
81
+ npy_intp ss2 = params.memsizes[arg2]; \
82
+ npy_intp sb2 = memsteps[arg2]; \
83
+ char *x3 = mem[arg3]; \
84
+ npy_intp ss3 = params.memsizes[arg3]; \
85
+ npy_intp sb3 = memsteps[arg3]; \
86
+ nowarns += ss2+sb2+*x2; \
87
+ nowarns += ss3+sb3+*x3; \
88
+ VEC_LOOP(expr); \
89
+ } break
90
+
91
+ #define VEC_ARG1_VML(expr) \
92
+ BOUNDS_CHECK(store_in); \
93
+ BOUNDS_CHECK(arg1); \
94
+ { \
95
+ char *dest = mem[store_in]; \
96
+ char *x1 = mem[arg1]; \
97
+ expr; \
98
+ } break
99
+
100
+ #define VEC_ARG2_VML(expr) \
101
+ BOUNDS_CHECK(store_in); \
102
+ BOUNDS_CHECK(arg1); \
103
+ BOUNDS_CHECK(arg2); \
104
+ { \
105
+ char *dest = mem[store_in]; \
106
+ char *x1 = mem[arg1]; \
107
+ char *x2 = mem[arg2]; \
108
+ expr; \
109
+ } break
110
+
111
+ #define VEC_ARG3_VML(expr) \
112
+ BOUNDS_CHECK(store_in); \
113
+ BOUNDS_CHECK(arg1); \
114
+ BOUNDS_CHECK(arg2); \
115
+ BOUNDS_CHECK(arg3); \
116
+ { \
117
+ char *dest = mem[store_in]; \
118
+ char *x1 = mem[arg1]; \
119
+ char *x2 = mem[arg2]; \
120
+ char *x3 = mem[arg3]; \
121
+ expr; \
122
+ } break
123
+
124
+ int pc;
125
+ unsigned int j;
126
+
127
+ // set up pointers to next block of inputs and outputs
128
+ #ifdef SINGLE_ITEM_CONST_LOOP
129
+ mem[0] = params.output;
130
+ #else // SINGLE_ITEM_CONST_LOOP
131
+ // use the iterator's inner loop data
132
+ memcpy(mem, iter_dataptr, (1+params.n_inputs)*sizeof(char*));
133
+ # ifndef NO_OUTPUT_BUFFERING
134
+ // if output buffering is necessary, first write to the buffer
135
+ if(params.out_buffer != NULL) {
136
+ mem[0] = params.out_buffer;
137
+ }
138
+ # endif // NO_OUTPUT_BUFFERING
139
+ memcpy(memsteps, iter_strides, (1+params.n_inputs)*sizeof(npy_intp));
140
+ #endif // SINGLE_ITEM_CONST_LOOP
141
+
142
+ // WARNING: From now on, only do references to mem[arg[123]]
143
+ // & memsteps[arg[123]] inside the VEC_ARG[123] macros,
144
+ // or you will risk accessing invalid addresses.
145
+
146
+ for (pc = 0; pc < params.prog_len; pc += 4) {
147
+ unsigned char op = params.program[pc];
148
+ unsigned int store_in = params.program[pc+1];
149
+ unsigned int arg1 = params.program[pc+2];
150
+ unsigned int arg2 = params.program[pc+3];
151
+ #define arg3 params.program[pc+5]
152
+ // Iterator reduce macros
153
+ #ifdef REDUCTION_INNER_LOOP // Reduce is the inner loop
154
+ #define i_reduce *(int *)dest
155
+ #define l_reduce *(long long *)dest
156
+ #define f_reduce *(float *)dest
157
+ #define d_reduce *(double *)dest
158
+ #define cr_reduce *(double *)dest
159
+ #define ci_reduce *((double *)dest+1)
160
+ #else /* Reduce is the outer loop */
161
+ #define i_reduce i_dest
162
+ #define l_reduce l_dest
163
+ #define f_reduce f_dest
164
+ #define d_reduce d_dest
165
+ #define cr_reduce cr_dest
166
+ #define ci_reduce ci_dest
167
+ #endif
168
+ #define b_dest ((char *)dest)[j]
169
+ #define i_dest ((int *)dest)[j]
170
+ #define l_dest ((long long *)dest)[j]
171
+ #define f_dest ((float *)dest)[j]
172
+ #define d_dest ((double *)dest)[j]
173
+ #define cr_dest ((double *)dest)[2*j]
174
+ #define ci_dest ((double *)dest)[2*j+1]
175
+ #define s_dest ((char *)dest + j*memsteps[store_in])
176
+ #define b1 ((char *)(x1+j*sb1))[0]
177
+ #define i1 ((int *)(x1+j*sb1))[0]
178
+ #define l1 ((long long *)(x1+j*sb1))[0]
179
+ #define f1 ((float *)(x1+j*sb1))[0]
180
+ #define d1 ((double *)(x1+j*sb1))[0]
181
+ #define c1r ((double *)(x1+j*sb1))[0]
182
+ #define c1i ((double *)(x1+j*sb1))[1]
183
+ #define s1 ((char *)x1+j*sb1)
184
+ #define b2 ((char *)(x2+j*sb2))[0]
185
+ #define i2 ((int *)(x2+j*sb2))[0]
186
+ #define l2 ((long long *)(x2+j*sb2))[0]
187
+ #define f2 ((float *)(x2+j*sb2))[0]
188
+ #define d2 ((double *)(x2+j*sb2))[0]
189
+ #define c2r ((double *)(x2+j*sb2))[0]
190
+ #define c2i ((double *)(x2+j*sb2))[1]
191
+ #define s2 ((char *)x2+j*sb2)
192
+ #define b3 ((char *)(x3+j*sb3))[0]
193
+ #define i3 ((int *)(x3+j*sb3))[0]
194
+ #define l3 ((long long *)(x3+j*sb3))[0]
195
+ #define f3 ((float *)(x3+j*sb3))[0]
196
+ #define d3 ((double *)(x3+j*sb3))[0]
197
+ #define c3r ((double *)(x3+j*sb3))[0]
198
+ #define c3i ((double *)(x3+j*sb3))[1]
199
+ #define s3 ((char *)x3+j*sb3)
200
+ /* Some temporaries */
201
+ double da, db;
202
+ std::complex<double> ca, cb;
203
+
204
+ switch (op) {
205
+
206
+ case OP_NOOP: break;
207
+
208
+ case OP_COPY_BB: VEC_ARG1(b_dest = b1);
209
+ case OP_COPY_SS: VEC_ARG1(memcpy(s_dest, s1, ss1));
210
+ /* The next versions of copy opcodes can cope with unaligned
211
+ data even on platforms that crash while accessing it
212
+ (like the Sparc architecture under Solaris). */
213
+ case OP_COPY_II: VEC_ARG1(memcpy(&i_dest, s1, sizeof(int)));
214
+ case OP_COPY_LL: VEC_ARG1(memcpy(&l_dest, s1, sizeof(long long)));
215
+ case OP_COPY_FF: VEC_ARG1(memcpy(&f_dest, s1, sizeof(float)));
216
+ case OP_COPY_DD: VEC_ARG1(memcpy(&d_dest, s1, sizeof(double)));
217
+ case OP_COPY_CC: VEC_ARG1(memcpy(&cr_dest, s1, sizeof(double)*2));
218
+
219
+ /* Bool */
220
+ case OP_INVERT_BB: VEC_ARG1(b_dest = !b1);
221
+ case OP_AND_BBB: VEC_ARG2(b_dest = (b1 && b2));
222
+ case OP_OR_BBB: VEC_ARG2(b_dest = (b1 || b2));
223
+
224
+ case OP_EQ_BBB: VEC_ARG2(b_dest = (b1 == b2));
225
+ case OP_NE_BBB: VEC_ARG2(b_dest = (b1 != b2));
226
+ case OP_WHERE_BBBB: VEC_ARG3(b_dest = b1 ? b2 : b3);
227
+
228
+ /* Comparisons */
229
+ case OP_GT_BII: VEC_ARG2(b_dest = (i1 > i2));
230
+ case OP_GE_BII: VEC_ARG2(b_dest = (i1 >= i2));
231
+ case OP_EQ_BII: VEC_ARG2(b_dest = (i1 == i2));
232
+ case OP_NE_BII: VEC_ARG2(b_dest = (i1 != i2));
233
+
234
+ case OP_GT_BLL: VEC_ARG2(b_dest = (l1 > l2));
235
+ case OP_GE_BLL: VEC_ARG2(b_dest = (l1 >= l2));
236
+ case OP_EQ_BLL: VEC_ARG2(b_dest = (l1 == l2));
237
+ case OP_NE_BLL: VEC_ARG2(b_dest = (l1 != l2));
238
+
239
+ case OP_GT_BFF: VEC_ARG2(b_dest = (f1 > f2));
240
+ case OP_GE_BFF: VEC_ARG2(b_dest = (f1 >= f2));
241
+ case OP_EQ_BFF: VEC_ARG2(b_dest = (f1 == f2));
242
+ case OP_NE_BFF: VEC_ARG2(b_dest = (f1 != f2));
243
+
244
+ case OP_GT_BDD: VEC_ARG2(b_dest = (d1 > d2));
245
+ case OP_GE_BDD: VEC_ARG2(b_dest = (d1 >= d2));
246
+ case OP_EQ_BDD: VEC_ARG2(b_dest = (d1 == d2));
247
+ case OP_NE_BDD: VEC_ARG2(b_dest = (d1 != d2));
248
+
249
+ case OP_GT_BSS: VEC_ARG2(b_dest = (stringcmp(s1, s2, ss1, ss2) > 0));
250
+ case OP_GE_BSS: VEC_ARG2(b_dest = (stringcmp(s1, s2, ss1, ss2) >= 0));
251
+ case OP_EQ_BSS: VEC_ARG2(b_dest = (stringcmp(s1, s2, ss1, ss2) == 0));
252
+ case OP_NE_BSS: VEC_ARG2(b_dest = (stringcmp(s1, s2, ss1, ss2) != 0));
253
+
254
+ case OP_CONTAINS_BSS: VEC_ARG2(b_dest = stringcontains(s1, s2, ss1, ss2));
255
+
256
+ /* Int */
257
+ case OP_CAST_IB: VEC_ARG1(i_dest = (int)(b1));
258
+ case OP_ONES_LIKE_II: VEC_ARG0(i_dest = 1);
259
+ case OP_NEG_II: VEC_ARG1(i_dest = -i1);
260
+
261
+ case OP_ADD_III: VEC_ARG2(i_dest = i1 + i2);
262
+ case OP_SUB_III: VEC_ARG2(i_dest = i1 - i2);
263
+ case OP_MUL_III: VEC_ARG2(i_dest = i1 * i2);
264
+ case OP_DIV_III: VEC_ARG2(i_dest = i2 ? (i1 / i2) : 0);
265
+ case OP_POW_III: VEC_ARG2(i_dest = (i2 < 0) ? (1 / i1) : (int)pow((double)i1, i2));
266
+ case OP_MOD_III: VEC_ARG2(i_dest = i2 == 0 ? 0 :((i1 % i2) + i2) % i2);
267
+ case OP_LSHIFT_III: VEC_ARG2(i_dest = i1 << i2);
268
+ case OP_RSHIFT_III: VEC_ARG2(i_dest = i1 >> i2);
269
+
270
+ case OP_WHERE_IBII: VEC_ARG3(i_dest = b1 ? i2 : i3);
271
+
272
+ /* Long */
273
+ case OP_CAST_LI: VEC_ARG1(l_dest = (long long)(i1));
274
+ case OP_ONES_LIKE_LL: VEC_ARG0(l_dest = 1);
275
+ case OP_NEG_LL: VEC_ARG1(l_dest = -l1);
276
+
277
+ case OP_ADD_LLL: VEC_ARG2(l_dest = l1 + l2);
278
+ case OP_SUB_LLL: VEC_ARG2(l_dest = l1 - l2);
279
+ case OP_MUL_LLL: VEC_ARG2(l_dest = l1 * l2);
280
+ case OP_DIV_LLL: VEC_ARG2(l_dest = l2 ? (l1 / l2) : 0);
281
+ #if defined _MSC_VER && _MSC_VER < 1800
282
+ case OP_POW_LLL: VEC_ARG2(l_dest = (l2 < 0) ? (1 / l1) : (long long)pow((long double)l1, (long double)l2));
283
+ #else
284
+ case OP_POW_LLL: VEC_ARG2(l_dest = (l2 < 0) ? (1 / l1) : (long long)llround(pow((long double)l1, (long double)l2)));
285
+ #endif
286
+ case OP_MOD_LLL: VEC_ARG2(l_dest = l2 == 0 ? 0 :((l1 % l2) + l2) % l2);
287
+ case OP_LSHIFT_LLL: VEC_ARG2(l_dest = l1 << l2);
288
+ case OP_RSHIFT_LLL: VEC_ARG2(l_dest = l1 >> l2);
289
+
290
+ case OP_WHERE_LBLL: VEC_ARG3(l_dest = b1 ? l2 : l3);
291
+
292
+ /* Float */
293
+ case OP_CAST_FI: VEC_ARG1(f_dest = (float)(i1));
294
+ case OP_CAST_FL: VEC_ARG1(f_dest = (float)(l1));
295
+ case OP_ONES_LIKE_FF: VEC_ARG0(f_dest = 1.0);
296
+ case OP_NEG_FF: VEC_ARG1(f_dest = -f1);
297
+
298
+ case OP_ADD_FFF: VEC_ARG2(f_dest = f1 + f2);
299
+ case OP_SUB_FFF: VEC_ARG2(f_dest = f1 - f2);
300
+ case OP_MUL_FFF: VEC_ARG2(f_dest = f1 * f2);
301
+ case OP_DIV_FFF:
302
+ #ifdef USE_VML
303
+ VEC_ARG2_VML(vsDiv(BLOCK_SIZE,
304
+ (float*)x1, (float*)x2, (float*)dest));
305
+ #else
306
+ VEC_ARG2(f_dest = f1 / f2);
307
+ #endif
308
+ case OP_POW_FFF:
309
+ #ifdef USE_VML
310
+ VEC_ARG2_VML(vsPow(BLOCK_SIZE,
311
+ (float*)x1, (float*)x2, (float*)dest));
312
+ #else
313
+ VEC_ARG2(f_dest = powf(f1, f2));
314
+ #endif
315
+ case OP_MOD_FFF: VEC_ARG2(f_dest = f1 - floorf(f1/f2) * f2);
316
+
317
+ case OP_SQRT_FF:
318
+ #ifdef USE_VML
319
+ VEC_ARG1_VML(vsSqrt(BLOCK_SIZE, (float*)x1, (float*)dest));
320
+ #else
321
+ VEC_ARG1(f_dest = sqrtf(f1));
322
+ #endif
323
+
324
+ case OP_WHERE_FBFF: VEC_ARG3(f_dest = b1 ? f2 : f3);
325
+
326
+ case OP_FUNC_FFN:
327
+ #ifdef USE_VML
328
+ VEC_ARG1_VML(functions_ff_vml[arg2](BLOCK_SIZE,
329
+ (float*)x1, (float*)dest));
330
+ #else
331
+ VEC_ARG1(f_dest = functions_ff[arg2](f1));
332
+ #endif
333
+ case OP_FUNC_FFFN:
334
+ #ifdef USE_VML
335
+ VEC_ARG2_VML(functions_fff_vml[arg3](BLOCK_SIZE,
336
+ (float*)x1, (float*)x2,
337
+ (float*)dest));
338
+ #else
339
+ VEC_ARG2(f_dest = functions_fff[arg3](f1, f2));
340
+ #endif
341
+
342
+ /* Double */
343
+ case OP_CAST_DI: VEC_ARG1(d_dest = (double)(i1));
344
+ case OP_CAST_DL: VEC_ARG1(d_dest = (double)(l1));
345
+ case OP_CAST_DF: VEC_ARG1(d_dest = (double)(f1));
346
+ case OP_ONES_LIKE_DD: VEC_ARG0(d_dest = 1.0);
347
+ case OP_NEG_DD: VEC_ARG1(d_dest = -d1);
348
+
349
+ case OP_ADD_DDD: VEC_ARG2(d_dest = d1 + d2);
350
+ case OP_SUB_DDD: VEC_ARG2(d_dest = d1 - d2);
351
+ case OP_MUL_DDD: VEC_ARG2(d_dest = d1 * d2);
352
+ case OP_DIV_DDD:
353
+ #ifdef USE_VML
354
+ VEC_ARG2_VML(vdDiv(BLOCK_SIZE,
355
+ (double*)x1, (double*)x2, (double*)dest));
356
+ #else
357
+ VEC_ARG2(d_dest = d1 / d2);
358
+ #endif
359
+ case OP_POW_DDD:
360
+ #ifdef USE_VML
361
+ VEC_ARG2_VML(vdPow(BLOCK_SIZE,
362
+ (double*)x1, (double*)x2, (double*)dest));
363
+ #else
364
+ VEC_ARG2(d_dest = pow(d1, d2));
365
+ #endif
366
+ case OP_MOD_DDD: VEC_ARG2(d_dest = d1 - floor(d1/d2) * d2);
367
+
368
+ case OP_SQRT_DD:
369
+ #ifdef USE_VML
370
+ VEC_ARG1_VML(vdSqrt(BLOCK_SIZE, (double*)x1, (double*)dest));
371
+ #else
372
+ VEC_ARG1(d_dest = sqrt(d1));
373
+ #endif
374
+
375
+ case OP_WHERE_DBDD: VEC_ARG3(d_dest = b1 ? d2 : d3);
376
+
377
+ case OP_FUNC_DDN:
378
+ #ifdef USE_VML
379
+ VEC_ARG1_VML(functions_dd_vml[arg2](BLOCK_SIZE,
380
+ (double*)x1, (double*)dest));
381
+ #else
382
+ VEC_ARG1(d_dest = functions_dd[arg2](d1));
383
+ #endif
384
+ case OP_FUNC_DDDN:
385
+ #ifdef USE_VML
386
+ VEC_ARG2_VML(functions_ddd_vml[arg3](BLOCK_SIZE,
387
+ (double*)x1, (double*)x2,
388
+ (double*)dest));
389
+ #else
390
+ VEC_ARG2(d_dest = functions_ddd[arg3](d1, d2));
391
+ #endif
392
+
393
+ /* Complex */
394
+ case OP_CAST_CI: VEC_ARG1(cr_dest = (double)(i1);
395
+ ci_dest = 0);
396
+ case OP_CAST_CL: VEC_ARG1(cr_dest = (double)(l1);
397
+ ci_dest = 0);
398
+ case OP_CAST_CF: VEC_ARG1(cr_dest = f1;
399
+ ci_dest = 0);
400
+ case OP_CAST_CD: VEC_ARG1(cr_dest = d1;
401
+ ci_dest = 0);
402
+ case OP_ONES_LIKE_CC: VEC_ARG0(cr_dest = 1;
403
+ ci_dest = 0);
404
+ case OP_NEG_CC: VEC_ARG1(cr_dest = -c1r;
405
+ ci_dest = -c1i);
406
+
407
+ case OP_ADD_CCC: VEC_ARG2(cr_dest = c1r + c2r;
408
+ ci_dest = c1i + c2i);
409
+ case OP_SUB_CCC: VEC_ARG2(cr_dest = c1r - c2r;
410
+ ci_dest = c1i - c2i);
411
+ case OP_MUL_CCC: VEC_ARG2(da = c1r*c2r - c1i*c2i;
412
+ ci_dest = c1r*c2i + c1i*c2r;
413
+ cr_dest = da);
414
+ case OP_DIV_CCC:
415
+ #ifdef USE_VMLXXX /* VML complex division is slower */
416
+ VEC_ARG2_VML(vzDiv(BLOCK_SIZE, (const MKL_Complex16*)x1,
417
+ (const MKL_Complex16*)x2, (MKL_Complex16*)dest));
418
+ #else
419
+ VEC_ARG2(da = c2r*c2r + c2i*c2i;
420
+ db = (c1r*c2r + c1i*c2i) / da;
421
+ ci_dest = (c1i*c2r - c1r*c2i) / da;
422
+ cr_dest = db);
423
+ #endif
424
+ case OP_EQ_BCC: VEC_ARG2(b_dest = (c1r == c2r && c1i == c2i));
425
+ case OP_NE_BCC: VEC_ARG2(b_dest = (c1r != c2r || c1i != c2i));
426
+
427
+ case OP_WHERE_CBCC: VEC_ARG3(cr_dest = b1 ? c2r : c3r;
428
+ ci_dest = b1 ? c2i : c3i);
429
+ case OP_FUNC_CCN:
430
+ #ifdef USE_VML
431
+ VEC_ARG1_VML(functions_cc_vml[arg2](BLOCK_SIZE,
432
+ (const MKL_Complex16*)x1,
433
+ (MKL_Complex16*)dest));
434
+ #else
435
+ VEC_ARG1(ca.real(c1r);
436
+ ca.imag(c1i);
437
+ functions_cc[arg2](&ca, &ca);
438
+ cr_dest = ca.real();
439
+ ci_dest = ca.imag());
440
+ #endif
441
+ case OP_FUNC_CCCN: VEC_ARG2(ca.real(c1r);
442
+ ca.imag(c1i);
443
+ cb.real(c2r);
444
+ cb.imag(c2i);
445
+ functions_ccc[arg3](&ca, &cb, &ca);
446
+ cr_dest = ca.real();
447
+ ci_dest = ca.imag());
448
+
449
+ case OP_REAL_DC: VEC_ARG1(d_dest = c1r);
450
+ case OP_IMAG_DC: VEC_ARG1(d_dest = c1i);
451
+ case OP_COMPLEX_CDD: VEC_ARG2(cr_dest = d1;
452
+ ci_dest = d2);
453
+
454
+ /* Reductions */
455
+ case OP_SUM_IIN: VEC_ARG1(i_reduce += i1);
456
+ case OP_SUM_LLN: VEC_ARG1(l_reduce += l1);
457
+ case OP_SUM_FFN: VEC_ARG1(f_reduce += f1);
458
+ case OP_SUM_DDN: VEC_ARG1(d_reduce += d1);
459
+ case OP_SUM_CCN: VEC_ARG1(cr_reduce += c1r;
460
+ ci_reduce += c1i);
461
+
462
+ case OP_PROD_IIN: VEC_ARG1(i_reduce *= i1);
463
+ case OP_PROD_LLN: VEC_ARG1(l_reduce *= l1);
464
+ case OP_PROD_FFN: VEC_ARG1(f_reduce *= f1);
465
+ case OP_PROD_DDN: VEC_ARG1(d_reduce *= d1);
466
+ case OP_PROD_CCN: VEC_ARG1(da = cr_reduce*c1r - ci_reduce*c1i;
467
+ ci_reduce = cr_reduce*c1i + ci_reduce*c1r;
468
+ cr_reduce = da);
469
+
470
+ case OP_MIN_IIN: VEC_ARG1(i_reduce = fmin(i_reduce, i1));
471
+ case OP_MIN_LLN: VEC_ARG1(l_reduce = fmin(l_reduce, l1));
472
+ case OP_MIN_FFN: VEC_ARG1(f_reduce = fmin(f_reduce, f1));
473
+ case OP_MIN_DDN: VEC_ARG1(d_reduce = fmin(d_reduce, d1));
474
+
475
+ case OP_MAX_IIN: VEC_ARG1(i_reduce = fmax(i_reduce, i1));
476
+ case OP_MAX_LLN: VEC_ARG1(l_reduce = fmax(l_reduce, l1));
477
+ case OP_MAX_FFN: VEC_ARG1(f_reduce = fmax(f_reduce, f1));
478
+ case OP_MAX_DDN: VEC_ARG1(d_reduce = fmax(d_reduce, d1));
479
+
480
+ default:
481
+ *pc_error = pc;
482
+ return -3;
483
+ break;
484
+ }
485
+ }
486
+
487
+ #ifndef NO_OUTPUT_BUFFERING
488
+ // If output buffering was necessary, copy the buffer to the output
489
+ if(params.out_buffer != NULL) {
490
+ memcpy(iter_dataptr[0], params.out_buffer, params.memsizes[0] * BLOCK_SIZE);
491
+ }
492
+ #endif // NO_OUTPUT_BUFFERING
493
+
494
+ #undef VEC_LOOP
495
+ #undef VEC_ARG1
496
+ #undef VEC_ARG2
497
+ #undef VEC_ARG3
498
+
499
+ #undef i_reduce
500
+ #undef l_reduce
501
+ #undef f_reduce
502
+ #undef d_reduce
503
+ #undef cr_reduce
504
+ #undef ci_reduce
505
+ #undef b_dest
506
+ #undef i_dest
507
+ #undef l_dest
508
+ #undef f_dest
509
+ #undef d_dest
510
+ #undef cr_dest
511
+ #undef ci_dest
512
+ #undef s_dest
513
+ #undef b1
514
+ #undef i1
515
+ #undef l1
516
+ #undef f1
517
+ #undef d1
518
+ #undef c1r
519
+ #undef c1i
520
+ #undef s1
521
+ #undef b2
522
+ #undef i2
523
+ #undef l2
524
+ #undef f2
525
+ #undef d2
526
+ #undef c2r
527
+ #undef c2i
528
+ #undef s2
529
+ #undef b3
530
+ #undef i3
531
+ #undef l3
532
+ #undef f3
533
+ #undef d3
534
+ #undef c3r
535
+ #undef c3i
536
+ #undef s3
537
+ }
538
+
539
+ /*
540
+ Local Variables:
541
+ c-basic-offset: 4
542
+ End:
543
+ */
Binary file