相关疑难解决方法(0)

为什么SSE标量sqrt(x)比rsqrt(x)*x慢?

我一直在英特尔Core Duo上分析我们的一些核心数学,并且在研究平方根的各种方法时,我注意到一些奇怪的事情:使用SSE标量操作,采用倒数平方根并乘以它更快获取sqrt,而不是使用本机sqrt操作码!

我正在测试它的循环类似于:

inline float TestSqrtFunction( float in );

void TestFunc()
{
  #define ARRAYSIZE 4096
  #define NUMITERS 16386
  float flIn[ ARRAYSIZE ]; // filled with random numbers ( 0 .. 2^22 )
  float flOut [ ARRAYSIZE ]; // filled with 0 to force fetch into L1 cache

  cyclecounter.Start();
  for ( int i = 0 ; i < NUMITERS ; ++i )
    for ( int j = 0 ; j < ARRAYSIZE ; ++j )
    {
       flOut[j] = TestSqrtFunction( flIn[j] ); …
Run Code Online (Sandbox Code Playgroud)

floating-point performance x86 assembly sse

106
推荐指数
4
解决办法
4万
查看次数

标签 统计

assembly ×1

floating-point ×1

performance ×1

sse ×1

x86 ×1