11 #ifndef __VM_BasicFunc__
12 #define __VM_BasicFunc__
28 v8sf(
float a0,
float a1,
float a2,
float a3,
29 float a4,
float a5,
float a6,
float a7)
41 operator v8si()
const;
62 operator v8sf()
const;
67 v8sf::operator
v8si()
const
73 v8si::operator
v8sf()
const
78 #define V8SF(A) (v8sf)A
79 #define V8SI(A) (v8si)A
81 #define vm_BASIC_IFF_AVX(OP) \
83 r.i[0] = a.f[0] OP b.f[0]; \
84 r.i[1] = a.f[1] OP b.f[1]; \
85 r.i[2] = a.f[2] OP b.f[2]; \
86 r.i[3] = a.f[3] OP b.f[3]; \
87 r.i[4] = a.f[4] OP b.f[4]; \
88 r.i[5] = a.f[5] OP b.f[5]; \
89 r.i[6] = a.f[6] OP b.f[6]; \
90 r.i[7] = a.f[7] OP b.f[7]; \
93 #define vm_BASIC_CF_AVX(OP) \
95 r.i[0] = a.f[0] OP b.f[0] ? 0xFFFFFFFF : 0; \
96 r.i[1] = a.f[1] OP b.f[1] ? 0xFFFFFFFF : 0; \
97 r.i[2] = a.f[2] OP b.f[2] ? 0xFFFFFFFF : 0; \
98 r.i[3] = a.f[3] OP b.f[3] ? 0xFFFFFFFF : 0; \
99 r.i[4] = a.f[4] OP b.f[4] ? 0xFFFFFFFF : 0; \
100 r.i[5] = a.f[5] OP b.f[5] ? 0xFFFFFFFF : 0; \
101 r.i[6] = a.f[6] OP b.f[6] ? 0xFFFFFFFF : 0; \
102 r.i[7] = a.f[7] OP b.f[7] ? 0xFFFFFFFF : 0; \
105 #define vm_BASIC_CI_AVX(OP) \
107 r.i[0] = a.i[0] OP b.i[0] ? 0xFFFFFFFF : 0; \
108 r.i[1] = a.i[1] OP b.i[1] ? 0xFFFFFFFF : 0; \
109 r.i[2] = a.i[2] OP b.i[2] ? 0xFFFFFFFF : 0; \
110 r.i[3] = a.i[3] OP b.i[3] ? 0xFFFFFFFF : 0; \
111 r.i[4] = a.i[4] OP b.i[4] ? 0xFFFFFFFF : 0; \
112 r.i[5] = a.i[5] OP b.i[5] ? 0xFFFFFFFF : 0; \
113 r.i[6] = a.i[6] OP b.i[6] ? 0xFFFFFFFF : 0; \
114 r.i[7] = a.i[7] OP b.i[7] ? 0xFFFFFFFF : 0; \
117 #define vm_BASIC_III_AVX(OP) \
119 r.i[0] = a.i[0] OP b.i[0]; \
120 r.i[1] = a.i[1] OP b.i[1]; \
121 r.i[2] = a.i[2] OP b.i[2]; \
122 r.i[3] = a.i[3] OP b.i[3]; \
123 r.i[4] = a.i[4] OP b.i[4]; \
124 r.i[5] = a.i[5] OP b.i[5]; \
125 r.i[6] = a.i[6] OP b.i[6]; \
126 r.i[7] = a.i[7] OP b.i[7]; \
129 #define vm_BASIC_FFF_AVX(OP) \
131 r.f[0] = a.f[0] OP b.f[0]; \
132 r.f[1] = a.f[1] OP b.f[1]; \
133 r.f[2] = a.f[2] OP b.f[2]; \
134 r.f[3] = a.f[3] OP b.f[3]; \
135 r.f[4] = a.f[4] OP b.f[4]; \
136 r.f[5] = a.f[5] OP b.f[5]; \
137 r.f[6] = a.f[6] OP b.f[6]; \
138 r.f[7] = a.f[7] OP b.f[7]; \
141 #define vm_BASIC_FFFF_AVX(OP1, OP2) \
143 r.f[0] = a.f[0] OP1 b.f[0] OP2 c.f[0]; \
144 r.f[1] = a.f[1] OP1 b.f[1] OP2 c.f[1]; \
145 r.f[2] = a.f[2] OP1 b.f[2] OP2 c.f[2]; \
146 r.f[3] = a.f[3] OP1 b.f[3] OP2 c.f[3]; \
147 r.f[4] = a.f[4] OP1 b.f[4] OP2 c.f[4]; \
148 r.f[5] = a.f[5] OP1 b.f[5] OP2 c.f[5]; \
149 r.f[6] = a.f[6] OP1 b.f[6] OP2 c.f[6]; \
150 r.f[7] = a.f[7] OP1 b.f[7] OP2 c.f[7]; \
153 #define vm_BASIC_UFuncF_AVX(FUNC) \
155 r.f[0] = FUNC(a.f[0]); \
156 r.f[1] = FUNC(a.f[1]); \
157 r.f[2] = FUNC(a.f[2]); \
158 r.f[3] = FUNC(a.f[3]); \
159 r.f[4] = FUNC(a.f[4]); \
160 r.f[5] = FUNC(a.f[5]); \
161 r.f[6] = FUNC(a.f[6]); \
162 r.f[7] = FUNC(a.f[7]); \
165 #define vm_BASIC_UFuncFF_AVX(FUNC) \
167 r.f[0] = FUNC(a.f[0], b.f[0]); \
168 r.f[1] = FUNC(a.f[1], b.f[1]); \
169 r.f[2] = FUNC(a.f[2], b.f[2]); \
170 r.f[3] = FUNC(a.f[3], b.f[3]); \
171 r.f[4] = FUNC(a.f[4], b.f[4]); \
172 r.f[5] = FUNC(a.f[5], b.f[5]); \
173 r.f[6] = FUNC(a.f[6], b.f[6]); \
174 r.f[7] = FUNC(a.f[7], b.f[7]); \
206 r.
i[0] = ~a.
i[0] & b.
i[0];
207 r.
i[1] = ~a.
i[1] & b.
i[1];
208 r.
i[2] = ~a.
i[2] & b.
i[2];
209 r.
i[3] = ~a.
i[3] & b.
i[3];
210 r.
i[4] = ~a.
i[4] & b.
i[4];
211 r.
i[5] = ~a.
i[5] & b.
i[5];
212 r.
i[6] = ~a.
i[6] & b.
i[6];
213 r.
i[7] = ~a.
i[7] & b.
i[7];
231 static inline v8si vm_floor_avx(
const v8sf &
a)
234 r.
i[0] = (
int)SYSfastFloor(a.
f[0]);
235 r.
i[1] = (
int)SYSfastFloor(a.
f[1]);
236 r.
i[2] = (
int)SYSfastFloor(a.
f[2]);
237 r.
i[3] = (
int)SYSfastFloor(a.
f[3]);
238 r.
i[4] = (
int)SYSfastFloor(a.
f[4]);
239 r.
i[5] = (
int)SYSfastFloor(a.
f[5]);
240 r.
i[6] = (
int)SYSfastFloor(a.
f[6]);
241 r.
i[7] = (
int)SYSfastFloor(a.
f[7]);
245 static inline v8si vm_intcast_avx(
const v8sf &a)
248 r.
i[0] = (
int)a.
f[0];
249 r.
i[1] = (
int)a.
f[1];
250 r.
i[2] = (
int)a.
f[2];
251 r.
i[3] = (
int)a.
f[3];
252 r.
i[4] = (
int)a.
f[4];
253 r.
i[5] = (
int)a.
f[5];
254 r.
i[6] = (
int)a.
f[6];
255 r.
i[7] = (
int)a.
f[7];
259 static inline v8sf vm_floatcast_avx(
const v8si &a)
263 r.
f[1] = (
float)a.
i[1];
265 r.
f[3] = (
float)a.
i[3];
267 r.
f[5] = (
float)a.
i[5];
269 r.
f[7] = (
float)a.
i[7];
280 vm_splats_avx(
int32 a)
286 vm_splats_avx(
float a)
295 return v8si(a, b, c, d, e, f, g, h);
302 return v8si(a, b, c, d, e, f, g, h);
306 vm_splats_avx(
float a,
float b,
float c,
float d,
307 float e,
float f,
float g,
float h)
309 return v8sf(a, b, c, d, e, f, g, h);
313 vm_allbits_avx(
const v8si &a)
315 return (a.
i[0] & a.
i[1] & a.
i[2] & a.
i[3] &
316 a.
i[4] & a.
i[5] & a.
i[6] & a.
i[7]) == 0xFFFFFFFF;
319 template <
int A,
int B,
int C,
int D>
321 vm_shuffle_avx(
const v8sf &
v)
338 vm_load_avx(
const int32 v[8])
340 return v8si(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
344 vm_load_avx(
const float v[8])
346 return v8sf(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
374 vm_insert_avx(
const v8sf v,
float a,
int n)
384 vm_extract_avx(
const v8si v,
int n)
390 vm_extract_avx(
const v8sf v,
int n)
396 vm_shiftleft_avx(
const v8si& a,
int c)
411 vm_shiftright_avx(
const v8si& a,
int c)
425 #define VM_EXTRACT_AVX vm_extract_avx
426 #define VM_INSERT_AVX vm_insert_avx
427 #define VM_SPLATS_AVX vm_splats_avx
428 #define VM_LOAD_AVX vm_load_avx
429 #define VM_STORE_AVX vm_store_avx
431 #define VM_CMPLT_AVX vm_clt_avx
432 #define VM_CMPLE_AVX vm_cle_avx
433 #define VM_CMPGT_AVX vm_cgt_avx
434 #define VM_CMPGE_AVX vm_cge_avx
435 #define VM_CMPEQ_AVX vm_ceq_avx
436 #define VM_CMPNE_AVX vm_cne_avx
438 #define VM_ICMPLT_AVX vm_clt_avx
439 #define VM_ICMPGT_AVX vm_cgt_avx
440 #define VM_ICMPEQ_AVX vm_ceq_avx
442 #define VM_IADD_AVX vm_add_avx
443 #define VM_ISUB_AVX vm_sub_avx
445 #define VM_ADD_AVX vm_add_avx
446 #define VM_SUB_AVX vm_sub_avx
447 #define VM_MUL_AVX vm_mul_avx
448 #define VM_DIV_AVX vm_div_avx
449 #define VM_FDIV_AVX vm_div_avx
450 #define VM_NEG_AVX vm_negate_avx
451 #define VM_SQRT_AVX vm_sqrt_avx
452 #define VM_FSQRT_AVX vm_sqrt_avx
453 #define VM_ISQRT_AVX vm_isqrt_avx
454 #define VM_ABS_AVX vm_abs_avx
456 #define VM_MADD_AVX vm_madd_avx
457 #define VM_INVERT_AVX vm_reciprocal_avx
459 #define VM_MIN_AVX vm_min_avx
460 #define VM_MAX_AVX vm_max_avx
462 #define VM_AND_AVX vm_and_avx
463 #define VM_ANDNOT_AVX vm_andnot_avx
464 #define VM_OR_AVX vm_or_avx
465 #define VM_XOR_AVX vm_xor_avx
467 #define VM_ALLBITS_AVX vm_allbits_avx
469 #define VM_SHUFFLE_AVX vm_shuffle_avx
471 #define VM_P_FLOOR_AVX()
472 #define VM_FLOOR_AVX vm_floor_avx
473 #define VM_E_FLOOR_AVX()
475 #define VM_INT_AVX vm_intcast_avx
477 #define VM_IFLOAT_AVX vm_floatcast_avx
480 #define VM_SHIFTLEFT_AVX(A,C) vm_shiftleft_avx(A,C)
481 #define VM_SHIFTRIGHT_AVX(A,C) vm_shiftright_avx(A,C)
486 for (
int i = 0; i < 8; i++)
487 SYSsincos(x.
f[i], s->
f + i, c->
f + i);
494 vm_sincos_avx(x,&s,&c);
502 vm_sincos_avx(x,&s,&c);
510 vm_sincos_avx(x,&s,&c);
511 return vm_div_avx(s, c);
514 #define VM_SINCOS_AVX vm_sincos_avx
515 #define VM_SIN_AVX vm_sin_avx
516 #define VM_COS_AVX vm_cos_avx
517 #define VM_TAN_AVX vm_tan_avx
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
#define vm_BASIC_FFFF_AVX(OP1, OP2)
v8sf(float a0, float a1, float a2, float a3, float a4, float a5, float a6, float a7)
GLboolean GLboolean GLboolean GLboolean a
#define vm_BASIC_CF_AVX(OP)
#define vm_BASIC_UFuncFF_AVX(FUNC)
v8si(int32 a0, int32 a1, int32 a2, int32 a3, int32 a4, int32 a5, int32 a6, int32 a7)
IMATH_NAMESPACE::V2f float
GLboolean GLboolean GLboolean b
#define vm_BASIC_UFuncF_AVX(FUNC)
GLfloat GLfloat GLfloat GLfloat h
#define vm_BASIC_FFF_AVX(OP)
#define vm_BASIC_CI_AVX(OP)
#define vm_BASIC_III_AVX(OP)