我试图理解为什么的Visual Studio 2012(64)不希望矢量从short
转换到float
。有没有人有理由或解决方法?矢量化短浮动转换?
//unsigned short* __restrict A,B,C,D
for (int j = 0; j < H*W;j++)
{
float Gs = D[j]-B[j];
float Gc = A[j]-C[j];
in[j]=atan2f(Gs,Gc);
}
信息C5002:循环不矢量由于原因 '1101' 使用的短裤,而不是向量化
解决方案
运行时间约为800ms
运行时转换为所有整数和自动矢量化大约是140ms
(!!!)
一种方法是使用SSE4.1转换'short' - >'int'。然后使用'int' - >'float'转换内在。 – Mysticial 2013-03-22 04:21:15