This commit is contained in:
Branimir Karadžić
2017-09-05 20:06:17 -07:00
parent 057f6b180c
commit c85624d79e
9 changed files with 90 additions and 90 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
@@ -13,13 +13,13 @@ namespace bx
#define ELEMy 1
#define ELEMz 2
#define ELEMw 3
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
template<> \
BX_SIMD_FORCE_INLINE simd128_langext_t simd_swiz_##_x##_y##_z##_w(simd128_langext_t _a) \
{ \
simd128_langext_t result; \
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
template<> \
BX_SIMD_FORCE_INLINE simd128_langext_t simd_swiz_##_x##_y##_z##_w(simd128_langext_t _a) \
{ \
simd128_langext_t result; \
result.vf = __builtin_shufflevector(_a.vf, _a.vf, ELEM##_x, ELEM##_y, ELEM##_z, ELEM##_w); \
return result; \
return result; \
}
#include "simd128_swizzle.inl"
@@ -30,27 +30,27 @@ namespace bx
#undef ELEMy
#undef ELEMx
#define BX_SIMD128_IMPLEMENT_TEST(_xyzw, _mask) \
template<> \
#define BX_SIMD128_IMPLEMENT_TEST(_xyzw, _mask) \
template<> \
BX_SIMD_FORCE_INLINE bool simd_test_any_##_xyzw(simd128_langext_t _test) \
{ \
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
| ( (_test.uxyzw[2]>>31)<<2) \
| ( (_test.uxyzw[1]>>31)<<1) \
| ( _test.uxyzw[0]>>31) \
; \
return 0 != (tmp&(_mask) ); \
} \
\
template<> \
{ \
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
| ( (_test.uxyzw[2]>>31)<<2) \
| ( (_test.uxyzw[1]>>31)<<1) \
| ( _test.uxyzw[0]>>31) \
; \
return 0 != (tmp&(_mask) ); \
} \
\
template<> \
BX_SIMD_FORCE_INLINE bool simd_test_all_##_xyzw(simd128_langext_t _test) \
{ \
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
| ( (_test.uxyzw[2]>>31)<<2) \
| ( (_test.uxyzw[1]>>31)<<1) \
| ( _test.uxyzw[0]>>31) \
; \
return (_mask) == (tmp&(_mask) ); \
{ \
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
| ( (_test.uxyzw[2]>>31)<<2) \
| ( (_test.uxyzw[1]>>31)<<1) \
| ( _test.uxyzw[0]>>31) \
; \
return (_mask) == (tmp&(_mask) ); \
}
BX_SIMD128_IMPLEMENT_TEST(x , 0x1);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
@@ -13,10 +13,10 @@ namespace bx
#define ELEMy 1
#define ELEMz 2
#define ELEMw 3
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
template<> \
BX_SIMD_FORCE_INLINE simd128_neon_t simd_swiz_##_x##_y##_z##_w(simd128_neon_t _a) \
{ \
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
template<> \
BX_SIMD_FORCE_INLINE simd128_neon_t simd_swiz_##_x##_y##_z##_w(simd128_neon_t _a) \
{ \
return __builtin_shuffle(_a, (uint32x4_t){ ELEM##_x, ELEM##_y, ELEM##_z, ELEM##_w }); \
}
@@ -28,19 +28,19 @@ namespace bx
#undef ELEMy
#undef ELEMx
#define BX_SIMD128_IMPLEMENT_TEST(_xyzw, _swizzle) \
template<> \
#define BX_SIMD128_IMPLEMENT_TEST(_xyzw, _swizzle) \
template<> \
BX_SIMD_FORCE_INLINE bool simd_test_any_##_xyzw(simd128_neon_t _test) \
{ \
const simd128_neon_t tmp0 = simd_swiz_##_swizzle(_test); \
return simd_test_any_ni(tmp0); \
} \
\
template<> \
{ \
const simd128_neon_t tmp0 = simd_swiz_##_swizzle(_test); \
return simd_test_any_ni(tmp0); \
} \
\
template<> \
BX_SIMD_FORCE_INLINE bool simd_test_all_##_xyzw(simd128_neon_t _test) \
{ \
const simd128_neon_t tmp0 = simd_swiz_##_swizzle(_test); \
return simd_test_all_ni(tmp0); \
{ \
const simd128_neon_t tmp0 = simd_swiz_##_swizzle(_test); \
return simd_test_all_ni(tmp0); \
}
BX_SIMD128_IMPLEMENT_TEST(x, xxxx);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
@@ -13,16 +13,16 @@ namespace bx
#define ELEMy 1
#define ELEMz 2
#define ELEMw 3
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
template<> \
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
template<> \
BX_SIMD_FORCE_INLINE simd128_ref_t simd_swiz_##_x##_y##_z##_w(simd128_ref_t _a) \
{ \
simd128_ref_t result; \
result.ixyzw[0] = _a.ixyzw[ELEM##_x]; \
result.ixyzw[1] = _a.ixyzw[ELEM##_y]; \
result.ixyzw[2] = _a.ixyzw[ELEM##_z]; \
result.ixyzw[3] = _a.ixyzw[ELEM##_w]; \
return result; \
{ \
simd128_ref_t result; \
result.ixyzw[0] = _a.ixyzw[ELEM##_x]; \
result.ixyzw[1] = _a.ixyzw[ELEM##_y]; \
result.ixyzw[2] = _a.ixyzw[ELEM##_z]; \
result.ixyzw[3] = _a.ixyzw[ELEM##_w]; \
return result; \
}
#include "simd128_swizzle.inl"
@@ -33,27 +33,27 @@ namespace bx
#undef ELEMy
#undef ELEMx
#define BX_SIMD128_IMPLEMENT_TEST(_xyzw, _mask) \
template<> \
#define BX_SIMD128_IMPLEMENT_TEST(_xyzw, _mask) \
template<> \
BX_SIMD_FORCE_INLINE bool simd_test_any_##_xyzw(simd128_ref_t _test) \
{ \
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
| ( (_test.uxyzw[2]>>31)<<2) \
| ( (_test.uxyzw[1]>>31)<<1) \
| ( _test.uxyzw[0]>>31) \
; \
return 0 != (tmp&(_mask) ); \
} \
\
template<> \
{ \
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
| ( (_test.uxyzw[2]>>31)<<2) \
| ( (_test.uxyzw[1]>>31)<<1) \
| ( _test.uxyzw[0]>>31) \
; \
return 0 != (tmp&(_mask) ); \
} \
\
template<> \
BX_SIMD_FORCE_INLINE bool simd_test_all_##_xyzw(simd128_ref_t _test) \
{ \
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
| ( (_test.uxyzw[2]>>31)<<2) \
| ( (_test.uxyzw[1]>>31)<<1) \
| ( _test.uxyzw[0]>>31) \
; \
return (_mask) == (tmp&(_mask) ); \
{ \
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
| ( (_test.uxyzw[2]>>31)<<2) \
| ( (_test.uxyzw[1]>>31)<<1) \
| ( _test.uxyzw[0]>>31) \
; \
return (_mask) == (tmp&(_mask) ); \
}
BX_SIMD128_IMPLEMENT_TEST(x , 0x1);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
@@ -13,10 +13,10 @@ namespace bx
#define ELEMy 1
#define ELEMz 2
#define ELEMw 3
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
template<> \
BX_SIMD_FORCE_INLINE simd128_sse_t simd_swiz_##_x##_y##_z##_w(simd128_sse_t _a) \
{ \
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
template<> \
BX_SIMD_FORCE_INLINE simd128_sse_t simd_swiz_##_x##_y##_z##_w(simd128_sse_t _a) \
{ \
return _mm_shuffle_ps( _a, _a, _MM_SHUFFLE(ELEM##_w, ELEM##_z, ELEM##_y, ELEM##_x ) ); \
}
@@ -28,17 +28,17 @@ namespace bx
#undef ELEMy
#undef ELEMx
#define BX_SIMD128_IMPLEMENT_TEST(_xyzw, _mask) \
template<> \
#define BX_SIMD128_IMPLEMENT_TEST(_xyzw, _mask) \
template<> \
BX_SIMD_FORCE_INLINE bool simd_test_any_##_xyzw(simd128_sse_t _test) \
{ \
return 0x0 != (_mm_movemask_ps(_test)&(_mask) ); \
} \
\
template<> \
{ \
return 0x0 != (_mm_movemask_ps(_test)&(_mask) ); \
} \
\
template<> \
BX_SIMD_FORCE_INLINE bool simd_test_all_##_xyzw(simd128_sse_t _test) \
{ \
return (_mask) == (_mm_movemask_ps(_test)&(_mask) ); \
{ \
return (_mask) == (_mm_movemask_ps(_test)&(_mask) ); \
}
BX_SIMD128_IMPLEMENT_TEST(x , 0x1);

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2010-2015 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#ifndef BX_SIMD_T_H_HEADER_GUARD

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/