nlib
nn::nlib::simd 名前空間

整数、単精度浮動小数点数のSIMD演算を行うためのクラスや関数が実装されています。 [詳解]

クラス

class  AxisAlignedBox
 3次元空間におけるAABB(軸並行境界ボックス)を表すクラスです。最小座標(point_min)と最大座標(point_max)をデータメンバに持ちます。 [詳解]
 
class  Containment
 包含関係の判定を行う関数をまとめたクラスです。 [詳解]
 
class  DistanceSq
 距離(の2乗)の計算を行う関数をまとめたクラスです。 [詳解]
 
struct  each_float_tag
 空の構造体で単精度浮動小数点数を示すためのタグです。 [詳解]
 
struct  each_int16_tag
 空の構造体で16bitの符号付き整数を示すためのタグです。 [詳解]
 
struct  each_int32_tag
 空の構造体で32bitの符号付き整数を示すためのタグです。 [詳解]
 
struct  each_int64_tag
 空の構造体で64bitの符号付き整数を示すためのタグです。 [詳解]
 
struct  each_int8_tag
 空の構造体で8bitの符号付き整数を示すためのタグです。 [詳解]
 
struct  each_select16_tag
 空の構造体で16bit単位に分けたレーンを選択することを示すためのタグです。 [詳解]
 
struct  each_select32_tag
 空の構造体で32bit単位に分けたレーンを選択することを示すためのタグです。 [詳解]
 
struct  each_select8_tag
 空の構造体で8bit単位に分けたレーンを選択することを示すためのタグです。 [詳解]
 
struct  each_uint16_tag
 空の構造体で16bitの符号なし整数を示すためのタグです。 [詳解]
 
struct  each_uint32_tag
 空の構造体で32bitの符号なし整数を示すためのタグです。 [詳解]
 
struct  each_uint64_tag
 空の構造体で64bitの符号なし整数を示すためのタグです。 [詳解]
 
struct  each_uint8_tag
 空の構造体で8bitの符号なし整数を示すためのタグです。 [詳解]
 
class  F128
 128bitレジスタ(SSEではXMM0-XMM15, NEONではQ0-Q15)を用いて単精度浮動小数点数のSIMD演算を行うためのクラスです。 [詳解]
 
struct  Float3
 3次元ベクトルをメモリから読み出したりメモリに書き出したりするための型です。float型のx, y, zをデータメンバとして保持します。 [詳解]
 
struct  Float3x3
 3x3行列をメモリから読み出したりメモリに書き出したりするための型です。データメンバmは3x3の配列です。 [詳解]
 
struct  Float3x4
 3x4行列をメモリから読み出したりメモリに書き出したりするための型です。データメンバmは3x4の配列で16バイトアライメントに配置されます。 [詳解]
 
struct  Float4
 4次元ベクトルをメモリから読み出したりメモリに書き出したりするための型です。float型のx, y, z, wをデータメンバとして保持します。 [詳解]
 
struct  Float4x3
 4x3行列をメモリから読み出したりメモリに書き出したりするための型です。データメンバmは4x3の配列で16バイトアライメントに配置されます。 [詳解]
 
struct  Float4x4
 4x4行列をメモリから読み出したりメモリに書き出したりするための型です。データメンバmは4x4の配列で16バイトアライメントに配置されます。 [詳解]
 
class  Frustum
 視錐台を表すクラスです。 [詳解]
 
class  I128
 128bitレジスタ(SSEではXMM0-XMM15, NEONではQ0-Q15)を用いた整数SIMD演算を行うためのクラスです。 [詳解]
 
class  I64
 64bit幅での I128 と同様の整数SIMD演算を行うためのクラスです。 [詳解]
 
class  Intersection
 交差の判定を行う関数をまとめたクラスです。 [詳解]
 
class  Matrix
 4x4行列を扱う関数が集められたクラスです。 [詳解]
 
class  OrientedBox
 OBB(有向境界ボックス)を表すクラスです。中心座標(center)とxyz軸方向の大きさ(extent)及び回転クォータニオン(rotation)をデータメンバに持ちます。 [詳解]
 
class  Plane
 3次元空間上の平面を扱う関数が集められたクラスです。 [詳解]
 
class  Quaternion
 クォータニオンを扱う関数が集められたクラスです。 [詳解]
 
struct  SimdMatrix
 4x4行列を保持する構造体です。 [詳解]
 
class  Sphere
 3次元空間上の球を扱う静的メンバ関数が集められたクラスです。このクラスはインスタンス化できません。 [詳解]
 
class  Vector3
 3次元ベクトルの計算を行う関数が集められたクラスです。全ての関数でレーン3に設定された値は無視されます。 [詳解]
 
class  Vector4
 4次元ベクトルの計算を行う関数が集められたクラスです。 [詳解]
 

型定義

typedef nlib_f128_t f128
 nlib_f128_ttypedefされています。
 
typedef nlib_f128x2_t f128x2
 nlib_f128x2_ttypedefされています。
 
typedef const f128 f128arg
 const f128, 又はconst f128&typedefされています。
 
typedef f128 SimdVector
 f128typedefされています。3次元ベクトル又は4次元ベクトルを扱う場合に利用されます。
 
typedef f128arg SimdVectorArg
 f128argtypedefされています。
 
typedef f128 SimdQuaternion
 f128typedefされています。クォータニオンを扱う場合に利用されます。
 
typedef f128arg SimdQuaternionArg
 f128argtypedefされています。
 
typedef f128 SimdPlane
 f128typedefされています。平面を扱う場合に利用されます。
 
typedef f128arg SimdPlaneArg
 f128argtypedefされています。
 
typedef f128 SimdSphere
 f128typedefされています。球を扱う場合に利用されます。
 
typedef f128arg SimdSphereArg
 f128argtypedefされています。
 
typedef nlib_i64_t i64
 nlib_i64_ttypedefされています。
 
typedef nlib_i128_t i128
 nlib_i128_ttypedefされています。
 

関数

template<size_t NumElem>
void MergeSortUint32A16 (uint32_t *data)
 SIMDを利用して32bit符号なし整数の並びをマージソートします。 [詳解]
 
template<class PRED >
const void * nlib_memchr_pred (const void *s, PRED pred, size_t n)
 バイト列内のバイトの検査をSIMD命令を使って行うための関数テンプレートです。 [詳解]
 
template<class PRED >
const void * nlib_memchr_pred_not (const void *s, PRED pred, size_t n)
 バイト列内のバイトの検査をSIMD命令を使って行うための関数テンプレートです。 [詳解]
 
i128 IsAlpha (i128 c) noexcept
 c 内のアルファベットをマスクします。
 
i128 IsDigit (i128 c) noexcept
 c 内の'0'-'9'の文字をマスクします。
 
i128 IsAlnum (i128 c) noexcept
 c 内のアルファベットか'0'-'9'の文字をマスクします。
 
i128 IsSpace (i128 c) noexcept
 c 内の空白文字(0x20, 0x09, 0x0A, 0x0D)をマスクします。
 
i128 IsXdigit (i128 c) noexcept
 c 内の16進数の文字をマスクします。
 

変数

タグ定数
constexpr const each_float_tag each_float = {}
 each_float_tag型の定数オブジェクトで、単精度浮動小数点数を示すためのタグです。
 
constexpr const each_int8_tag each_int8 = {}
 each_int8_tag型の定数オブジェクトで、8bitの符号付き整数を示すためのタグです。
 
constexpr const each_int16_tag each_int16 = {}
 each_int16_tag型の定数オブジェクトで、16bitの符号付き整数を示すためのタグです。
 
constexpr const each_int32_tag each_int32 = {}
 each_int32_tag型の定数オブジェクトで、32bitの符号付き整数を示すためのタグです。
 
constexpr const each_int64_tag each_int64 = {}
 each_int64_tag型の定数オブジェクトで、64bitの符号付き整数を示すためのタグです。
 
constexpr const each_uint8_tag each_uint8 = {}
 each_uint8_tag型の定数オブジェクトで、8bitの符号なし整数を示すためのタグです。
 
constexpr const each_uint16_tag each_uint16 = {}
 each_uint16_tag型の定数オブジェクトで、16bitの符号なし整数を示すためのタグです。
 
constexpr const each_uint32_tag each_uint32 = {}
 each_uint32_tag型の定数オブジェクトで、32bitの符号なし整数を示すためのタグです。
 
constexpr const each_uint64_tag each_uint64 = {}
 each_uint64_tag型の定数オブジェクトで、64bitの符号なし整数を示すためのタグです。
 
constexpr const each_select32_tag each_select32 = {}
 each_select32_tag型の定数オブジェクトで、32bitのレーンを選択することを示すためのタグです。
 
constexpr const each_select16_tag each_select16 = {}
 each_select16_tag型の定数オブジェクトで、16bitのレーンを選択することを示すためのタグです。
 
constexpr const each_select8_tag each_select8 = {}
 each_select8_tag型の定数オブジェクトで、8bitのレーンを選択することを示すためのタグです。
 

詳解

整数、単精度浮動小数点数のSIMD演算を行うためのクラスや関数が実装されています。

説明
SIMD演算に対応しているアーキテクチャではSIMD演算を行うことでそうでない場合に比較して性能を大幅に向上(最大10倍程度, 大抵は2-3倍程度)させることが可能です。
これらはintrinsicsを直接用いて各SIMDアーキテクチャ毎に実装することも可能ですが、複数のSIMDアーキテクチャに対応したライブラリを用いてコードを記述することでコーディングの生産性を高めることが可能です。
nlibsimdライブラリはSSE4.1とNEON(現在はIntel社より配布されているNEONvsSSE.hを用いてテストされている)に対応していて、このライブラリを利用してコードを書くことで、SSE4.1とNEONの両方に対応したプログラムを開発することができます。
参照
https://software.intel.com/en-us/blogs/2012/12/12/from-arm-neon-to-intel-mmxsse-automatic-porting-solution-tips-and-tricks
I128, I64
simdライブラリに含まれるI128, I64は8/16/32/64bit幅の整数に対するSIMD演算を行うためのクラスで、静的メンバ関数のみから構成されるクラスです。
以下のような計算がサポートされています。
  • 64/128bit値の設定
  • 64/128bit値のアライメントを指定したメモリからのロードとストア
  • 64/128bit値の中の特定の8/16/32/64bit幅の値(値の場所をレーンと呼ぶ)の取得と設定
  • 8/16/32/64bit幅の加減算、乗算、積和演算及び水平加算
  • 8/16/32/64bit幅での最大・最小及び絶対値の計算
  • 128bit値に対する論理演算
  • 8/16/32bit幅の値に対する比較演算によるマスクの作成
  • 8/16/32/64bit幅毎のbit単位のシフト
  • 128bit値に対するバイト単位のシフトとローテート
  • 各レーンのbit幅の変更
  • 各レーンの並べ替え
  • 16/32/64bit幅の値に対するエンディアンの変換
  • その他
F128
同じくsimdライブラリに含まれるF128は4個の単精度浮動小数点数に対するSIMD演算を行うためのクラスで、これも静的メンバ関数のみから構成されるクラスです。
以下のような計算がサポートされています。
  • 4つの単精度浮動小数点数の設定
  • アライメントを指定したメモリからのロードとストア
  • 特定のレーンにある単精度浮動小数点数の取得と設定
  • 整数値への変換とキャスト、及び整数値からの変換とキャスト
  • 加減乗除、積和演算及び水平加算
  • 最大値、最小値と絶対値の計算
  • 値のクランプ
  • 逆数、平方根、平方根の逆数
  • 各種丸め
  • 128bit値に対する論理演算
  • 比較演算によるマスクの作成
  • 三角関数
  • 各種補間
  • 1つの128bitレジスタの4つの単精度浮動小数点数に対する任意の高速な並べ替え
  • 2つの128bitレジスタの8つの単精度浮動小数点数から任意の4つの単精度浮動小数点数の高速な選択
また、F128 はSSE及びNEONが利用できない環境でも利用することが可能です(ただし性能は高くありません)。
SIMD用の関数が新たに必要な理由
従来のベクトルや行列用の関数の仕様を維持したまま、内部をSIMD対応にする方が適切だと思われる方がいるかもしれません。
しかしそれは違います。以下に簡単に説明をします。
通常、コーディングする際には、16バイトのデータを値渡ししたり値返ししたりすることはありません。 そのようなデータを扱う際には具体的には次のような関数プロトタイプになるはずです。
void doSomething(VEC4* result, const VEC4& a, const VEC4& b);
入力となる引数a, bには16バイトのデータへのポインタを入れておき関数を呼び出すことでa, bがポイントする合計32バイトのデータをスタックに積むことなく関数を呼び出して、関数内部でポインタ経由でメモリから16バイトずつロードして利用するようにしてます。
また、戻り値についても値返ししないことで、スタックの利用を抑制します。
ところが、SSEやNEONでは16バイトのデータを1つのレジスタ(値引数)に格納してしまうことができるので、VEC4のデータ2つならば、レジスタ2つで値渡しが可能になります。 戻り値についても同様です。
そういう状況では、間接参照にすることによるロードとストアはオーバーヘッドでしかありません。 従って、次のような関数プロトタイプにしたほうがよい、という結論になります。
VEC4 doSomething(VEC4 a, VEC4 b);
これが新たにSIMD用の関数を設計しなくてはならない理由となります。
DirectXMathとの対応表
以下にマイクロソフト社のDirectXMathの関数がnlibのSIMDライブラリのどの関数に対応するか表にまとめてあります。
なお、引数の順序や計算結果がDirectXMathのものと一致しない場合があることに注意してください。
DirectXMath (Vector Functions) nlibのSIMDライブラリ
Vector Arithmetic Functions
XMVectorAbs F128::Abs()
XMVectorAdd F128::Add()
XMVectorAddAngles F128::AddAngle()
XMVectorCeiling F128::Ceil()
XMVectorClamp F128::Clamp()
XMVectorDivide F128::Div()
XMVectorFloor F128::Floor()
XMVectorIsInfinite F128::IsInfinite()
XMVectorIsNaN F128::IsNaN()
XMVectorMax F128::Max()
XMVectorMin F128::Min()
XMVectorMod
XMVectorModAngles F128::ModAngle()
XMVectorMultiply F128::Mult()
XMVectorMultiplyAdd F128::MultAdd()
XMVectorNegate F128::Negate()
XMVectorNegativeMultiplySubtract F128::MultSub()
XMVectorPow
XMVectorReciprocal F128::Recp()
XMVectorReciprocalEst F128::RecpEst()
XMVectorReciprocalSqrt F128::RecpSqrt()
XMVectorReciprocalSqrtEst F128::RecpSqrtEst()
XMVectorRound F128::Round()
XMVectorSaturate F128::Saturate()
XMVectorScale F128::Mult()
XMVectorSqrt F128::Sqrt()
XMVectorSqrtEst F128::SqrtEst()
XMVectorSubtract F128::Sub()
XMVectorSubtractAngles F128::SubAngle()
XMVectorTruncate F128::Truncate()
Bit-Wise Vector Functions
XMVectorAndCInt F128::AndNot()
XMVectorAndInt F128::And()
XMVectorNorInt F128::Or(), F128::Not()
XMVectorNotEqual F128::CmpNe()
XMVectorNotEqualInt F128::CastToI128(), F128::CmpEq(), F128::Not()
XMVectorOrInt F128::Or()
XMVectorXorInt F128::Xor()
Vector Comparison Functions
XMVectorEqual F128::CmpEq()
XMVectorEqualInt F128::CastToI128(), I128::CmpEq32()
XMVectorGreater F128::CmpGt()
XMVectorGreaterOrEqual F128::CmpGe()
XMVectorLess F128::CmpLt()
XMVectorLessOrEqual F128::CmpLe()
XMVectorNearEqual F128::CmpNearEq()
Component-Wise Vector Functions
XMVectorMergeXY F128::Permute<0, 4, 1, 5>()
XMVectorMergeZW F128::Permute<2, 6, 3, 7>()
XMVectorPermute 関数テンプレートとして実装
XMVectorRotateLeft 関数テンプレートとして実装
XMVectorRotateRight 関数テンプレートとして実装
XMVectorSelect F128::Select()
XMVectorSelectControl I128::SetValue(uint32_t v, each_uint32_tag), F128::CastFromI128()
XMVectorShiftLeft 関数テンプレートとして実装
XMVectorSplatW F128::SetValue<3>(f128 value, each_select32_tag)
XMVectorSplatX F128::SetValue<0>(f128 value, each_select32_tag)
XMVectorSplatY F128::SetValue<1>(f128 value, each_select32_tag)
XMVectorSplatZ F128::SetValue<2>(f128 value, each_select32_tag)
XMVectorSwizzle 関数テンプレートとして実装
Geometric Vector Functions
XMVectorBaryCentricV F128::BaryCentric()
XMVectorCatmullRomV F128::CatmullRom()
XMVectorHermiteV F128::Hermite()
XMVectorInBounds F128::InBound()
XMVectorLerpV F128::Lerp()
Vector Initialization Functions
XMVectorFalseInt F128::SetZero()
XMVectorReplicate F128::SetValue(float v, each_float_tag)
XMVectorReplicateInt F128::SetValue(uint32_t v, each_uint32_tag)
XMVectorSet F128::SetValue(float a, float b, float c, float d)
XMVectorSetInt
XMVectorSplatConstant
XMVectorSplatConstantInt
XMVectorSplatEpsilon F128::SetValue(uint32_t v, each_uint32_tag), v = 0x34000000U
XMVectorSplatInfinity F128::SetValue(uint32_t v, each_uint32_tag), v = 0x7F800000U
XMVectorSplatOne F128::SetOne()
XMVectorSplatQNaN F128::SetValue(uint32_t v, each_uint32_tag), v = 0x7FC00000U
XMVectorSplatSignMask F128::SetValue(uint32_t v, each_uint32_tag), v = 0x80000000U
XMVectorTrueInt F128::SetValue(uint32_t v, each_uint32_tag), v = 0xFFFFFFFFU
XMVectorZero F128::SetZero()
Transcendental Vector Functions
XMVectorACos F128::ArcCos()
XMVectorASin F128::ArcSin()
XMVectorATan F128::ArcTan()
XMVectorATan2 F128::ArcTan2()
XMVectorCos F128::Cos()
XMVectorCosH F128::CosH()
XMVectorExp F128::Exp2()
XMVectorExp2 F128::Exp2()
XMVectorExpE F128::ExpE()
XMVectorLog F128::Log2()
XMVectorLog2 F128::Log2()
XMVectorLogE F128::LogE()
XMVectorSin F128::Sin()
XMVectorSinCos F128::SinCos()
XMVectorSinH F128::SinH()
XMVectorTan F128::Tan()
XMVectorTanH F128::TanH()
DirectXMath (DirectXMath Library Template Functions) nlibのSIMDライブラリ
XMVectorPermute F128::Permute()
XMVectorRotateLeft F128::RotateRight(), not typo
XMVectorRotateRight F128::RotateLeft(), not typo
XMVectorShiftLeft F128::ShiftRight(), not typo
XMVectorSwizzle F128::Swizzle()
DirectXMath (DirectXMath Library Vector Accessor Functions) nlibのSIMDライブラリ
XMVectorGetByIndex F128::GetFloatByIndex()
XMVectorGetIntByIndex F128::GetUint32ByIndex()
XMVectorGetIntW F128::CastToI128(), I128::GetUint32FromLane<3>()
XMVectorGetIntX F128::CastToI128(), I128::GetUint32FromLane<0>()
XMVectorGetIntY F128::CastToI128(), I128::GetUint32FromLane<1>()
XMVectorGetIntZ F128::CastToI128(), I128::GetUint32FromLane<2>()
XMVectorGetW F128::GetFloatFromLane<3>()
XMVectorGetX F128::GetFloatFromLane<0>()
XMVectorGetY F128::GetFloatFromLane<1>()
XMVectorGetZ F128::GetFloatFromLane<2>()
XMVectorSetByIndex F128::SetFloatByIndex()
XMVectorSetIntByIndex
XMVectorSetIntW F128::CastToI128(), I128::SetUint32ToLane<3>()
XMVectorSetIntX F128::CastToI128(), I128::SetUint32ToLane<0>()
XMVectorSetIntY F128::CastToI128(), I128::SetUint32ToLane<1>()
XMVectorSetIntZ F128::CastToI128(), I128::SetUint32ToLane<2>()
XMVectorSetW F128::SetFloatToLane<3>()
XMVectorSetX F128::SetFloatToLane<0>()
XMVectorSetY F128::SetFloatToLane<1>()
XMVectorSetZ F128::SetFloatToLane<2>()
DirectXMath (4D Vector Functions) nlibのSIMDライブラリ
4D Vector Comparison Functions
XMVector4Equal Vector4::CmpEq()
XMVector4Greater Vector4::CmpGt()
XMVector4GreaterOrEqual Vector4::CmpGe()
XMVector4IsInfinite Vector4::IsInfinite()
XMVector4IsNaN Vector4::IsNaN()
XMVector4Less Vector4::CmpLt()
XMVector4LessOrEqual Vector4::CmpLe()
XMVector4NotEqual Vector4::CmpNe()
4D Vector Geometric Functions
XMVector4AngleBetweenNormals Vector4::GetAngle()
XMVector4Dot Vector4::Dot()
XMVector4InBounds Vector4::InBound()
XMVector4Length Vector4::Length()
XMVector4LengthEst Vector4::LengthEst()
XMVector4LengthSq Vector4::LengthSq()
XMVector4Normalize Vector4::Normalize()
XMVector4NormalizeEst Vector4::NormalizeEst()
XMVector4ReciprocalLength Vector4::RecpLength()
XMVector4ReciprocalLengthEst Vector4::RecpLengthEst()
XMVector4Reflect Vector4::Reflect()
4D Vector Transformation Functions
XMVector4Transform Vector4::Transform()
DirectXMath (3D Vector Functions) nlibのSIMDライブラリ
3D Vector Comparison Functions
XMVector3Equal Vector3::CmpEq()
XMVector3Greater Vector3::CmpGt()
XMVector3GreaterOrEqual Vector3::CmpGe()
XMVector3IsInfinite Vector3::IsInfinite()
XMVector3IsNaN Vector3::IsNaN()
XMVector3Less Vector3::CmpLt()
XMVector3LessOrEqual Vector3::CmpLe()
XMVector3NotEqual Vector3::CmpNe()
3D Vector Geometric Functions
XMVector3AngleBetweenNormals Vector3::GetAngle()
XMVector3Cross Vector3::Cross()
XMVector3Dot Vector3::Dot()
XMVector3InBounds Vector3::InBound()
XMVector3Length Vector3::Length()
XMVector3LengthEst Vector3::LengthEst()
XMVector3LengthSq Vector3::LengthSq()
XMVector3LinePointDistance DistanceSq::PointLine()
XMVector3Normalize Vector3::Normalize()
XMVector3NormalizeEst Vector3::NormalizeEst()
XMVector3Orthogonal
XMVector3ReciprocalLength Vector3::RecpLength()
XMVector3ReciprocalLengthEst Vector3::RecpLengthEst()
XMVector3Reflect Vector3::Reflect()
XMVector3Refract
3D Vector Transformation Functions
XMVector3InverseRotate Vector3::InvRotate()
XMVector3Project
XMVector3Rotate Vector3::Rotate()
XMVector3Transform Vector3::Transform()
XMVector3TransformCoord Vector3::TransformCoord()
XMVector3TransformNormal Vector3::TransformNormal()
XMVector3Unproject
DirectXMath (Plane Functions) nlibのSIMDライブラリ
XMPlaneDot Plane::Dot()
XMPlaneDotCoord Plane::DotCoord()
XMPlaneDotNormal Plane::DotNormal()
XMPlaneFromPointNormal Plane::FromPointAndNormal()
XMPlaneFromPoints Plane::FromPoint()
XMPlaneIntersectLine Intersection::PlaneLine()
XMPlaneIntersectPlane Intersection::PlanePlane()
XMPlaneNormalize Plane::Normalize()
XMPlaneNormalizeEst Plane::NormalizeEst()
XMPlaneTransform Plane::Transform()
DirectXMath (Quaternion Functions) nlibのSIMDライブラリ
XMQuaternionBaryCentric Quaternion::BaryCentric()
XMQuaternionConjugate Quaternion::Conjugate()
XMQuaternionDot Quaternion::Dot()
XMQuaternionEqual Quaternion::CmpEq()
XMQuaternionExp Quaternion::Exp()
XMQuaternionIdentity Quaternion::Identity()
XMQuaternionInverse Quaternion::Inverse()
XMQuaternionIsIdentity Quaternion::IsIdentity()
XMQuaternionIsInfinite Quaternion::IsInfinite()
XMQuaternionIsNaN Quaternion::IsNaN()
XMQuaternionLength Quaternion::Length()
XMQuaternionLengthSq Quaternion::LengthSq()
XMQuaternionLn Quaternion::Ln()
XMQuaternionMultiply Quaternion::Mult()
XMQuaternionNormalize Quaternion::Normalize()
XMQuaternionNormalizeEst Quaternion::NormalizeEst()
XMQuaternionNotEqual Quaternion::CmpNe()
XMQuaternionReciprocalLength Quaternion::RecpLength()
XMQuaternionRotationNormal Quaternion::FromRotationAxisAndSinCos()
XMQuaternionRotationMatrix Quaternion::FromRotationMatrix()
XMQuaternionRollPitchYawFromVector Quaternion::FromRotationZXY()
XMQuaternionSlerp Quaternion::Slerp()
XMQuaternionSquad Quaternion::Squad()
XMQuaternionSquadSetup Quaternion::SquadSetup()
XMQuaternionToAxisAngle Quaternion::ToAxisAngle()
DirectXMath (Matrix Functions) nlibのSIMDライブラリ
XMMatrixAffineTransformation
XMMatrixDecompose Matrix::Decompose()
XMMatrixDeterminant Matrix::Determinant()
XMMatrixIdentity Matrix::Identity()
XMMatrixInverse Matrix::Inverse()
XMMatrixIsIdentity Matrix::IsIdentity()
XMMatrixIsInfinite Matrix::IsInfinite()
XMMatrixIsNaN Matrix::IsNaN()
XMMatrixLookAtLH Matrix::LookAtLh()
XMMatrixLookAtRH Matrix::LookAtRh()
XMMatrixLookToLH Matrix::LookToLh()
XMMatrixLookToRH Matrix::LookToRh()
XMMatrixMultiply Matrix::Mult()
XMMatrixMultiplyTranspose Matrix::MultTranspose()
XMMatrixOrthographicLH Matrix::OrthographicLh()
XMMatrixOrthographicOffCenterLH Matrix::OrthographicOffCenterLh()
XMMatrixOrthographicOffCenterRH Matrix::OrthographicOffCenterRh()
XMMatrixOrthographicRH Matrix::OrthographicRh()
XMMatrixPerspectiveFovLH Matrix::PerspectiveFovLh()
XMMatrixPerspectiveFovRH Matrix::PerspectiveFovRh()
XMMatrixPerspectiveLH Matrix::PerspectiveLh()
XMMatrixPerspectiveOffCenterLH Matrix::PerspectiveOffCenterLh()
XMMatrixPerspectiveOffCenterRH Matrix::PerspectiveOffCenterRh()
XMMatrixPerspectiveRH Matrix::PerspectiveRh()
XMMatrixReflect Matrix::Reflect()
XMMatrixRotationNormal Matrix::FromRotationAxisAndSinCos()
XMMatrixRotationQuaternion Matrix::FromRotationQuaternion()
XMMatrixRotationRoolPitchYawFromVector Matrix::FromRotationZXY()
XMMatrixRotationX Matrix::FromRotationX()
XMMatrixRotationY Matrix::FromRotationY()
XMMatrixRotationZ Matrix::FromRotationZ()
XMMatrixScaling Matrix::FromScaling()
XMMatrixScalingFromVector Matrix::FromScaling()
XMMatrixShadow Matrix::Shadow()
XMMatrixTransformation
XMMatrixTranslation Matrix::FromTranslation()
XMMatrixTranslationFromVector Matrix::FromTranslation()
XMMatrixTranspose Matrix::Transpose()
DirectXMath (DirectXMath Library Vector Load Functions) nlibのSIMDライブラリ
XMLoadFloat F128::LoadA4()
XMLoadFloat4A F128::LoadA16()
XMLoadFloat3 Vector3::LoadFloat3()
XMLoadFloat4x4A Matrix::LoadFloat4x4()
XMLoadFloat4x3A Matrix::LoadFloat4x3()
XMLoadFloat3x3 Matrix::LoadFloat3x3()
DirectXMath (DirectXMath Library Vector Store Functions) nlibのSIMDライブラリ
XMStoreFloat F128::StoreA4()
XMStoreFloat4A F128::StoreA16()
XMStoreFloat3 Vector3::StoreFloat3()
XMStoreFloat4x4A Matrix::StoreFloat4x4()
XMStoreFloat4x3A Matrix::StoreFloat4x3()
XMStoreFloat3x3 Matrix::StoreFloat3x3()
DirectXMath (DirectXMath Library Classes) nlibのSIMDライブラリ
BoundingBox AxisAlignedBox
BoundingBox:: Intersects Intersection
BoundingBox:: Contains Containment
BoundingOrientedBox OrientedBox
BoundingOrientedBox:: Intersects Intersection
BoundingOrientedBox:: Contains Containment
BoundingSphere SimdSphere, Sphere
BoundingSphere:: Intersects Intersection
BoundingSphere:: Contains Containment
BoundingFrustum Frustum
BoundingFrustum:: Intersects Intersection
BoundingFrustum:: Contains Containment
DirectXMath (DirectXMath Triangle Test Functions) nlibのSIMDライブラリ
TriangleTests:: Intersects Intersection
DirectXMath (misc) nlibのSIMDライブラリ
_XM_NO_INTRINSICS_ NLIB_F128_SIMD_NOUSE

関数詳解

template<size_t NumElem>
nn::nlib::simd::MergeSortUint32A16 ( uint32_t *  data)
inline

SIMDを利用して32bit符号なし整数の並びをマージソートします。

テンプレート引数
NumElemソートされる要素の数。16の倍数である必要があります。
引数
[in]dataソートされる要素列へのポインタ
説明
SIMDを利用して32bit符号なし整数の高速なマージソートを行います。 要素数は16の倍数である必要があります。
一般にstd::sort()の速度は、標準ライブラリの実装や入力データの違いに影響を受けますが、64程度までの要素数ではstd::sort()の10倍程度、より大きな要素数ではstd::sort()の3-4倍程度の速度でソートを行うことができます (Visual Studio 2013での計測)。
ソートアルゴリズムの技術的な詳細は、Efficient Implementation of Sorting on Multi-Core SIMD CPU Architectureを参考にしてください。
なお、本関数はシングルスレッドで動作し、スレッドを立ち上げる等の動作は行いません。

SimdAlgorithm.h37 行目に定義があります。

template<class PRED >
nn::nlib::simd::nlib_memchr_pred ( const void *  s,
PRED  pred,
size_t  n 
)

バイト列内のバイトの検査をSIMD命令を使って行うための関数テンプレートです。

テンプレート引数
PREDi128型のバイト列を受け取ってi128型のマスクを返す関数の型
引数
[in]s検査対象のバイト列
[in]pred検査を行う関数又は関数オブジェクト
[in]n検査対象のバイト列の長さ
戻り値
NULLsNULLだった場合
NULLpred で探索していたバイトが見つからなかった場合
それ以外pred で探索していたバイトへのポインタ
説明
predI128::CmpEq8()等を利用して作成されたマスクを返す必要があります。
探索対象のバイトが0xFFとなるようマスクを作成します。
この関数は最初にマスクされたバイトへのポインタを返します。

SimdAlgorithm.h45 行目に定義があります。

template<class PRED >
nn::nlib::simd::nlib_memchr_pred_not ( const void *  s,
PRED  pred,
size_t  n 
)

バイト列内のバイトの検査をSIMD命令を使って行うための関数テンプレートです。

テンプレート引数
PREDi128型のバイト列を受け取ってi128型のマスクを返す関数の型
引数
[in]s検査対象のバイト列
[in]pred検査を行う関数又は関数オブジェクト
[in]n検査対象のバイト列の長さ
戻り値
NULLsNULLだった場合
NULLpred で探索していたバイトが見つからなかった場合
それ以外pred で探索していたバイトへのポインタ
説明
predI128::CmpEq8()等を利用して作成されたマスクを返す必要があります。
探索対象のバイトが0xFFとなるようマスクを作成します。
この関数は最初にマスクされなかったバイトへのポインタを返します。

SimdAlgorithm.h116 行目に定義があります。