mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 12:42:34 +01:00
PNaCl vector intrisics WIP.
This commit is contained in:
@@ -2,6 +2,16 @@
|
||||
|
||||
namespace UnitTest {
|
||||
|
||||
#if defined(__native_client__)
|
||||
SignalTranslator::SignalTranslator()
|
||||
{
|
||||
}
|
||||
|
||||
SignalTranslator::~SignalTranslator()
|
||||
{
|
||||
}
|
||||
#else
|
||||
|
||||
sigjmp_buf* SignalTranslator::s_jumpTarget = 0;
|
||||
|
||||
namespace {
|
||||
@@ -42,5 +52,6 @@ SignalTranslator::~SignalTranslator()
|
||||
s_jumpTarget = m_oldJumpTarget;
|
||||
}
|
||||
|
||||
#endif // defined(__native_client__)
|
||||
|
||||
}
|
||||
|
||||
19
3rdparty/UnitTest++/src/Posix/SignalTranslator.h
vendored
19
3rdparty/UnitTest++/src/Posix/SignalTranslator.h
vendored
@@ -12,6 +12,8 @@ public:
|
||||
SignalTranslator();
|
||||
~SignalTranslator();
|
||||
|
||||
#if defined(__native_client__)
|
||||
#else
|
||||
static sigjmp_buf* s_jumpTarget;
|
||||
|
||||
private:
|
||||
@@ -24,18 +26,23 @@ private:
|
||||
struct sigaction m_old_SIGBUS_action;
|
||||
// struct sigaction m_old_SIGABRT_action;
|
||||
// struct sigaction m_old_SIGALRM_action;
|
||||
#endif // defined(__native_client__)
|
||||
};
|
||||
|
||||
#if !defined(__GNUC__) && !defined(__clang__)
|
||||
#define UNITTEST_EXTENSION
|
||||
# define UNITTEST_EXTENSION
|
||||
#else
|
||||
#define UNITTEST_EXTENSION __extension__
|
||||
# define UNITTEST_EXTENSION __extension__
|
||||
#endif
|
||||
|
||||
#define UNITTEST_THROW_SIGNALS \
|
||||
UnitTest::SignalTranslator sig; \
|
||||
if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \
|
||||
throw ("Unhandled system exception");
|
||||
#if defined(__native_client__)
|
||||
# define UNITTEST_THROW_SIGNALS
|
||||
#else
|
||||
# define UNITTEST_THROW_SIGNALS \
|
||||
UnitTest::SignalTranslator sig; \
|
||||
if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \
|
||||
throw ("Unhandled system exception");
|
||||
#endif // defined(__native_client__)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2014 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2014 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,14 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_FLOAT4_INLINE float4_t float4_rcp_ni(float4_t _a)
|
||||
{
|
||||
const float4_t one = float4_splat(1.0f);
|
||||
const float4_t result = float4_div(one, _a);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_FLOAT4_INLINE float4_t float4_div_nr_ni(float4_t _a, float4_t _b)
|
||||
{
|
||||
const float4_t oneish = float4_isplat(0x3f800001);
|
||||
@@ -53,14 +61,6 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_FLOAT4_INLINE float4_t float4_rcp_ni(float4_t _a)
|
||||
{
|
||||
const float4_t one = float4_splat(1.0f);
|
||||
const float4_t result = float4_div(one, _a);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_FLOAT4_INLINE float4_t float4_orx_ni(float4_t _a)
|
||||
{
|
||||
const float4_t zwxy = float4_swiz_zwxy(_a);
|
||||
@@ -115,6 +115,22 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_FLOAT4_INLINE float4_t float4_min_ni(float4_t _a, float4_t _b)
|
||||
{
|
||||
const float4_t mask = float4_cmplt(_a, _b);
|
||||
const float4_t result = float4_selb(mask, _a, _b);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_FLOAT4_INLINE float4_t float4_max_ni(float4_t _a, float4_t _b)
|
||||
{
|
||||
const float4_t mask = float4_cmpgt(_a, _b);
|
||||
const float4_t result = float4_selb(mask, _a, _b);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_FLOAT4_INLINE float4_t float4_abs_ni(float4_t _a)
|
||||
{
|
||||
const float4_t a_neg = float4_neg(_a);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2014 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace bx
|
||||
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
|
||||
| ( (_test.uxyzw[2]>>31)<<2) \
|
||||
| ( (_test.uxyzw[1]>>31)<<1) \
|
||||
| (_test.uxyzw[0]>>31) \
|
||||
| ( _test.uxyzw[0]>>31) \
|
||||
; \
|
||||
return 0 != (tmp&(_mask) ); \
|
||||
} \
|
||||
@@ -57,7 +57,7 @@ namespace bx
|
||||
uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
|
||||
| ( (_test.uxyzw[2]>>31)<<2) \
|
||||
| ( (_test.uxyzw[1]>>31)<<1) \
|
||||
| (_test.uxyzw[0]>>31) \
|
||||
| ( _test.uxyzw[0]>>31) \
|
||||
; \
|
||||
return (_mask) == (tmp&(_mask) ); \
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2014 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2014 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2014 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# include "float4_sse.h"
|
||||
#elif __ARM_NEON__ && !BX_COMPILER_CLANG
|
||||
# include "float4_neon.h"
|
||||
#elif 0 // BX_COMPILER_CLANG
|
||||
# include "float4_langext.h"
|
||||
#else
|
||||
# pragma message("************************************\nUsing SIMD reference implementation!\n************************************")
|
||||
# include "float4_ref.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2014 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
|
||||
@@ -90,3 +90,5 @@ project "bx.test"
|
||||
}
|
||||
|
||||
configuration {}
|
||||
|
||||
strip()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2014 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
|
||||
@@ -38,12 +38,31 @@ int runAllTests()
|
||||
}
|
||||
|
||||
#if BX_PLATFORM_ANDROID
|
||||
#include <android/native_activity.h>
|
||||
# include <android/native_activity.h>
|
||||
|
||||
void ANativeActivity_onCreate(ANativeActivity*, void*, size_t)
|
||||
{
|
||||
exit(runAllTests() );
|
||||
}
|
||||
#elif BX_PLATFORM_NACL
|
||||
# include <ppapi/c/pp_errors.h>
|
||||
# include <ppapi/c/ppp.h>
|
||||
|
||||
PP_EXPORT const void* PPP_GetInterface(const char* /*_name*/)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PP_EXPORT int32_t PPP_InitializeModule(PP_Module /*_module*/, PPB_GetInterface /*_interface*/)
|
||||
{
|
||||
DBG("PPAPI version: %d", PPAPI_RELEASE);
|
||||
runAllTests();
|
||||
return PP_ERROR_NOINTERFACE;
|
||||
}
|
||||
|
||||
PP_EXPORT void PPP_ShutdownModule()
|
||||
{
|
||||
}
|
||||
#else
|
||||
int main()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user