原始标量函数
static inline uint32 abc(uint32 bytes, int shift)
{
uint32 kMul= 0x1e35a7bd;
return (bytes * kMul) >> shift;
}
等效的 AVX 功能
static inline uint32 abc(uint32 bytes, int shift)
{
uint32 kMul= 0x1e35a7bd;
__m256i a,b,c,resShift,shift_256i;
a=_mm256_set1_epi32(bytes);
b=_mm256_set1_epi32(kMul);
shift_256i=_mm256_set1_epi32(shift);
c=_mm256_mul_epi32(a,b);
resShift=_mm256_srlv_epi64(c,shift_256i);
// I am not sure what function to use to convert m256i variable into integer
}
我不确定如何在最后一步将 m256i 变量转换为整数。resShift 具有右移的 m256i 值,但我必须将其转换为整数形式并从该函数返回。有什么帮助吗?