CPU vector operations(CPU vector指令 )

vector operations 是现代CPU优化速度的一个技巧,就是把通过大寄存器把多个数据同时处理来加速,一般ICC GCC都会简单的预测做出vector operations的优化,但是也不纯粹,自己添加相关代码还是可以有一定的优化空间。

Today's microprocessors have vector instructions that make it possible to do operations on
all elements of a vector simultaneously. This is also called Single-Instruction-Multiple-Data
(SIMD) operations. The total size of each vector can be 64 bits (MMX), 128 bits (XMM) or
256 bits (YMM).
Vector operations are useful when doing calculations on large data sets where the same
operation is performed on multiple data elements and the program logic allows parallel
calculations. Examples are image processing, sound processing, and mathematical
operations on vectors and matrixes. Algorithms that are inherently serial, such as most
sorting algorithms, are not suited for vector operations. Algorithms that rely heavily on table
lookup or require a lot of data shuffling, such as many encryption algorithms, cannot easily
be implemented as vector operations.
The vector operations use a set of special vector registers. The maximum size of each
vector register is 128 bits (XMM) if the SSE2 instruction set is available, or 256 bits (YMM) if
the AVX instruction set is supported by the microprocessor and the operating system. The
number of elements in each vector depends on the size and type of data elements


http://www.agner.org/optimize/#vectorclass

http://www.codeproject.com/Articles/332437/Fast-SIMD-Prototyping


你可能感兴趣的:(CPU vector operations(CPU vector指令 ))