使用 SSE 对数,还是切换到 FPU? [英] Logarithm with SSE, or switch to FPU?

查看:38
本文介绍了使用 SSE 对数,还是切换到 FPU?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些统计计算.我需要它们很快,所以我重写了大部分以使用 SSE.我对它很陌生,所以我想知道这里的正确方法是什么:

I'm doing some statistics calculations. I need them to be fast, so I rewrote most of it to use SSE. I'm pretty much new to it, so I was wondering what the right approach here is:

据我所知,SSE 中没有 log2 或 ln 函数,至少没有达到 4.1,这是我使用的硬件支持的最新版本.

To my knowledge, there is no log2 or ln function in SSE, at least not up to 4.1, which is the latest version supported by the hardware I use.

是否更好:

  1. 提取 4 个浮点数,并对它们进行 FPU 计算以确定熵 - 我不需要将这些值中的任何一个加载回 SSE 寄存器,只需将它们与另一个浮点数相加
  2. 找到一个执行 log2 的 SSE 函数

推荐答案

似乎有一些 SSE log2 实现,例如这个.

There seem to be a few SSE log2 implementations around, e.g. this one.

还有 Intel Approximate Maths Library>log2 等功能 - 它很旧(2000 年)但它是 SSE2,它应该仍然可以正常工作.

There is also the Intel Approximate Maths Library which has a log2 function among others - it's old (2000) but it's SSE2 and it should still work reasonably well.

<小时>另见:

这篇关于使用 SSE 对数,还是切换到 FPU?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆