mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Cleanup.
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
#ifndef BX_SIMD_LANGEXT_H_HEADER_GUARD
|
||||
#define BX_SIMD_LANGEXT_H_HEADER_GUARD
|
||||
#ifndef BX_SIMD128_LANGEXT_H_HEADER_GUARD
|
||||
#define BX_SIMD128_LANGEXT_H_HEADER_GUARD
|
||||
|
||||
#define float4_rcp float4_rcp_ni
|
||||
#define float4_orx float4_orx_ni
|
||||
@@ -512,4 +512,4 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw , 0xf);
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_SIMD_LANGEXT_H_HEADER_GUARD
|
||||
#endif // BX_SIMD128_LANGEXT_H_HEADER_GUARD
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
#ifndef BX_SIMD_NEON_H_HEADER_GUARD
|
||||
#define BX_SIMD_NEON_H_HEADER_GUARD
|
||||
#ifndef BX_SIMD128_NEON_H_HEADER_GUARD
|
||||
#define BX_SIMD128_NEON_H_HEADER_GUARD
|
||||
|
||||
#define simd_rcp simd_rcp_ni
|
||||
#define simd_orx simd_orx_ni
|
||||
@@ -50,7 +50,7 @@ namespace bx
|
||||
return __builtin_shuffle(_a, (uint32x4_t){ ELEM##_x, ELEM##_y, ELEM##_z, ELEM##_w }); \
|
||||
}
|
||||
|
||||
#include "simd_swizzle.inl"
|
||||
#include "simd128_swizzle.inl"
|
||||
|
||||
#undef BX_SIMD128_IMPLEMENT_SWIZZLE
|
||||
#undef ELEMw
|
||||
@@ -559,4 +559,4 @@ BX_SIMD128_IMPLEMENT_TEST(yzw, yzww);
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_SIMD_NEON_H_HEADER_GUARD
|
||||
#endif // BX_SIMD128_NEON_H_HEADER_GUARD
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
#ifndef BX_SIMD_REF_H_HEADER_GUARD
|
||||
#define BX_SIMD_REF_H_HEADER_GUARD
|
||||
#ifndef BX_SIMD128_REF_H_HEADER_GUARD
|
||||
#define BX_SIMD128_REF_H_HEADER_GUARD
|
||||
|
||||
#include <math.h> // sqrtf
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace bx
|
||||
return result; \
|
||||
}
|
||||
|
||||
#include "simd_swizzle.inl"
|
||||
#include "simd128_swizzle.inl"
|
||||
|
||||
#undef BX_SIMD128_IMPLEMENT_SWIZZLE
|
||||
#undef ELEMw
|
||||
@@ -647,4 +647,4 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw , 0xf);
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_SIMD_REF_H_HEADER_GUARD
|
||||
#endif // BX_SIMD128_REF_H_HEADER_GUARD
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
#ifndef BX_SIMD_SSE_H_HEADER_GUARD
|
||||
#define BX_SIMD_SSE_H_HEADER_GUARD
|
||||
#ifndef BX_SIMD128_SSE_H_HEADER_GUARD
|
||||
#define BX_SIMD128_SSE_H_HEADER_GUARD
|
||||
|
||||
#include "simd_ni.inl"
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace bx
|
||||
return _mm_shuffle_ps( _a, _a, _MM_SHUFFLE(ELEM##_w, ELEM##_z, ELEM##_y, ELEM##_x ) ); \
|
||||
}
|
||||
|
||||
#include "simd_swizzle.inl"
|
||||
#include "simd128_swizzle.inl"
|
||||
|
||||
#undef BX_SIMD128_IMPLEMENT_SWIZZLE
|
||||
#undef ELEMw
|
||||
@@ -644,4 +644,4 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw , 0xf);
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_SIMD_SSE_H_HEADER_GUARD
|
||||
#endif // BX_SIMD128_SSE_H_HEADER_GUARD
|
||||
|
||||
9
include/bx/simd256_avx.inl
Normal file
9
include/bx/simd256_avx.inl
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
#ifndef BX_SIMD256_AVX_H_HEADER_GUARD
|
||||
#define BX_SIMD256_AVX_H_HEADER_GUARD
|
||||
|
||||
#endif // BX_SIMD256_AVX_H_HEADER_GUARD
|
||||
9
include/bx/simd256_ref.inl
Normal file
9
include/bx/simd256_ref.inl
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
#ifndef BX_SIMD256_REF_H_HEADER_GUARD
|
||||
#define BX_SIMD256_REF_H_HEADER_GUARD
|
||||
|
||||
#endif // BX_SIMD256_REF_H_HEADER_GUARD
|
||||
@@ -11,10 +11,16 @@
|
||||
#define BX_SIMD_FORCE_INLINE BX_FORCE_INLINE
|
||||
#define BX_SIMD_INLINE inline
|
||||
|
||||
#define BX_SIMD_SSE 0
|
||||
#define BX_SIMD_AVX 0
|
||||
#define BX_SIMD_NEON 0
|
||||
#define BX_SIMD_LANGEXT 0
|
||||
#define BX_SIMD_NEON 0
|
||||
#define BX_SIMD_SSE 0
|
||||
|
||||
#if defined(__AVX__) || defined(__AVX2__)
|
||||
# include <immintrin.h>
|
||||
# undef BX_SIMD_AVX
|
||||
# define BX_SIMD_AVX 1
|
||||
#endif //
|
||||
|
||||
#if defined(__SSE2__) || (BX_COMPILER_MSVC && (BX_ARCH_64BIT || _M_IX86_FP >= 2) )
|
||||
# include <emmintrin.h> // __m128i
|
||||
@@ -46,7 +52,7 @@ namespace bx
|
||||
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
|
||||
template<typename Ty> \
|
||||
BX_SIMD_FORCE_INLINE Ty simd_swiz_##_x##_y##_z##_w(Ty _a);
|
||||
#include "simd_swizzle.inl"
|
||||
#include "simd128_swizzle.inl"
|
||||
|
||||
#undef BX_SIMD128_IMPLEMENT_SWIZZLE
|
||||
#undef ELEMw
|
||||
@@ -321,14 +327,10 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw);
|
||||
template<typename Ty>
|
||||
BX_SIMD_INLINE Ty simd_floor(Ty _a);
|
||||
|
||||
#if BX_SIMD_SSE
|
||||
typedef __m128 simd128_sse_t;
|
||||
#if BX_SIMD_AVX
|
||||
typedef __m256 simd256_avx_t;
|
||||
#endif // BX_SIMD_SSE
|
||||
|
||||
#if BX_SIMD_NEON
|
||||
typedef float32x4_t simd128_neon_t;
|
||||
#endif // BX_SIMD_NEON
|
||||
|
||||
#if BX_SIMD_LANGEXT
|
||||
union simd128_langext_t
|
||||
{
|
||||
@@ -342,6 +344,14 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw);
|
||||
};
|
||||
#endif // BX_SIMD_LANGEXT
|
||||
|
||||
#if BX_SIMD_NEON
|
||||
typedef float32x4_t simd128_neon_t;
|
||||
#endif // BX_SIMD_NEON
|
||||
|
||||
#if BX_SIMD_SSE
|
||||
typedef __m128 simd128_sse_t;
|
||||
#endif // BX_SIMD_SSE
|
||||
|
||||
union simd128_ref_t
|
||||
{
|
||||
float fxyzw[4];
|
||||
@@ -352,26 +362,31 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw);
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#if BX_SIMD_SSE
|
||||
# include "simd128_sse.inl"
|
||||
#endif // BX_SIMD_SSE
|
||||
|
||||
#if BX_SIMD_NEON
|
||||
# include "simd128_neon.inl"
|
||||
#endif // BX_SIMD_NEON
|
||||
#if BX_SIMD_AVX
|
||||
# include "simd256_avx.inl"
|
||||
#endif // BX_SIMD_AVX
|
||||
|
||||
#if BX_SIMD_LANGEXT
|
||||
# include "simd128_langext.inl"
|
||||
#endif // BX_SIMD_LANGEXT
|
||||
|
||||
#if BX_SIMD_NEON
|
||||
# include "simd128_neon.inl"
|
||||
#endif // BX_SIMD_NEON
|
||||
|
||||
#if BX_SIMD_SSE
|
||||
# include "simd128_sse.inl"
|
||||
#endif // BX_SIMD_SSE
|
||||
|
||||
#include "simd128_ref.inl"
|
||||
#include "simd256_ref.inl"
|
||||
|
||||
namespace bx
|
||||
{
|
||||
#if !( BX_SIMD_SSE \
|
||||
|| BX_SIMD_AVX \
|
||||
|| BX_SIMD_NEON \
|
||||
#if !( BX_SIMD_AVX \
|
||||
|| BX_SIMD_LANGEXT \
|
||||
|| BX_SIMD_NEON \
|
||||
|| BX_SIMD_SSE \
|
||||
)
|
||||
# ifndef BX_SIMD_WARN_REFERENCE_IMPL
|
||||
# define BX_SIMD_WARN_REFERENCE_IMPL 0
|
||||
@@ -418,6 +433,6 @@ namespace bx
|
||||
{
|
||||
return simd_isplat<simd128_t>(_a);
|
||||
}
|
||||
}
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_SIMD_T_H_HEADER_GUARD
|
||||
|
||||
@@ -98,7 +98,7 @@ TEST(simd_swizzle)
|
||||
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
|
||||
simd_check_string("" #_x #_y #_z #_w "", simd_swiz_##_x##_y##_z##_w(xyzw) ); \
|
||||
|
||||
#include <bx/simd_swizzle.inl>
|
||||
#include <bx/simd128_swizzle.inl>
|
||||
|
||||
#undef BX_SIMD128_IMPLEMENT_SWIZZLE
|
||||
#undef ELEMw
|
||||
|
||||
Reference in New Issue
Block a user