X86-64 SIMD编程与汇编代码优化
1. X86-64 SIMD编程示例
在X86 - 64环境下,有一个名为 Avx64MiscInstructions 的示例程序,它展示了如何在64位汇编语言函数中使用选择收集和半精度浮点指令。
1.1 C++代码分析
Avx64MiscInstructions.cpp 文件包含了两个关键函数: Avx64GatherFloat 和 Avx64HalfPrecision 。
#include "stdafx.h"
#include "MiscDefs.h"
#define _USE_MATH_DEFINES
#include <math.h>
extern "C" void Avx64GatherFloatIndx32_(float g[8], const float* x, Int32 indices[8]);
extern "C" void Avx64GatherFloatIndx64_(float g[4], const float* x, Int64 indices[4]);
extern "C" void Avx64FloatToHp_(Uint16 x_hp[8], float x1[8]);
extern "C" void Avx64HpToFloat_(float x[8], Uint16 x_hp[8]);
void Avx64GatherFloat(void)
{
const int n = 20
超级会员免费看
订阅专栏 解锁全文
43

被折叠的 条评论
为什么被折叠?



