Use SIMD-instructions in half-precision floats with AVX instruction set
This commit is contained in:
@@ -6,13 +6,23 @@
|
|||||||
#include "Vector2.h"
|
#include "Vector2.h"
|
||||||
#include "Vector3.h"
|
#include "Vector3.h"
|
||||||
|
|
||||||
|
#if PLATFORM_SIMD_AVX
|
||||||
|
// MSVC generates slower code without AVX
|
||||||
|
#define USE_SSE_HALF_CONVERSION 1
|
||||||
|
#else
|
||||||
|
#define USE_SSE_HALF_CONVERSION 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_SSE_HALF_CONVERSION
|
||||||
|
#include <intrin.h>
|
||||||
|
#include <emmintrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Half-precision 16 bit floating point number consisting of a sign bit, a 5 bit biased exponent, and a 10 bit mantissa
|
/// Half-precision 16 bit floating point number consisting of a sign bit, a 5 bit biased exponent, and a 10 bit mantissa
|
||||||
/// </summary>
|
/// </summary>
|
||||||
typedef uint16 Half;
|
typedef uint16 Half;
|
||||||
|
|
||||||
#define USE_SSE_HALF_CONVERSION 0
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Utility for packing/unpacking floating point value from single precision (32 bit) to half precision (16 bit).
|
/// Utility for packing/unpacking floating point value from single precision (32 bit) to half precision (16 bit).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user