STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ivec.h
Go to the documentation of this file.
1 /***
2 *** Copyright (C) 1985-2011 Intel Corporation. All rights reserved.
3 ***
4 *** The information and source code contained herein is the exclusive
5 *** property of Intel Corporation and may not be disclosed, examined
6 *** or reproduced in whole or in part without explicit written authorization
7 *** from the company.
8 ***
9 ****/
10 
11 /*
12  * Definition of a C++ class interface to MMX(TM) instruction intrinsics.
13  *
14  */
15 
16 #ifndef _IVEC_H_INCLUDED
17 #define _IVEC_H_INCLUDED
18 #ifndef RC_INVOKED
19 
20 #if !defined __cplusplus
21  #error ERROR: This file is only supported in C++ compilations!
22 #endif /* !defined __cplusplus */
23 
24 #if defined (_M_CEE_PURE)
25  #error ERROR: This file is not supported in the pure mode!
26 #else /* defined (_M_CEE_PURE) */
27 
28 #include <mmintrin.h>
29 
30 #define EXPLICIT explicit
31 
32 #ifndef _VEC_ASSERT
33  #include <crtdefs.h>
34 
35 #ifdef NDEBUG
36  #define _VEC_ASSERT(_Expression) ((void)0)
37 #else /* NDEBUG */
38 #ifdef __cplusplus
39  extern "C" {
40 #endif /* __cplusplus */
41 
42  _CRTIMP void __cdecl _wassert(_In_z_ const wchar_t * _Message, _In_z_ const wchar_t *_File, _In_ unsigned _Line);
43 #ifdef __cplusplus
44  }
45 #endif /* __cplusplus */
46 
47  #define _VEC_ASSERT(_Expression) (void)( (!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression), _CRT_WIDE(__FILE__), __LINE__), 0) )
48 #endif /* NDEBUG */
49 #endif /* _VEC_ASSERT */
50 
51 /*
52  * Define _SILENCE_IVEC_C4799 to disable warning C4799 inside this header.
53  * Be careful that any code that uses these functions properly executes EMMS
54  * or _m_empty() after using any MMX instruction and before using the x87 NDP.
55  */
56 #if defined (_SILENCE_IVEC_C4799)
57  #pragma warning(push)
58  #pragma warning(disable: 4799)
59 #endif /* defined (_SILENCE_IVEC_C4799) */
60 
61 /*
62  * Define _ENABLE_VEC_DEBUG to enable std::ostream inserters for debug output
63  */
64 #if defined (_ENABLE_VEC_DEBUG)
65  #include <iostream>
66 #endif /* defined (_ENABLE_VEC_DEBUG) */
67 
68 class I8vec8; /* 8 elements, each element a signed or unsigned char data type */
69 class Is8vec8; /* 8 elements, each element a signed char data type */
70 class Iu8vec8; /* 8 elements, each element an unsigned char data type */
71 class I16vec4; /* 4 elements, each element a signed or unsigned short */
72 class Is16vec4; /* 4 elements, each element a signed short */
73 class Iu16vec4; /* 4 elements, each element an unsigned short */
74 class I32vec2; /* 2 elements, each element a signed or unsigned long */
75 class Is32vec2; /* 2 elements, each element a signed long */
76 class Iu32vec2; /* 2 elements, each element a unsigned long */
77 class I64vec1; /* 1 element, a __m64 data type - Base I64vec1 class */
78 
79 #define _MM_8UB(element,vector) (*((unsigned char*)&##vector + ##element))
80 #define _MM_8B(element,vector) (*((signed char*)&##vector + ##element))
81 
82 #define _MM_4UW(element,vector) (*((unsigned short*)&##vector + ##element))
83 #define _MM_4W(element,vector) (*((short*)&##vector + ##element))
84 
85 #define _MM_2UDW(element,vector) (*((unsigned int*)&##vector + ##element))
86 #define _MM_2DW(element,vector) (*((int*)&##vector + ##element))
87 
88 #define _MM_QW (*((__int64*)&vec))
89 
90 /* M64 Class:
91  * 1 element, a __m64 data type
92  * Contructors & Logical Operations
93  */
94 class M64
95 {
96 protected:
98 
99 public:
100  M64() { }
101  M64(__m64 mm) { vec = mm; }
102  M64(__int64 mm) { vec = _mm_set_pi32((int)(mm >> 32), (int)mm); }
103  M64(int i) { vec = _m_from_int(i); }
104 
105  operator __m64() const { return vec; }
106 
107  /* Logical Operations */
108  M64& operator&=(const M64 &a) { return *this = (M64) _m_pand(vec,a); }
109  M64& operator|=(const M64 &a) { return *this = (M64) _m_por(vec,a); }
110  M64& operator^=(const M64 &a) { return *this = (M64) _m_pxor(vec,a); }
111 
112 };
113 
114 const union {__int64 m1; __m64 m2;} __mmx_all_ones_cheat =
115  {0xffffffffffffffff};
116 
117 #define _mmx_all_ones ((M64)__mmx_all_ones_cheat.m2)
118 
119 inline M64 operator&(const M64 &a, const M64 &b) { return _m_pand( a,b); }
120 inline M64 operator|(const M64 &a, const M64 &b) { return _m_por(a,b); }
121 inline M64 operator^(const M64 &a, const M64 &b) { return _m_pxor(a,b); }
122 inline M64 andnot(const M64 &a, const M64 &b) { return _m_pandn(a,b); }
123 
124 /* I64vec1 Class:
125  * 1 element, a __m64 data type
126  * Contains Operations which can operate on any __m64 data type
127  */
128 
129 class I64vec1 : public M64
130 {
131 public:
132  I64vec1() { }
133  I64vec1(__m64 mm) : M64(mm) { }
134  EXPLICIT I64vec1(int i) : M64(i) { }
135  EXPLICIT I64vec1(__int64 mm) : M64(mm) { }
136 
137  I64vec1& operator= (const M64 &a) { return *this = (I64vec1) a; }
138  I64vec1& operator&=(const M64 &a) { return *this = (I64vec1) _m_pand(vec,a); }
139  I64vec1& operator|=(const M64 &a) { return *this = (I64vec1) _m_por(vec,a); }
140  I64vec1& operator^=(const M64 &a) { return *this = (I64vec1) _m_pxor(vec,a); }
141 
142  /* Shift Logical Operations */
143  I64vec1 operator<<(const M64 &a) { return _m_psllq(vec, a); }
144  I64vec1 operator<<(int count) { return _m_psllqi(vec, count); }
145  I64vec1& operator<<=(const M64 &a) { return *this = (I64vec1) _m_psllq(vec, a); }
146  I64vec1& operator<<=(int count) { return *this = (I64vec1) _m_psllqi(vec, count); }
147  I64vec1 operator>>(const M64 &a) { return _m_psrlq(vec, a); }
148  I64vec1 operator>>(int count) { return _m_psrlqi(vec, count); }
149  I64vec1& operator>>=(const M64 &a) { return *this = (I64vec1) _m_psrlq(vec, a); }
150  I64vec1& operator>>=(int count) { return *this = (I64vec1) _m_psrlqi(vec, count); }
151 };
152 
153 /* I32vec2 Class:
154  * 2 elements, each element either a signed or unsigned int
155  */
156 class I32vec2 : public M64
157 {
158 public:
159  I32vec2() { }
160  I32vec2(__m64 mm) : M64(mm) { }
161  I32vec2(int i0, int i1) { vec = _mm_set_pi32(i0, i1); }
162  EXPLICIT I32vec2(int i) : M64 (i) { }
163  EXPLICIT I32vec2(__int64 i): M64(i) {}
164 
165  /* Assignment Operator */
166  I32vec2& operator= (const M64 &a) { return *this = (I32vec2) a; }
167 
168  /* Logical Assignment Operators */
169  I32vec2& operator&=(const M64 &a) { return *this = (I32vec2) _m_pand(vec,a); }
170  I32vec2& operator|=(const M64 &a) { return *this = (I32vec2) _m_por(vec,a); }
171  I32vec2& operator^=(const M64 &a) { return *this = (I32vec2) _m_pxor(vec,a); }
172 
173  /* Addition & Subtraction Assignment Operators */
174  I32vec2& operator +=(const I32vec2 &a) { return *this = (I32vec2) _m_paddd(vec,a); }
175  I32vec2& operator -=(const I32vec2 &a) { return *this = (I32vec2) _m_psubd(vec,a); }
176 
177  /* Shift Logical Operators */
178  I32vec2 operator<<(const I32vec2 &a) { return _m_pslld(vec,a); }
179  I32vec2 operator<<(int count) { return _m_pslldi(vec,count); }
180  I32vec2& operator<<=(const I32vec2 &a) { return *this = (I32vec2) _m_pslld(vec,a); }
181  I32vec2& operator<<=(int count) { return *this = (I32vec2) _m_pslldi(vec,count); }
182 
183 };
184 
185 /* Compare For Equality */
186 inline I32vec2 cmpeq(const I32vec2 &a, const I32vec2 &b) { return _m_pcmpeqd(a,b); }
187 inline I32vec2 cmpneq(const I32vec2 &a, const I32vec2 &b) { return _m_pandn(_m_pcmpeqd(a,b), _mmx_all_ones); }
188 /* Unpacks */
189 inline I32vec2 unpack_low(const I32vec2 &a, const I32vec2 &b) {return _m_punpckldq(a,b); }
190 inline I32vec2 unpack_high(const I32vec2 &a, const I32vec2 &b) {return _m_punpckhdq(a,b); }
191 
192 /* Is32vec2 Class:
193  * 2 elements, each element a signed int
194  */
195 class Is32vec2 : public I32vec2
196 {
197 public:
198  Is32vec2() { }
199  Is32vec2(__m64 mm) : I32vec2(mm) { }
200  Is32vec2(signed int i0, signed int i1) : I32vec2(i0, i1) {}
201  EXPLICIT Is32vec2(int i) : I32vec2 (i) {}
202  EXPLICIT Is32vec2(__int64 i): I32vec2(i) {}
203 
204  /* Assignment Operator */
205  Is32vec2& operator= (const M64 &a) { return *this = (Is32vec2) a; }
206 
207  /* Logical Assignment Operators */
208  Is32vec2& operator&=(const M64 &a) { return *this = (Is32vec2) _m_pand(vec,a); }
209  Is32vec2& operator|=(const M64 &a) { return *this = (Is32vec2) _m_por(vec,a); }
210  Is32vec2& operator^=(const M64 &a) { return *this = (Is32vec2) _m_pxor(vec,a); }
211 
212  /* Addition & Subtraction Assignment Operators */
213  Is32vec2& operator +=(const I32vec2 &a) { return *this = (Is32vec2) _m_paddd(vec,a); }
214  Is32vec2& operator -=(const I32vec2 &a) { return *this = (Is32vec2) _m_psubd(vec,a); }
215 
216  /* Shift Logical Operators */
217  Is32vec2 operator<<(const M64 &a) { return _m_pslld(vec,a); }
218  Is32vec2 operator<<(int count) { return _m_pslldi(vec,count); }
219  Is32vec2& operator<<=(const M64 &a) { return *this = (Is32vec2) _m_pslld(vec,a); }
220  Is32vec2& operator<<=(int count) { return *this = (Is32vec2) _m_pslldi(vec,count); }
221  /* Shift Arithmetic Operations */
222  Is32vec2 operator>>(const M64 &a) { return _m_psrad(vec, a); }
223  Is32vec2 operator>>(int count) { return _m_psradi(vec, count); }
224  Is32vec2& operator>>=(const M64 &a) { return *this = (Is32vec2) _m_psrad(vec, a); }
225  Is32vec2& operator>>=(int count) { return *this = (Is32vec2) _m_psradi(vec, count); }
226 
227 #if defined (_ENABLE_VEC_DEBUG)
228  /* Output for Debug */
229  friend std::ostream& operator<< (std::ostream &os, const Is32vec2 &a)
230  {
231  os << " [1]:" << _MM_2DW(1,a)
232  << " [0]:" << _MM_2DW(0,a);
233  return os;
234  }
235 #endif /* defined (_ENABLE_VEC_DEBUG) */
236 
237  /* Element Access for Debug, No data modified */
238  const int& operator[](int i)const
239  {
240  _VEC_ASSERT(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
241  return _MM_2DW(i,vec);
242  }
243 
244  /* Element Access and Assignment for Debug */
245  int& operator[](int i)
246  {
247  _VEC_ASSERT(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
248  return _MM_2DW(i,vec);
249  }
250 };
251 
252 /* Compares */
253 inline Is32vec2 cmpeq(const Is32vec2 &a, const Is32vec2 &b) { return _m_pcmpeqd(a,b); }
254 inline Is32vec2 cmpneq(const Is32vec2 &a, const Is32vec2 &b) { return _m_pandn(_m_pcmpeqd(a,b), _mmx_all_ones); }
255 inline Is32vec2 cmpgt(const Is32vec2 &a, const Is32vec2 &b) { return _m_pcmpgtd(a,b); }
256 inline Is32vec2 cmplt(const Is32vec2 &a, const Is32vec2 &b) { return _m_pcmpgtd(b,a); }
257 inline Is32vec2 cmple(const Is32vec2 &a, const Is32vec2 &b) { return _m_pandn(_m_pcmpgtd(a,b), _mmx_all_ones); }
258 inline Is32vec2 cmpge(const Is32vec2 &a, const Is32vec2 &b) { return _m_pandn(_m_pcmpgtd(b,a), _mmx_all_ones); }
259 /* Unpacks & Pack */
260 inline Is32vec2 unpack_low(const Is32vec2 &a, const Is32vec2 &b) { return _m_punpckldq(a,b); }
261 inline Is32vec2 unpack_high(const Is32vec2 &a, const Is32vec2 &b) { return _m_punpckhdq(a,b); }
262 
263 /* Iu32vec2 Class:
264  * 2 elements, each element unsigned int
265  */
266 class Iu32vec2 : public I32vec2
267 {
268 public:
269  Iu32vec2() { }
270  Iu32vec2(__m64 mm) : I32vec2(mm) { }
271  Iu32vec2(unsigned int i0, unsigned int i1) : I32vec2(i0, i1) {}
272  EXPLICIT Iu32vec2(int i) : I32vec2 (i) { }
273  EXPLICIT Iu32vec2(__int64 i) : I32vec2 (i) { }
274 
275  /* Assignment Operator */
276  Iu32vec2& operator= (const M64 &a) { return *this = (Iu32vec2) a; }
277 
278  /* Logical Assignment Operators */
279  Iu32vec2& operator&=(const M64 &a) { return *this = (Iu32vec2) _m_pand(vec,a); }
280  Iu32vec2& operator|=(const M64 &a) { return *this = (Iu32vec2) _m_por(vec,a); }
281  Iu32vec2& operator^=(const M64 &a) { return *this = (Iu32vec2) _m_pxor(vec,a); }
282 
283  /* Addition & Subtraction Assignment Operators */
284  Iu32vec2& operator +=(const I32vec2 &a) { return *this = (Iu32vec2) _m_paddd(vec,a); }
285  Iu32vec2& operator -=(const I32vec2 &a) { return *this = (Iu32vec2) _m_psubd(vec,a); }
286 
287  /* Shift Logical Operators */
288  Iu32vec2 operator<<(const M64 &a) { return _m_pslld(vec,a); }
289  Iu32vec2 operator<<(int count) { return _m_pslldi(vec,count); }
290  Iu32vec2& operator<<=(const M64 &a) { return *this = (Iu32vec2) _m_pslld(vec,a); }
291  Iu32vec2& operator<<=(int count) { return *this = (Iu32vec2) _m_pslldi(vec,count); }
292  Iu32vec2 operator>>(const M64 &a) { return _m_psrld(vec,a); }
293  Iu32vec2 operator>>(int count) { return _m_psrldi(vec,count); }
294  Iu32vec2& operator>>=(const M64 &a) { return *this = (Iu32vec2) _m_psrld(vec,a); }
295  Iu32vec2& operator>>=(int count) { return *this = (Iu32vec2) _m_psrldi(vec,count); }
296 
297 #if defined (_ENABLE_VEC_DEBUG)
298  /* Output for Debug */
299  friend std::ostream& operator<< (std::ostream &os, const Iu32vec2 &a)
300  {
301  os << "[1]:" << _MM_2UDW(1,a)
302  << " [0]:" << _MM_2UDW(0,a);
303  return os;
304  }
305 #endif /* defined (_ENABLE_VEC_DEBUG) */
306 
307  /* Element Access for Debug, No data modified */
308  const unsigned int& operator[](int i)const
309  {
310  _VEC_ASSERT(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
311  return _MM_2UDW(i,vec);
312  }
313 
314  /* Element Access and Assignment for Debug */
315  unsigned int& operator[](int i)
316  {
317  _VEC_ASSERT(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
318  return _MM_2UDW(i,vec);
319  }
320 };
321 
322 /* Compares For Equality / Inequality */
323 inline Iu32vec2 cmpeq(const Iu32vec2 &a, const Iu32vec2 &b) { return _m_pcmpeqd(a,b); }
324 inline Iu32vec2 cmpneq(const Iu32vec2 &a, const Iu32vec2 &b) { return _m_pandn(_m_pcmpeqd(a,b), _mmx_all_ones); }
325 /* Unpacks */
326 inline Iu32vec2 unpack_low(const Iu32vec2 &a, const Iu32vec2 &b) {return _m_punpckldq(a,b); }
327 inline Iu32vec2 unpack_high(const Iu32vec2 &a, const Iu32vec2 &b) {return _m_punpckhdq(a,b); }
328 
329 /* I16vec4 Class:
330  * 4 elements, each element either a signed or unsigned short
331  */
332 class I16vec4 : public M64
333 {
334 public:
335  I16vec4() { }
336  I16vec4(__m64 mm) : M64(mm) { }
337  I16vec4(short i0, short i1, short i2, short i3)
338  {
339  vec = _mm_set_pi16(i0, i1, i2, i3);
340  }
341  EXPLICIT I16vec4(__int64 i) : M64 (i) { }
342  EXPLICIT I16vec4(int i) : M64 (i) { }
343 
344  /* Assignment Operator */
345  I16vec4& operator= (const M64 &a) { return *this = (I16vec4) a; }
346 
347  /* Addition & Subtraction Assignment Operators */
348  I16vec4& operator&=(const M64 &a) { return *this = (I16vec4) _m_pand(vec,a); }
349  I16vec4& operator|=(const M64 &a) { return *this = (I16vec4) _m_por(vec,a); }
350  I16vec4& operator^=(const M64 &a) { return *this = (I16vec4) _m_pxor(vec,a); }
351 
352  /* Addition & Subtraction Assignment Operators */
353  I16vec4& operator +=(const I16vec4 &a) { return *this = (I16vec4)_m_paddw(vec,a); }
354  I16vec4& operator -=(const I16vec4 &a) { return *this = (I16vec4)_m_psubw(vec,a); }
355  I16vec4& operator *=(const I16vec4 &a) { return *this = (I16vec4)_m_pmullw(vec,a); }
356 
357  /* Shift Logical Operators */
358  I16vec4 operator<<(const I16vec4 &a) { return _m_psllw(vec,a); }
359  I16vec4 operator<<(int count) { return _m_psllwi(vec,count); }
360  I16vec4& operator<<=(const I16vec4 &a) { return *this = (I16vec4)_m_psllw(vec,a); }
361  I16vec4& operator<<=(int count) { return *this = (I16vec4)_m_psllwi(vec,count); }
362 };
363 
364 inline I16vec4 operator*(const I16vec4 &a, const I16vec4 &b) { return _m_pmullw(a,b); }
365 inline I16vec4 cmpeq(const I16vec4 &a, const I16vec4 &b) { return _m_pcmpeqw(a,b); }
366 inline I16vec4 cmpneq(const I16vec4 &a, const I16vec4 &b) { return _m_pandn(_m_pcmpeqw(a,b), _mmx_all_ones); }
367 
368 inline I16vec4 unpack_low(const I16vec4 &a, const I16vec4 &b) { return _m_punpcklwd(a,b); }
369 inline I16vec4 unpack_high(const I16vec4 &a, const I16vec4 &b) { return _m_punpckhwd(a,b); }
370 
371 /* Is16vec4 Class:
372  * 4 elements, each element signed short
373  */
374 class Is16vec4 : public I16vec4
375 {
376 public:
377  Is16vec4() { }
378  Is16vec4(__m64 mm) : I16vec4(mm) { }
379  Is16vec4(short i0, short i1, short i2, short i3) : I16vec4(i0, i1, i2, i3) { }
380  EXPLICIT Is16vec4(__int64 i) : I16vec4 (i) { }
381  EXPLICIT Is16vec4(int i) : I16vec4 (i) { }
382 
383  /* Assignment Operator */
384  Is16vec4& operator= (const M64 &a) { return *this = (Is16vec4) a; }
385 
386  /* Addition & Subtraction Assignment Operators */
387  Is16vec4& operator&=(const M64 &a) { return *this = (Is16vec4) _m_pand(vec,a); }
388  Is16vec4& operator|=(const M64 &a) { return *this = (Is16vec4) _m_por(vec,a); }
389  Is16vec4& operator^=(const M64 &a) { return *this = (Is16vec4) _m_pxor(vec,a); }
390 
391  /* Addition & Subtraction Assignment Operators */
392  Is16vec4& operator +=(const I16vec4 &a) { return *this = (Is16vec4)_m_paddw(vec,a); }
393  Is16vec4& operator -=(const I16vec4 &a) { return *this = (Is16vec4)_m_psubw(vec,a); }
394  Is16vec4& operator *=(const I16vec4 &a) { return *this = (Is16vec4)_m_pmullw(vec,a); }
395 
396  /* Shift Logical Operators */
397  Is16vec4 operator<<(const M64 &a) { return _m_psllw(vec,a); }
398  Is16vec4 operator<<(int count) { return _m_psllwi(vec,count); }
399  Is16vec4& operator<<=(const M64 &a) { return *this = (Is16vec4)_m_psllw(vec,a); }
400  Is16vec4& operator<<=(int count) { return *this = (Is16vec4)_m_psllwi(vec,count); }
401  /* Shift Arithmetic Operations */
402  Is16vec4 operator>>(const M64 &a) { return _m_psraw(vec,a); }
403  Is16vec4 operator>>(int count) { return _m_psrawi(vec,count); }
404  Is16vec4& operator>>=(const M64 &a) { return *this = (Is16vec4) _m_psraw(vec,a); }
405  Is16vec4& operator>>=(int count) { return *this = (Is16vec4) _m_psrawi(vec,count); }
406 
407 #if defined (_ENABLE_VEC_DEBUG)
408  /* Output for Debug */
409  friend std::ostream& operator<< (std::ostream &os, const Is16vec4 &a)
410  {
411  os << "[3]:" << _MM_4W(3,a)
412  << " [2]:" << _MM_4W(2,a)
413  << " [1]:" << _MM_4W(1,a)
414  << " [0]:" << _MM_4W(0,a);
415  return os;
416  }
417 #endif /* defined (_ENABLE_VEC_DEBUG) */
418 
419  /* Element Access for Debug, No data modified */
420  const short& operator[](int i)const
421  {
422  _VEC_ASSERT(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
423  return _MM_4W(i,vec);
424  }
425 
426  /* Element Access for Debug */
427  short& operator[](int i)
428  {
429  _VEC_ASSERT(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
430  return _MM_4W(i,vec);
431  }
432 };
433 
434 inline Is16vec4 operator*(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmullw(a,b); }
435 
436 /* Compares */
437 inline Is16vec4 cmpeq(const Is16vec4 &a, const Is16vec4 &b) { return _m_pcmpeqw(a,b); }
438 inline Is16vec4 cmpneq(const Is16vec4 &a, const Is16vec4 &b) { return _m_pandn(_m_pcmpeqw(a,b), _mmx_all_ones); }
439 inline Is16vec4 cmpgt(const Is16vec4 &a, const Is16vec4 &b) { return _m_pcmpgtw(a,b); }
440 inline Is16vec4 cmplt(const Is16vec4 &a, const Is16vec4 &b) { return _m_pcmpgtw(b,a); }
441 inline Is16vec4 cmple(const Is16vec4 &a, const Is16vec4 &b) { return _m_pandn(_m_pcmpgtw(a,b), _mmx_all_ones); }
442 inline Is16vec4 cmpge(const Is16vec4 &a, const Is16vec4 &b) { return _m_pandn(_m_pcmpgtw(b,a), _mmx_all_ones); }
443 /* Unpacks */
444 inline Is16vec4 unpack_low(const Is16vec4 &a, const Is16vec4 &b) { return _m_punpcklwd(a,b); }
445 inline Is16vec4 unpack_high(const Is16vec4 &a, const Is16vec4 &b) { return _m_punpckhwd(a,b); }
446 
447 inline Is16vec4 sat_add(const Is16vec4 &a, const Is16vec4 &b) { return _m_paddsw(a,b); }
448 inline Is16vec4 sat_sub(const Is16vec4 &a, const Is16vec4 &b) { return _m_psubsw(a,b); }
449 inline Is16vec4 mul_high(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmulhw(a,b); }
450 inline Is32vec2 mul_add(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmaddwd(a,b);}
451 
452 
453 /* Iu16vec4 Class:
454  * 4 elements, each element unsigned short
455  */
456 class Iu16vec4 : public I16vec4
457 {
458 public:
459  Iu16vec4() { }
460  Iu16vec4(__m64 mm) : I16vec4(mm) { }
461  Iu16vec4(unsigned short ui0, unsigned short ui1,
462  unsigned short ui2, unsigned short ui3)
463  : I16vec4(ui0, ui1, ui2, ui3) { }
464  EXPLICIT Iu16vec4(__int64 i) : I16vec4 (i) { }
465  EXPLICIT Iu16vec4(int i) : I16vec4 (i) { }
466 
467  /* Assignment Operator */
468  Iu16vec4& operator= (const M64 &a) { return *this = (Iu16vec4) a; }
469 
470  /* Logical Assignment Operators */
471  Iu16vec4& operator&=(const M64 &a) { return *this = (Iu16vec4) _m_pand(vec,a); }
472  Iu16vec4& operator|=(const M64 &a) { return *this = (Iu16vec4) _m_por(vec,a); }
473  Iu16vec4& operator^=(const M64 &a) { return *this = (Iu16vec4) _m_pxor(vec,a); }
474 
475  /* Addition & Subtraction Assignment Operators */
476  Iu16vec4& operator +=(const I16vec4 &a) { return *this = (Iu16vec4)_m_paddw(vec,a); }
477  Iu16vec4& operator -=(const I16vec4 &a) { return *this = (Iu16vec4)_m_psubw(vec,a); }
478  Iu16vec4& operator *=(const I16vec4 &a) { return *this = (Iu16vec4)_m_pmullw(vec,a); }
479 
480  /* Shift Logical Operators */
481  Iu16vec4 operator<<(const M64 &a) { return _m_psllw(vec,a); }
482  Iu16vec4 operator<<(int count) { return _m_psllwi(vec,count); }
483  Iu16vec4& operator<<=(const M64 &a) { return *this = (Iu16vec4)_m_psllw(vec,a); }
484  Iu16vec4& operator<<=(int count) { return *this = (Iu16vec4)_m_psllwi(vec,count); }
485  Iu16vec4 operator>>(const M64 &a) { return _m_psrlw(vec,a); }
486  Iu16vec4 operator>>(int count) { return _m_psrlwi(vec,count); }
487  Iu16vec4& operator>>=(const M64 &a) { return *this = (Iu16vec4) _m_psrlw(vec,a); }
488  Iu16vec4& operator>>=(int count) { return *this = (Iu16vec4) _m_psrlwi(vec,count); }
489 
490 #if defined (_ENABLE_VEC_DEBUG)
491  /* Output for Debug */
492  friend std::ostream& operator<< (std::ostream &os, const Iu16vec4 &a)
493  {
494  os << "[3]:" << _MM_4UW(3,a)
495  << " [2]:" << _MM_4UW(2,a)
496  << " [1]:" << _MM_4UW(1,a)
497  << " [0]:" << _MM_4UW(0,a);
498  return os;
499  }
500 #endif /* defined (_ENABLE_VEC_DEBUG) */
501 
502  /* Element Access for Debug, No data modified */
503  const unsigned short& operator[](int i)const
504  {
505  _VEC_ASSERT(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
506  return _MM_4UW(i,vec);
507  }
508 
509  /* Element Access and Assignment for Debug */
510  unsigned short& operator[](int i)
511  {
512  _VEC_ASSERT(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
513  return _MM_4UW(i,vec);
514  }
515 };
516 
517 inline Iu16vec4 operator*(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pmullw(a,b); }
518 inline Iu16vec4 cmpeq(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pcmpeqw(a,b); }
519 inline Iu16vec4 cmpneq(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pandn(_m_pcmpeqw(a,b), _mmx_all_ones); }
520 
521 inline Iu16vec4 sat_add(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_paddusw(a,b); }
522 inline Iu16vec4 sat_sub(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_psubusw(a,b); }
523 
524 inline Iu16vec4 unpack_low(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_punpcklwd(a,b); }
525 inline Iu16vec4 unpack_high(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_punpckhwd(a,b); }
526 
527 /* I8vec8 Class:
528  * 8 elements, each element either unsigned or signed char
529  */
530 class I8vec8 : public M64
531 {
532 public:
533  I8vec8() { }
534  I8vec8(__m64 mm) : M64(mm) { }
535  I8vec8(char s0, char s1, char s2, char s3, char s4, char s5, char s6, char s7)
536  {
537  vec = _mm_set_pi8(s0, s1, s2, s3, s4, s5, s6, s7);
538  }
539  EXPLICIT I8vec8(__int64 i) : M64 (i) { }
540  EXPLICIT I8vec8(int i) : M64 (i) { }
541 
542  /* Assignment Operator */
543  I8vec8& operator= (const M64 &a) { return *this = (I8vec8) a; }
544 
545  /* Logical Assignment Operators */
546  I8vec8& operator&=(const M64 &a) { return *this = (I8vec8) _m_pand(vec,a); }
547  I8vec8& operator|=(const M64 &a) { return *this = (I8vec8) _m_por(vec,a); }
548  I8vec8& operator^=(const M64 &a) { return *this = (I8vec8) _m_pxor(vec,a); }
549 
550  /* Addition & Subtraction Assignment Operators */
551  I8vec8& operator +=(const I8vec8 &a) { return *this = (I8vec8) _m_paddb(vec,a); }
552  I8vec8& operator -=(const I8vec8 &a) { return *this = (I8vec8) _m_psubb(vec,a); }
553 };
554 
555 
556 inline I8vec8 cmpeq(const I8vec8 &a, const I8vec8 &b) { return _m_pcmpeqb(a,b); }
557 inline I8vec8 cmpneq(const I8vec8 &a, const I8vec8 &b) { return _m_pandn(_m_pcmpeqb(a,b), _mmx_all_ones); }
558 
559 inline I8vec8 unpack_low(const I8vec8 &a, const I8vec8 &b) { return _m_punpcklbw(a,b); }
560 inline I8vec8 unpack_high(const I8vec8 &a, const I8vec8 &b) { return _m_punpckhbw(a,b); }
561 
562 /* Is8vec8 Class:
563  * 8 elements, each element signed char
564  */
565 class Is8vec8 : public I8vec8
566 {
567 public:
568  Is8vec8() { }
569  Is8vec8(__m64 mm) : I8vec8(mm) { }
570  Is8vec8(signed char s0, signed char s1, signed char s2, signed char s3,
571  signed char s4, signed char s5, signed char s6, signed char s7)
572  : I8vec8(s0, s1, s2, s3, s4, s5, s6, s7) { }
573  EXPLICIT Is8vec8(__int64 i) : I8vec8 (i) { }
574  EXPLICIT Is8vec8(int i) : I8vec8 (i) { }
575 
576  /* Assignment Operator */
577  Is8vec8& operator= (const M64 &a) { return *this = (Is8vec8) a; }
578 
579  /* Logical Assignment Operators */
580  Is8vec8& operator&=(const M64 &a) { return *this = (Is8vec8) _m_pand(vec,a); }
581  Is8vec8& operator|=(const M64 &a) { return *this = (Is8vec8) _m_por(vec,a); }
582  Is8vec8& operator^=(const M64 &a) { return *this = (Is8vec8) _m_pxor(vec,a); }
583 
584  /* Addition & Subtraction Assignment Operators */
585  Is8vec8& operator +=(const I8vec8 &a) { return *this = (Is8vec8) _m_paddb(vec,a); }
586  Is8vec8& operator -=(const I8vec8 &a) { return *this = (Is8vec8) _m_psubb(vec,a); }
587 
588 #if defined (_ENABLE_VEC_DEBUG)
589  /* Output for Debug */
590  friend std::ostream& operator<< (std::ostream &os, const Is8vec8 &a)
591  {
592  os << "[7]:" << short(_MM_8B(7,a))
593  << " [6]:" << short(_MM_8B(6,a))
594  << " [5]:" << short(_MM_8B(5,a))
595  << " [4]:" << short(_MM_8B(4,a))
596  << " [3]:" << short(_MM_8B(3,a))
597  << " [2]:" << short(_MM_8B(2,a))
598  << " [1]:" << short(_MM_8B(1,a))
599  << " [0]:" << short(_MM_8B(0,a));
600  return os;
601  }
602 #endif /* defined (_ENABLE_VEC_DEBUG) */
603 
604  /* Element Access for Debug, No data modified */
605  const signed char& operator[](int i)const
606  {
607  _VEC_ASSERT(static_cast<unsigned int>(i) < 8); /* Only 8 elements to access */
608  return _MM_8B(i,vec);
609  }
610 
611  /* Element Access and Assignment for Debug */
612  signed char& operator[](int i)
613  {
614  _VEC_ASSERT(static_cast<unsigned int>(i) < 8); /* Only 8 elements to access */
615  return _MM_8B(i,vec);
616  }
617 };
618 
619 /* Additional Is8vec8 functions: compares, unpacks, sat add/sub */
620 inline Is8vec8 cmpeq(const Is8vec8 &a, const Is8vec8 &b) { return _m_pcmpeqb(a,b); }
621 inline Is8vec8 cmpneq(const Is8vec8 &a, const Is8vec8 &b) { return _m_pandn(_m_pcmpeqb(a,b), _mmx_all_ones); }
622 inline Is8vec8 cmpgt(const Is8vec8 &a, const Is8vec8 &b) { return _m_pcmpgtb(a,b); }
623 inline Is8vec8 cmplt(const Is8vec8 &a, const Is8vec8 &b) { return _m_pcmpgtb(b,a); }
624 inline Is8vec8 cmple(const Is8vec8 &a, const Is8vec8 &b) { return _m_pandn(_m_pcmpgtb(a,b), _mmx_all_ones); }
625 inline Is8vec8 cmpge(const Is8vec8 &a, const Is8vec8 &b) { return _m_pandn(_m_pcmpgtb(b,a), _mmx_all_ones); }
626 
627 inline Is8vec8 unpack_low(const Is8vec8 &a, const Is8vec8 &b) { return _m_punpcklbw(a,b); }
628 inline Is8vec8 unpack_high(const Is8vec8 &a, const Is8vec8 &b) { return _m_punpckhbw(a,b); }
629 
630 inline Is8vec8 sat_add(const Is8vec8 &a, const Is8vec8 &b) { return _m_paddsb(a,b); }
631 inline Is8vec8 sat_sub(const Is8vec8 &a, const Is8vec8 &b) { return _m_psubsb(a,b); }
632 
633 /* Iu8vec8 Class:
634  * 8 elements, each element unsigned char
635  */
636 class Iu8vec8 : public I8vec8
637 {
638 public:
639  Iu8vec8() { }
640  Iu8vec8(__m64 mm) : I8vec8(mm) { }
641  Iu8vec8(unsigned char s0, unsigned char s1, unsigned char s2,
642  unsigned char s3, unsigned char s4, unsigned char s5,
643  unsigned char s6, unsigned char s7)
644  : I8vec8(s0, s1, s2, s3, s4, s5, s6, s7) { }
645  EXPLICIT Iu8vec8(__int64 i) : I8vec8 (i) { }
646  EXPLICIT Iu8vec8(int i) : I8vec8 (i) { }
647 
648  /* Assignment Operator */
649  Iu8vec8& operator= (const M64 &a) { return *this = (Iu8vec8) a; }
650  /* Logical Assignment Operators */
651  Iu8vec8& operator&=(const M64 &a) { return *this = (Iu8vec8) _m_pand(vec,a); }
652  Iu8vec8& operator|=(const M64 &a) { return *this = (Iu8vec8) _m_por(vec,a); }
653  Iu8vec8& operator^=(const M64 &a) { return *this = (Iu8vec8) _m_pxor(vec,a); }
654  /* Addition & Subtraction Assignment Operators */
655  Iu8vec8& operator +=(const I8vec8 &a) { return *this = (Iu8vec8) _m_paddb(vec,a); }
656  Iu8vec8& operator -=(const I8vec8 &a) { return *this = (Iu8vec8) _m_psubb(vec,a); }
657 
658 #if defined (_ENABLE_VEC_DEBUG)
659  /* Output for Debug */
660  friend std::ostream& operator << (std::ostream &os, const Iu8vec8 &a)
661  {
662  os << "[7]:" << (unsigned short) (_MM_8UB(7,a))
663  << " [6]:" << (unsigned short) (_MM_8UB(6,a))
664  << " [5]:" << (unsigned short) (_MM_8UB(5,a))
665  << " [4]:" << (unsigned short) (_MM_8UB(4,a))
666  << " [3]:" << (unsigned short) (_MM_8UB(3,a))
667  << " [2]:" << (unsigned short) (_MM_8UB(2,a))
668  << " [1]:" << (unsigned short) (_MM_8UB(1,a))
669  << " [0]:" << (unsigned short) (_MM_8UB(0,a));
670  return os;
671  }
672 #endif /* defined (_ENABLE_VEC_DEBUG) */
673 
674  /* Element Access for Debug, No data modified */
675  const unsigned char& operator[](int i)const
676  {
677  _VEC_ASSERT(static_cast<unsigned int>(i) < 8); /* Only 8 elements to access */
678  return _MM_8UB(i,vec);
679  }
680 
681  /* Element Access for Debug */
682  unsigned char& operator[](int i)
683  {
684  _VEC_ASSERT(static_cast<unsigned int>(i) < 8); /* Only 8 elements to access */
685  return _MM_8UB(i,vec);
686  }
687 };
688 
689 /* Additional Iu8vec8 functions: cmpeq,cmpneq, unpacks, sat add/sub */
690 inline Iu8vec8 cmpeq(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_pcmpeqb(a,b); }
691 inline Iu8vec8 cmpneq(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_pandn(_m_pcmpeqb(a,b), _mmx_all_ones); }
692 
693 inline Iu8vec8 unpack_low(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_punpcklbw(a,b); }
694 inline Iu8vec8 unpack_high(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_punpckhbw(a,b); }
695 
696 inline Iu8vec8 sat_add(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_paddusb(a,b); }
697 inline Iu8vec8 sat_sub(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_psubusb(a,b); }
698 
699 inline Is16vec4 pack_sat(const Is32vec2 &a, const Is32vec2 &b) { return _m_packssdw(a,b); }
700 inline Is8vec8 pack_sat(const Is16vec4 &a, const Is16vec4 &b) { return _m_packsswb(a,b); }
701 inline Iu8vec8 packu_sat(const Is16vec4 &a, const Is16vec4 &b) { return _m_packuswb(a,b); }
702 
703  /********************************* Logicals ****************************************/
704 #define IVEC_LOGICALS(vect,element) \
705 inline I##vect##vec##element operator& (const I##vect##vec##element &a, const I##vect##vec##element &b) \
706 { return _m_pand( a,b); } \
707 inline I##vect##vec##element operator| (const I##vect##vec##element &a, const I##vect##vec##element &b) \
708 { return _m_por( a,b); } \
709 inline I##vect##vec##element operator^ (const I##vect##vec##element &a, const I##vect##vec##element &b) \
710 { return _m_pxor( a,b); } \
711 inline I##vect##vec##element andnot (const I##vect##vec##element &a, const I##vect##vec##element &b) \
712 { return _m_pandn( a,b); }
713 
714 IVEC_LOGICALS(8,8)
715 IVEC_LOGICALS(u8,8)
716 IVEC_LOGICALS(s8,8)
717 IVEC_LOGICALS(16,4)
718 IVEC_LOGICALS(u16,4)
719 IVEC_LOGICALS(s16,4)
720 IVEC_LOGICALS(32,2)
721 IVEC_LOGICALS(u32,2)
722 IVEC_LOGICALS(s32,2)
723 IVEC_LOGICALS(64,1)
724 #undef IVEC_LOGICALS
725 
726  /********************************* Add & Sub ****************************************/
727 #define IVEC_ADD_SUB(vect,element,opsize) \
728 inline I##vect##vec##element operator+ (const I##vect##vec##element &a, const I##vect##vec##element &b) \
729 { return _m_padd##opsize( a,b); } \
730 inline I##vect##vec##element operator- (const I##vect##vec##element &a, const I##vect##vec##element &b) \
731 { return _m_psub##opsize( a,b); }
732 
733 IVEC_ADD_SUB(8,8, b)
734 IVEC_ADD_SUB(u8,8, b)
735 IVEC_ADD_SUB(s8,8, b)
736 IVEC_ADD_SUB(16,4, w)
737 IVEC_ADD_SUB(u16,4, w)
738 IVEC_ADD_SUB(s16,4, w)
739 IVEC_ADD_SUB(32,2, d)
740 IVEC_ADD_SUB(u32,2, d)
741 IVEC_ADD_SUB(s32,2, d)
742 #undef IVEC_ADD_SUB
743 
744  /************************* Conditional Select ********************************
745  * version of: retval = (a OP b)? c : d; *
746  * Where OP is one of the possible comparision operators. *
747  * Example: r = select_eq(a,b,c,d); *
748  * if "member at position x of the vector a" == *
749  * "member at position x of vector b" *
750  * assign the corresponding member in r from c, else assign from d. *
751  ************************* Conditional Select ********************************/
752 
753 #define IVEC_SELECT(vect12,vect34,element,selop) \
754  inline I##vect34##vec##element select_##selop ( \
755  const I##vect12##vec##element &a, \
756  const I##vect12##vec##element &b, \
757  const I##vect34##vec##element &c, \
758  const I##vect34##vec##element &d) \
759 { \
760  I##vect12##vec##element mask = cmp##selop(a,b); \
761  return( (I##vect34##vec##element)(mask & c ) | \
762  (I##vect34##vec##element)((_m_pandn(mask, d )))); \
763 }
764 
765 IVEC_SELECT(8,s8,8,eq)
766 IVEC_SELECT(8,u8,8,eq)
767 IVEC_SELECT(8,8,8,eq)
768 IVEC_SELECT(8,s8,8,neq)
769 IVEC_SELECT(8,u8,8,neq)
770 IVEC_SELECT(8,8,8,neq)
771 
772 IVEC_SELECT(16,s16,4,eq)
773 IVEC_SELECT(16,u16,4,eq)
774 IVEC_SELECT(16,16,4,eq)
775 IVEC_SELECT(16,s16,4,neq)
776 IVEC_SELECT(16,u16,4,neq)
777 IVEC_SELECT(16,16,4,neq)
778 
779 IVEC_SELECT(32,s32,2,eq)
780 IVEC_SELECT(32,u32,2,eq)
781 IVEC_SELECT(32,32,2,eq)
782 IVEC_SELECT(32,s32,2,neq)
783 IVEC_SELECT(32,u32,2,neq)
784 IVEC_SELECT(32,32,2,neq)
785 
786 
787 IVEC_SELECT(s8,s8,8,gt)
788 IVEC_SELECT(s8,u8,8,gt)
789 IVEC_SELECT(s8,8,8,gt)
790 IVEC_SELECT(s8,s8,8,lt)
791 IVEC_SELECT(s8,u8,8,lt)
792 IVEC_SELECT(s8,8,8,lt)
793 IVEC_SELECT(s8,s8,8,le)
794 IVEC_SELECT(s8,u8,8,le)
795 IVEC_SELECT(s8,8,8,le)
796 IVEC_SELECT(s8,s8,8,ge)
797 IVEC_SELECT(s8,u8,8,ge)
798 IVEC_SELECT(s8,8,8,ge)
799 
800 IVEC_SELECT(s16,s16,4,gt)
801 IVEC_SELECT(s16,u16,4,gt)
802 IVEC_SELECT(s16,16,4,gt)
803 IVEC_SELECT(s16,s16,4,lt)
804 IVEC_SELECT(s16,u16,4,lt)
805 IVEC_SELECT(s16,16,4,lt)
806 IVEC_SELECT(s16,s16,4,le)
807 IVEC_SELECT(s16,u16,4,le)
808 IVEC_SELECT(s16,16,4,le)
809 IVEC_SELECT(s16,s16,4,ge)
810 IVEC_SELECT(s16,u16,4,ge)
811 IVEC_SELECT(s16,16,4,ge)
812 
813 IVEC_SELECT(s32,s32,2,gt)
814 IVEC_SELECT(s32,u32,2,gt)
815 IVEC_SELECT(s32,32,2,gt)
816 IVEC_SELECT(s32,s32,2,lt)
817 IVEC_SELECT(s32,u32,2,lt)
818 IVEC_SELECT(s32,32,2,lt)
819 IVEC_SELECT(s32,s32,2,le)
820 IVEC_SELECT(s32,u32,2,le)
821 IVEC_SELECT(s32,32,2,le)
822 IVEC_SELECT(s32,s32,2,ge)
823 IVEC_SELECT(s32,u32,2,ge)
824 IVEC_SELECT(s32,32,2,ge)
825 
826 
827 #undef IVEC_SELECT
828 
829 inline static void empty(void) { _m_empty(); }
830 
831 #if defined (_SILENCE_IVEC_C4799)
832  #pragma warning(pop)
833 #endif /* defined (_SILENCE_IVEC_C4799) */
834 
835 #endif /* defined (_M_CEE_PURE) */
836 
837 #endif /* RC_INVOKED */
838 #endif /* _IVEC_H_INCLUDED */
Iu8vec8()
Definition: ivec.h:639
Is16vec4 & operator^=(const M64 &a)
Definition: ivec.h:389
I8vec8 & operator-=(const I8vec8 &a)
Definition: ivec.h:552
EXPLICIT Iu8vec8(int i)
Definition: ivec.h:646
__m64 _m_pslld(__m64 _M, __m64 _Count)
EXPLICIT I32vec2(__int64 i)
Definition: ivec.h:163
EXPLICIT Is16vec4(__int64 i)
Definition: ivec.h:380
Is16vec4 & operator-=(const I16vec4 &a)
Definition: ivec.h:393
Is16vec4 & operator<<=(int count)
Definition: ivec.h:400
Is8vec8 & operator|=(const M64 &a)
Definition: ivec.h:581
Is8vec8(__m64 mm)
Definition: ivec.h:569
Is32vec2 operator>>(const M64 &a)
Definition: ivec.h:222
Is8vec8 & operator^=(const M64 &a)
Definition: ivec.h:582
Iu8vec8 & operator+=(const I8vec8 &a)
Definition: ivec.h:655
Is16vec4 operator>>(const M64 &a)
Definition: ivec.h:402
Definition: ivec.h:195
__m64 _m_punpckhwd(__m64 _MM1, __m64 _MM2)
_CRTIMP void __cdecl _wassert(_In_z_ const wchar_t *_Message, _In_z_ const wchar_t *_File, _In_ unsigned _Line)
__m64 _m_pslldi(__m64 _M, int _Count)
__m64 _m_paddb(__m64 _MM1, __m64 _MM2)
I8vec8(char s0, char s1, char s2, char s3, char s4, char s5, char s6, char s7)
Definition: ivec.h:535
#define IVEC_SELECT(vect12, vect34, element, selop)
Definition: ivec.h:753
Is16vec4 operator<<(int count)
Definition: ivec.h:398
I64vec1 & operator>>=(int count)
Definition: ivec.h:150
__m64 _mm_set_pi16(short _S3, short _S2, short _S1, short _S0)
Iu32vec2 operator<<(int count)
Definition: ivec.h:289
I64vec1 operator<<(int count)
Definition: ivec.h:144
short & operator[](int i)
Definition: ivec.h:427
I16vec4 & operator-=(const I16vec4 &a)
Definition: ivec.h:354
Is32vec2 & operator<<=(int count)
Definition: ivec.h:220
I64vec1 & operator=(const M64 &a)
Definition: ivec.h:137
Is16vec4 & operator>>=(const M64 &a)
Definition: ivec.h:404
__m64 _m_pmullw(__m64 _MM1, __m64 _MM2)
I64vec1 & operator<<=(const M64 &a)
Definition: ivec.h:145
#define IVEC_LOGICALS(vect, element)
Definition: ivec.h:704
EXPLICIT I8vec8(int i)
Definition: ivec.h:540
Iu16vec4(__m64 mm)
Definition: ivec.h:460
EXPLICIT I16vec4(__int64 i)
Definition: ivec.h:341
#define _MM_4UW(element, vector)
Definition: ivec.h:82
const int & operator[](int i) const
Definition: ivec.h:238
__m64 _m_punpckhdq(__m64 _MM1, __m64 _MM2)
Iu16vec4(unsigned short ui0, unsigned short ui1, unsigned short ui2, unsigned short ui3)
Definition: ivec.h:461
#define _MM_8B(element, vector)
Definition: ivec.h:80
Iu8vec8 & operator=(const M64 &a)
Definition: ivec.h:649
Definition: ivec.h:332
I64vec1 operator>>(const M64 &a)
Definition: ivec.h:147
M64()
Definition: ivec.h:100
const unsigned int & operator[](int i) const
Definition: ivec.h:308
I64vec1 & operator|=(const M64 &a)
Definition: ivec.h:139
EXPLICIT I16vec4(int i)
Definition: ivec.h:342
#define _CRTIMP
Definition: crtdefs.h:23
Is16vec4 sat_sub(const Is16vec4 &a, const Is16vec4 &b)
Definition: ivec.h:448
Iu32vec2 & operator&=(const M64 &a)
Definition: ivec.h:279
Definition: ivec.h:636
Iu32vec2 operator>>(int count)
Definition: ivec.h:293
Iu16vec4 & operator>>=(int count)
Definition: ivec.h:488
M64 & operator^=(const M64 &a)
Definition: ivec.h:110
__m64 _m_punpcklbw(__m64 _MM1, __m64 _MM2)
Is16vec4(short i0, short i1, short i2, short i3)
Definition: ivec.h:379
iterator_traits< _InIt >::difference_type count(_InIt _First, _InIt _Last, const _Ty &_Val)
Definition: xutility:3086
Is32vec2 & operator|=(const M64 &a)
Definition: ivec.h:209
__m64 _m_psrlwi(__m64 _M, int _Count)
__m64 _m_psubw(__m64 _MM1, __m64 _MM2)
EXPLICIT Is32vec2(__int64 i)
Definition: ivec.h:202
__m64 _m_pand(__m64 _MM1, __m64 _MM2)
Is16vec4 & operator&=(const M64 &a)
Definition: ivec.h:387
uint_2 operator<<(const uint_2 &_Lhs, const uint_2 &_Rhs) __GPU
Definition: amp_short_vectors.h:22866
__m64 _m_psllw(__m64 _M, __m64 _Count)
I16vec4 operator<<(const I16vec4 &a)
Definition: ivec.h:358
I32vec2 cmpeq(const I32vec2 &a, const I32vec2 &b)
Definition: ivec.h:186
Definition: ivec.h:565
I64vec1(__m64 mm)
Definition: ivec.h:133
__m64 _m_psrad(__m64 _M, __m64 _Count)
Iu32vec2(__m64 mm)
Definition: ivec.h:270
Is32vec2 & operator>>=(int count)
Definition: ivec.h:225
Is32vec2 & operator<<=(const M64 &a)
Definition: ivec.h:219
Iu16vec4 & operator|=(const M64 &a)
Definition: ivec.h:472
Iu32vec2 operator>>(const M64 &a)
Definition: ivec.h:292
void _m_empty(void)
Iu8vec8 & operator-=(const I8vec8 &a)
Definition: ivec.h:656
I64vec1 & operator<<=(int count)
Definition: ivec.h:146
__m64 _m_psubusb(__m64 _MM1, __m64 _MM2)
Is32vec2 & operator+=(const I32vec2 &a)
Definition: ivec.h:213
I16vec4 & operator|=(const M64 &a)
Definition: ivec.h:349
Iu32vec2 & operator>>=(const M64 &a)
Definition: ivec.h:294
Iu16vec4 operator<<(int count)
Definition: ivec.h:482
I8vec8()
Definition: ivec.h:533
__m64 _mm_set_pi32(int _I1, int _I0)
Is32vec2 & operator>>=(const M64 &a)
Definition: ivec.h:224
__m64 _m_psubsb(__m64 _MM1, __m64 _MM2)
Iu32vec2 & operator>>=(int count)
Definition: ivec.h:295
Iu16vec4 & operator&=(const M64 &a)
Definition: ivec.h:471
static void empty(void)
Definition: ivec.h:829
I8vec8(__m64 mm)
Definition: ivec.h:534
__m64 _m_psrlw(__m64 _M, __m64 _Count)
__m64 _m_punpckhbw(__m64 _MM1, __m64 _MM2)
unsigned short & operator[](int i)
Definition: ivec.h:510
I32vec2 & operator-=(const I32vec2 &a)
Definition: ivec.h:175
__m64 _m_psrldi(__m64 _M, int _Count)
Definition: ivec.h:266
I32vec2 & operator&=(const M64 &a)
Definition: ivec.h:169
Definition: ivec.h:94
__m64 _m_psrawi(__m64 _M, int _Count)
__m64 _m_pcmpeqw(__m64 _MM1, __m64 _MM2)
I64vec1 operator>>(int count)
Definition: ivec.h:148
__m64 _mm_set_pi8(char _B7, char _B6, char _B5, char _B4, char _B3, char _B2, char _B1, char _B0)
EXPLICIT I8vec8(__int64 i)
Definition: ivec.h:539
I32vec2 & operator^=(const M64 &a)
Definition: ivec.h:171
I16vec4(__m64 mm)
Definition: ivec.h:336
I16vec4 & operator<<=(int count)
Definition: ivec.h:361
I32vec2 operator<<(const I32vec2 &a)
Definition: ivec.h:178
I8vec8 & operator+=(const I8vec8 &a)
Definition: ivec.h:551
__m64 _m_psubusw(__m64 _MM1, __m64 _MM2)
M64 andnot(const M64 &a, const M64 &b)
Definition: ivec.h:122
I16vec4 & operator&=(const M64 &a)
Definition: ivec.h:348
__m64 _m_psraw(__m64 _M, __m64 _Count)
__m64 _m_packsswb(__m64 _MM1, __m64 _MM2)
I64vec1()
Definition: ivec.h:132
__m64 _m_paddusw(__m64 _MM1, __m64 _MM2)
EXPLICIT Iu32vec2(__int64 i)
Definition: ivec.h:273
__m64 _m_psllwi(__m64 _M, int _Count)
__m64 _m_por(__m64 _MM1, __m64 _MM2)
I32vec2 unpack_low(const I32vec2 &a, const I32vec2 &b)
Definition: ivec.h:189
const unsigned short & operator[](int i) const
Definition: ivec.h:503
Iu16vec4()
Definition: ivec.h:459
I16vec4 & operator^=(const M64 &a)
Definition: ivec.h:350
__m64 _m_pmaddwd(__m64 _MM1, __m64 _MM2)
int i[4]
Definition: dvec.h:70
Iu8vec8 & operator^=(const M64 &a)
Definition: ivec.h:653
Is32vec2()
Definition: ivec.h:198
Is16vec4 pack_sat(const Is32vec2 &a, const Is32vec2 &b)
Definition: ivec.h:699
I32vec2 & operator=(const M64 &a)
Definition: ivec.h:166
__m64 _m_pandn(__m64 _MM1, __m64 _MM2)
#define _In_z_
Definition: sal.h:319
#define _In_
Definition: sal.h:314
M64(__m64 mm)
Definition: ivec.h:101
I16vec4()
Definition: ivec.h:335
EXPLICIT Is16vec4(int i)
Definition: ivec.h:381
EXPLICIT I64vec1(__int64 mm)
Definition: ivec.h:135
__m64 _m_punpckldq(__m64 _MM1, __m64 _MM2)
__m64 _m_paddsw(__m64 _MM1, __m64 _MM2)
Iu8vec8 & operator&=(const M64 &a)
Definition: ivec.h:651
I8vec8 & operator|=(const M64 &a)
Definition: ivec.h:547
M64 operator|(const M64 &a, const M64 &b)
Definition: ivec.h:120
I32vec2 operator<<(int count)
Definition: ivec.h:179
__m64 _m_punpcklwd(__m64 _MM1, __m64 _MM2)
__m64 _m_psrld(__m64 _M, __m64 _Count)
M64 & operator&=(const M64 &a)
Definition: ivec.h:108
Is8vec8 & operator-=(const I8vec8 &a)
Definition: ivec.h:586
I32vec2(int i0, int i1)
Definition: ivec.h:161
Definition: ivec.h:456
int & operator[](int i)
Definition: ivec.h:245
I64vec1 & operator^=(const M64 &a)
Definition: ivec.h:140
Iu32vec2 & operator+=(const I32vec2 &a)
Definition: ivec.h:284
Definition: ivec.h:156
M64 & operator|=(const M64 &a)
Definition: ivec.h:109
__m64
Definition: mmintrin.h:42
__m64 _m_pmulhw(__m64 _MM1, __m64 _MM2)
Iu32vec2 & operator<<=(int count)
Definition: ivec.h:291
unsigned char & operator[](int i)
Definition: ivec.h:682
Iu32vec2 & operator-=(const I32vec2 &a)
Definition: ivec.h:285
Iu8vec8 & operator|=(const M64 &a)
Definition: ivec.h:652
Is32vec2 operator<<(int count)
Definition: ivec.h:218
I16vec4 operator*(const I16vec4 &a, const I16vec4 &b)
Definition: ivec.h:364
EXPLICIT Is8vec8(int i)
Definition: ivec.h:574
Iu8vec8 packu_sat(const Is16vec4 &a, const Is16vec4 &b)
Definition: ivec.h:701
I32vec2 & operator|=(const M64 &a)
Definition: ivec.h:170
__m64 _m_psubb(__m64 _MM1, __m64 _MM2)
Is32vec2 & operator^=(const M64 &a)
Definition: ivec.h:210
Iu32vec2(unsigned int i0, unsigned int i1)
Definition: ivec.h:271
EXPLICIT Is8vec8(__int64 i)
Definition: ivec.h:573
I8vec8 & operator&=(const M64 &a)
Definition: ivec.h:546
M64 operator^(const M64 &a, const M64 &b)
Definition: ivec.h:121
Iu8vec8(unsigned char s0, unsigned char s1, unsigned char s2, unsigned char s3, unsigned char s4, unsigned char s5, unsigned char s6, unsigned char s7)
Definition: ivec.h:641
Is16vec4(__m64 mm)
Definition: ivec.h:378
I16vec4 & operator+=(const I16vec4 &a)
Definition: ivec.h:353
basic_ostream< char, char_traits< char > > ostream
Definition: iosfwd:678
__m64 _m_psllq(__m64 _M, __m64 _Count)
M64 operator&(const M64 &a, const M64 &b)
Definition: ivec.h:119
Is32vec2 cmpge(const Is32vec2 &a, const Is32vec2 &b)
Definition: ivec.h:258
Iu32vec2()
Definition: ivec.h:269
__m64 _m_psrlq(__m64 _M, __m64 _Count)
I16vec4 operator<<(int count)
Definition: ivec.h:359
M64(int i)
Definition: ivec.h:103
I32vec2 & operator<<=(int count)
Definition: ivec.h:181
EXPLICIT Iu32vec2(int i)
Definition: ivec.h:272
EXPLICIT Iu8vec8(__int64 i)
Definition: ivec.h:645
#define _MM_4W(element, vector)
Definition: ivec.h:83
Is8vec8 & operator+=(const I8vec8 &a)
Definition: ivec.h:585
Iu16vec4 & operator+=(const I16vec4 &a)
Definition: ivec.h:476
Is32vec2(signed int i0, signed int i1)
Definition: ivec.h:200
#define EXPLICIT
Definition: ivec.h:30
I64vec1 & operator&=(const M64 &a)
Definition: ivec.h:138
Is16vec4 sat_add(const Is16vec4 &a, const Is16vec4 &b)
Definition: ivec.h:447
Is32vec2 cmpgt(const Is32vec2 &a, const Is32vec2 &b)
Definition: ivec.h:255
I32vec2 & operator<<=(const I32vec2 &a)
Definition: ivec.h:180
Is16vec4 & operator>>=(int count)
Definition: ivec.h:405
Is32vec2 operator<<(const M64 &a)
Definition: ivec.h:217
Iu16vec4 & operator<<=(int count)
Definition: ivec.h:484
__m64 vec
Definition: ivec.h:97
Iu32vec2 & operator^=(const M64 &a)
Definition: ivec.h:281
const unsigned char & operator[](int i) const
Definition: ivec.h:675
Definition: ivec.h:530
#define _MM_2DW(element, vector)
Definition: ivec.h:86
_Check_return_ _In_z_ const char _Inout_ FILE * _File
Definition: stdio.h:226
const short & operator[](int i) const
Definition: ivec.h:420
Iu32vec2 & operator|=(const M64 &a)
Definition: ivec.h:280
I32vec2(__m64 mm)
Definition: ivec.h:160
EXPLICIT Is32vec2(int i)
Definition: ivec.h:201
Is16vec4 & operator<<=(const M64 &a)
Definition: ivec.h:399
Iu16vec4 & operator=(const M64 &a)
Definition: ivec.h:468
#define IVEC_ADD_SUB(vect, element, opsize)
Definition: ivec.h:727
__m64 _m_from_int(int _I)
Is32vec2 & operator&=(const M64 &a)
Definition: ivec.h:208
const signed char & operator[](int i) const
Definition: ivec.h:605
Iu16vec4 & operator>>=(const M64 &a)
Definition: ivec.h:487
Is32vec2 & operator=(const M64 &a)
Definition: ivec.h:205
EXPLICIT Iu16vec4(__int64 i)
Definition: ivec.h:464
Iu16vec4 operator>>(int count)
Definition: ivec.h:486
I32vec2 unpack_high(const I32vec2 &a, const I32vec2 &b)
Definition: ivec.h:190
Iu32vec2 operator<<(const M64 &a)
Definition: ivec.h:288
__m64 _m_pcmpgtw(__m64 _MM1, __m64 _MM2)
Is8vec8(signed char s0, signed char s1, signed char s2, signed char s3, signed char s4, signed char s5, signed char s6, signed char s7)
Definition: ivec.h:570
__m64 _m_paddw(__m64 _MM1, __m64 _MM2)
Iu32vec2 & operator=(const M64 &a)
Definition: ivec.h:276
Is32vec2 cmple(const Is32vec2 &a, const Is32vec2 &b)
Definition: ivec.h:257
__m64 _m_pcmpgtb(__m64 _MM1, __m64 _MM2)
#define _VEC_ASSERT(_Expression)
Definition: ivec.h:47
Is16vec4()
Definition: ivec.h:377
Iu16vec4 & operator^=(const M64 &a)
Definition: ivec.h:473
Is32vec2 operator>>(int count)
Definition: ivec.h:223
Definition: ivec.h:374
I32vec2()
Definition: ivec.h:159
I64vec1 & operator>>=(const M64 &a)
Definition: ivec.h:149
M64(__int64 mm)
Definition: ivec.h:102
__m64 _m_pcmpeqb(__m64 _MM1, __m64 _MM2)
Iu16vec4 & operator-=(const I16vec4 &a)
Definition: ivec.h:477
unsigned int & operator[](int i)
Definition: ivec.h:315
Iu16vec4 operator>>(const M64 &a)
Definition: ivec.h:485
Is8vec8 & operator=(const M64 &a)
Definition: ivec.h:577
__m64 _m_paddusb(__m64 _MM1, __m64 _MM2)
__m64 _m_packuswb(__m64 _MM1, __m64 _MM2)
const union @94 __mmx_all_ones_cheat
Is8vec8 & operator&=(const M64 &a)
Definition: ivec.h:580
__int64 m1
Definition: ivec.h:114
I8vec8 & operator=(const M64 &a)
Definition: ivec.h:543
EXPLICIT Iu16vec4(int i)
Definition: ivec.h:465
__m64 _m_pcmpeqd(__m64 _MM1, __m64 _MM2)
Is32vec2 cmplt(const Is32vec2 &a, const Is32vec2 &b)
Definition: ivec.h:256
I32vec2 cmpneq(const I32vec2 &a, const I32vec2 &b)
Definition: ivec.h:187
__m64 _m_paddd(__m64 _MM1, __m64 _MM2)
Is16vec4 & operator*=(const I16vec4 &a)
Definition: ivec.h:394
Is8vec8()
Definition: ivec.h:568
I16vec4 & operator=(const M64 &a)
Definition: ivec.h:345
Is16vec4 mul_high(const Is16vec4 &a, const Is16vec4 &b)
Definition: ivec.h:449
Is32vec2 & operator-=(const I32vec2 &a)
Definition: ivec.h:214
Is16vec4 & operator=(const M64 &a)
Definition: ivec.h:384
Iu16vec4 operator<<(const M64 &a)
Definition: ivec.h:481
Definition: ivec.h:129
Iu8vec8(__m64 mm)
Definition: ivec.h:640
__m64 _m_psrlqi(__m64 _M, int _Count)
EXPLICIT I32vec2(int i)
Definition: ivec.h:162
#define _MM_2UDW(element, vector)
Definition: ivec.h:85
__m64 _m_paddsb(__m64 _MM1, __m64 _MM2)
Is32vec2 mul_add(const Is16vec4 &a, const Is16vec4 &b)
Definition: ivec.h:450
#define _MM_8UB(element, vector)
Definition: ivec.h:79
signed char & operator[](int i)
Definition: ivec.h:612
Is32vec2(__m64 mm)
Definition: ivec.h:199
Is16vec4 operator>>(int count)
Definition: ivec.h:403
I64vec1 operator<<(const M64 &a)
Definition: ivec.h:143
__m64 _m_psubsw(__m64 _MM1, __m64 _MM2)
__m64 _m_psradi(__m64 _M, int _Count)
EXPLICIT I64vec1(int i)
Definition: ivec.h:134
Iu32vec2 & operator<<=(const M64 &a)
Definition: ivec.h:290
__m64 _m_pxor(__m64 _MM1, __m64 _MM2)
__m64 _m_psubd(__m64 _MM1, __m64 _MM2)
__m64 _m_pcmpgtd(__m64 _MM1, __m64 _MM2)
__m64 m2
Definition: ivec.h:114
#define _mmx_all_ones
Definition: ivec.h:117
I16vec4 & operator*=(const I16vec4 &a)
Definition: ivec.h:355
Iu16vec4 & operator*=(const I16vec4 &a)
Definition: ivec.h:478
Iu16vec4 & operator<<=(const M64 &a)
Definition: ivec.h:483
__m64 _m_psllqi(__m64 _M, int _Count)
I16vec4(short i0, short i1, short i2, short i3)
Definition: ivec.h:337
I32vec2 & operator+=(const I32vec2 &a)
Definition: ivec.h:174
I16vec4 & operator<<=(const I16vec4 &a)
Definition: ivec.h:360
I8vec8 & operator^=(const M64 &a)
Definition: ivec.h:548
Is16vec4 & operator+=(const I16vec4 &a)
Definition: ivec.h:392
Is16vec4 & operator|=(const M64 &a)
Definition: ivec.h:388
Is16vec4 operator<<(const M64 &a)
Definition: ivec.h:397
__m64 _m_packssdw(__m64 _MM1, __m64 _MM2)