获取与上证所__m128i向量最大值? [英] Getting max value in a __m128i vector with SSE?
问题描述
我一直在使用SSE刚开始,我很困惑如何获得的最大的整数值(最大
) __ m128i
。例如:
I have just started using SSE and I am confused how to get the maximum integer value (max
) of a __m128i
. For instance:
__m128i t = _mm_setr_ps(0,1,2,3);
// max(t) = 3;
搜索周围使我 MAXPS
指令,但我似乎无法找到如何使用与xmmintrin.h
。
Searching around led me to MAXPS
instruction but I can't seem to find how to use that with "xmmintrin.h"
.
此外,有没有任何文档xmmintrin.h
,你会建议,而不是寻找到头文件本身?
Also, is there any documentation for "xmmintrin.h"
that you would recommend, rather than looking into the header file itself?
推荐答案
如果你发现自己需要做载体水平的操作,尤其是如果它是一个内循环中,那么它的一般的一个标志,你接近以错误的方式你的SIMD执行。 SIMD喜欢操作的向量逐元素 - 垂直如果你喜欢,不是水平
If you find yourself needing to do horizontal operations on vectors, especially if it's inside an inner loop, then it's usually a sign that you are approaching your SIMD implementation in the wrong way. SIMD likes to operate element-wise on vectors - "vertically" if you like, not horizontally.
至于文档,有一个上intel.com 很有借鉴哪些包含所有运算codeS和一切从MMX通过深圳证券交易所的各种口味一路攀升到内在AVX和AVX-512。
As for documentation, there is a very useful reference on intel.com which contains all the opcodes and intrinsics for everything from MMX through the various flavours of SSE all the way up to AVX and AVX-512.
这篇关于获取与上证所__m128i向量最大值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!