POW上证所类型 [英] pow for SSE types
问题描述
我不使用SSE类型,如
(在 xmmintrin.h
定义等)__ M128一些明确的矢量化计算,但现在我需要将向量的所有元素提高一些(下同)力量,即理想的我希望像 __ M128 _mm_pow_ps(__ M128,浮动)
,不幸的是没有按T存在。
I do some explicitly vectorised computations using SSE types, such as __m128
(defined in xmmintrin.h
etc), but now I need to raise all elements of the vector to some (same) power, i.e. ideally I would want something like __m128 _mm_pow_ps(__m128, float)
, which unfortunately doesn't exist.
什么是解决这个问题的最好方法?我可以存储载体,通话的std :: POW
每个元素,然后重新装入。这是我能做到的最好?如何编译器实现到 STD通话::战俘
时,自动向量化code,否则是非常vectorisable?有没有提供一些有用的东西的库?
What is the best way around this? I could store the vector, call std::pow
on each element, and then reload it. Is this the best I can do? How do compilers implement a call to std::pow
when auto-vectorising code that otherwise is well vectorisable? Are there any libraries that provide something useful?
(注意,这个问题是不是重复相关当然不具有有用的答案。)
(note that this question is related by not a duplicate and certainly doesn't have a useful answer.)
推荐答案
使用公式 EXP(Y *日志(X))
为 POW (X,Y)
和与EXP SSE实现图书馆并登录。
这篇关于POW上证所类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!