LoginSignup
0
0

More than 5 years have passed since last update.

vexp2pd

Posted at

AVX-512ER(Exponential and Reciprocal) はその名前のとおり、exp用の命令もあります。

28bit 逆数(vrcp28pd) や KNC にあった、23bit exp2(vexp223ps) は、その命令のニーモニックに、精度を示す数値が入っており、自分が近似値しか求めないことを主張する謙虚な姿勢を見せていましたが、AVX-512ER の、23bit exp2は、

vexp2pd

という謙虚さを感じさせないニーモニックになっています。

#include <immintrin.h>
#include <stdio.h>

double in[8] = {2.2,3.3,4.4,5.5, 6.6,7.7,8.8,9.9};
double out[8];

int
main()
{
    __m512d v = _mm512_loadu_pd(in);
    __m512d r = _mm512_exp2a23_pd(v);
    _mm512_storeu_pd(out, r);

    for (int i=0; i<8; i++) {
        printf("%f\n", out[i]);
    }
}
4.594793
9.849155
21.112125
45.254833
97.005859
207.936615
445.721893
955.425781

KNCのexp223は固定小数をとっていましたが(何故?)、これは倍精度値を入れればよいです。

他に、AV512-ERには、28bit逆数平方根(vrsqrt28pd)もあります。

KNCにあった、log2 はリストラされたようです。さようなら…

明日は、@tanakmura が vplzcntd について書きます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0