Loading tests/RenderScriptTests/tests/src/com/android/rs/test/math.rs +165 −51 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,108 @@ volatile uchar2 uc2; volatile uchar3 uc3; volatile uchar3 uc3; volatile uchar4 uc4; volatile uchar4 uc4; #define DECL_INT(prefix) \ volatile char prefix##_c_1 = 1; \ volatile char2 prefix##_c_2 = 1; \ volatile char3 prefix##_c_3 = 1; \ volatile char4 prefix##_c_4 = 1; \ volatile uchar prefix##_uc_1 = 1; \ volatile uchar2 prefix##_uc_2 = 1; \ volatile uchar3 prefix##_uc_3 = 1; \ volatile uchar4 prefix##_uc_4 = 1; \ volatile short prefix##_s_1 = 1; \ volatile short2 prefix##_s_2 = 1; \ volatile short3 prefix##_s_3 = 1; \ volatile short4 prefix##_s_4 = 1; \ volatile ushort prefix##_us_1 = 1; \ volatile ushort2 prefix##_us_2 = 1; \ volatile ushort3 prefix##_us_3 = 1; \ volatile ushort4 prefix##_us_4 = 1; \ volatile int prefix##_i_1 = 1; \ volatile int2 prefix##_i_2 = 1; \ volatile int3 prefix##_i_3 = 1; \ volatile int4 prefix##_i_4 = 1; \ volatile uint prefix##_ui_1 = 1; \ volatile uint2 prefix##_ui_2 = 1; \ volatile uint3 prefix##_ui_3 = 1; \ volatile uint4 prefix##_ui_4 = 1; \ volatile long prefix##_l_1 = 1; \ volatile ulong prefix##_ul_1 = 1; DECL_INT(res) DECL_INT(src1) DECL_INT(src2) #define TEST_INT_OP_TYPE(op, type) \ rsDebug("Testing " #op " for " #type "1", i++); \ res_##type##_1 = src1_##type##_1 op src2_##type##_1; \ rsDebug("Testing " #op " for " #type "2", i++); \ res_##type##_2 = src1_##type##_2 op src2_##type##_2; \ rsDebug("Testing " #op " for " #type "3", i++); \ res_##type##_3 = src1_##type##_3 op src2_##type##_3; \ rsDebug("Testing " #op " for " #type "4", i++); \ res_##type##_4 = src1_##type##_4 op src2_##type##_4; #define TEST_INT_OP(op) \ TEST_INT_OP_TYPE(op, c) \ TEST_INT_OP_TYPE(op, uc) \ TEST_INT_OP_TYPE(op, s) \ TEST_INT_OP_TYPE(op, us) \ TEST_INT_OP_TYPE(op, i) \ TEST_INT_OP_TYPE(op, ui) \ rsDebug("Testing " #op " for l1", i++); \ res_l_1 = src1_l_1 op src2_l_1; \ rsDebug("Testing " #op " for ul1", i++); \ res_ul_1 = src1_ul_1 op src2_ul_1; #define TEST_XN_FUNC_YN(typeout, fnc, typein) \ res_##typeout##_1 = fnc(src1_##typein##_1); \ res_##typeout##_2 = fnc(src1_##typein##_2); \ res_##typeout##_3 = fnc(src1_##typein##_3); \ res_##typeout##_4 = fnc(src1_##typein##_4); #define TEST_XN_FUNC_XN_XN(type, fnc) \ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \ res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \ res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \ res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4); #define TEST_X_FUNC_X_X_X(type, fnc) \ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1); #define TEST_IN_FUNC_IN(fnc) \ rsDebug("Testing " #fnc, 0); \ TEST_XN_FUNC_YN(uc, fnc, uc) \ TEST_XN_FUNC_YN(c, fnc, c) \ TEST_XN_FUNC_YN(us, fnc, us) \ TEST_XN_FUNC_YN(s, fnc, s) \ TEST_XN_FUNC_YN(ui, fnc, ui) \ TEST_XN_FUNC_YN(i, fnc, i) #define TEST_UIN_FUNC_IN(fnc) \ rsDebug("Testing " #fnc, 0); \ TEST_XN_FUNC_YN(uc, fnc, c) \ TEST_XN_FUNC_YN(us, fnc, s) \ TEST_XN_FUNC_YN(ui, fnc, i) \ #define TEST_IN_FUNC_IN_IN(fnc) \ rsDebug("Testing " #fnc, 0); \ TEST_XN_FUNC_XN_XN(uc, fnc) \ TEST_XN_FUNC_XN_XN(c, fnc) \ TEST_XN_FUNC_XN_XN(us, fnc) \ TEST_XN_FUNC_XN_XN(s, fnc) \ TEST_XN_FUNC_XN_XN(ui, fnc) \ TEST_XN_FUNC_XN_XN(i, fnc) #define TEST_I_FUNC_I_I_I(fnc) \ rsDebug("Testing " #fnc, 0); \ TEST_X_FUNC_X_X_X(uc, fnc) \ TEST_X_FUNC_X_X_X(c, fnc) \ TEST_X_FUNC_X_X_X(us, fnc) \ TEST_X_FUNC_X_X_X(s, fnc) \ TEST_X_FUNC_X_X_X(ui, fnc) \ TEST_X_FUNC_X_X_X(i, fnc) #define TEST_FN_FUNC_FN(fnc) \ #define TEST_FN_FUNC_FN(fnc) \ rsDebug("Testing " #fnc, 0); \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1); \ f1 = fnc(f1); \ Loading @@ -58,6 +160,11 @@ volatile uchar4 uc4; f3 = fnc(f3, f3); \ f3 = fnc(f3, f3); \ f4 = fnc(f4, f4); f4 = fnc(f4, f4); #define TEST_F34_FUNC_F34_F34(fnc) \ rsDebug("Testing " #fnc, 0); \ f3 = fnc(f3, f3); \ f4 = fnc(f4, f4); #define TEST_FN_FUNC_FN_F(fnc) \ #define TEST_FN_FUNC_FN_F(fnc) \ rsDebug("Testing " #fnc, 0); \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, f1); \ f1 = fnc(f1, f1); \ Loading @@ -65,6 +172,20 @@ volatile uchar4 uc4; f3 = fnc(f3, f1); \ f3 = fnc(f3, f1); \ f4 = fnc(f4, f1); f4 = fnc(f4, f1); #define TEST_F_FUNC_FN(fnc) \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1); \ f1 = fnc(f2); \ f1 = fnc(f3); \ f1 = fnc(f4); #define TEST_F_FUNC_FN_FN(fnc) \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, f1); \ f1 = fnc(f2, f2); \ f1 = fnc(f3, f3); \ f1 = fnc(f4, f4); #define TEST_FN_FUNC_FN_IN(fnc) \ #define TEST_FN_FUNC_FN_IN(fnc) \ rsDebug("Testing " #fnc, 0); \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, i1); \ f1 = fnc(f1, i1); \ Loading @@ -86,6 +207,13 @@ volatile uchar4 uc4; f3 = fnc(f3, f3, f3); \ f3 = fnc(f3, f3, f3); \ f4 = fnc(f4, f4, f4); f4 = fnc(f4, f4, f4); #define TEST_FN_FUNC_FN_FN_F(fnc) \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, f1, f1); \ f2 = fnc(f2, f1, f1); \ f3 = fnc(f3, f1, f1); \ f4 = fnc(f4, f1, f1); #define TEST_FN_FUNC_FN_PIN(fnc) \ #define TEST_FN_FUNC_FN_PIN(fnc) \ rsDebug("Testing " #fnc, 0); \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, (int*) &i1); \ f1 = fnc(f1, (int*) &i1); \ Loading @@ -107,7 +235,6 @@ volatile uchar4 uc4; i3 = fnc(f3); \ i3 = fnc(f3); \ i4 = fnc(f4); i4 = fnc(f4); static bool test_fp_math(uint32_t index) { static bool test_fp_math(uint32_t index) { bool failed = false; bool failed = false; start(); start(); Loading @@ -125,10 +252,16 @@ static bool test_fp_math(uint32_t index) { TEST_FN_FUNC_FN_FN(atan2pi); TEST_FN_FUNC_FN_FN(atan2pi); TEST_FN_FUNC_FN(cbrt); TEST_FN_FUNC_FN(cbrt); TEST_FN_FUNC_FN(ceil); TEST_FN_FUNC_FN(ceil); TEST_FN_FUNC_FN_FN_FN(clamp); TEST_FN_FUNC_FN_FN_F(clamp); TEST_FN_FUNC_FN_FN(copysign); TEST_FN_FUNC_FN_FN(copysign); TEST_FN_FUNC_FN(cos); TEST_FN_FUNC_FN(cos); TEST_FN_FUNC_FN(cosh); TEST_FN_FUNC_FN(cosh); TEST_FN_FUNC_FN(cospi); TEST_FN_FUNC_FN(cospi); TEST_F34_FUNC_F34_F34(cross); TEST_FN_FUNC_FN(degrees); TEST_F_FUNC_FN_FN(distance); TEST_F_FUNC_FN_FN(dot); TEST_FN_FUNC_FN(erfc); TEST_FN_FUNC_FN(erfc); TEST_FN_FUNC_FN(erf); TEST_FN_FUNC_FN(erf); TEST_FN_FUNC_FN(exp); TEST_FN_FUNC_FN(exp); Loading @@ -150,6 +283,7 @@ static bool test_fp_math(uint32_t index) { TEST_IN_FUNC_FN(ilogb); TEST_IN_FUNC_FN(ilogb); TEST_FN_FUNC_FN_IN(ldexp); TEST_FN_FUNC_FN_IN(ldexp); TEST_FN_FUNC_FN_I(ldexp); TEST_FN_FUNC_FN_I(ldexp); TEST_F_FUNC_FN(length); TEST_FN_FUNC_FN(lgamma); TEST_FN_FUNC_FN(lgamma); TEST_FN_FUNC_FN_PIN(lgamma); TEST_FN_FUNC_FN_PIN(lgamma); TEST_FN_FUNC_FN(log); TEST_FN_FUNC_FN(log); Loading @@ -158,23 +292,34 @@ static bool test_fp_math(uint32_t index) { TEST_FN_FUNC_FN(log1p); TEST_FN_FUNC_FN(log1p); TEST_FN_FUNC_FN(logb); TEST_FN_FUNC_FN(logb); TEST_FN_FUNC_FN_FN_FN(mad); TEST_FN_FUNC_FN_FN_FN(mad); TEST_FN_FUNC_FN_FN(max); TEST_FN_FUNC_FN_F(max); TEST_FN_FUNC_FN_FN(min); TEST_FN_FUNC_FN_F(min); TEST_FN_FUNC_FN_FN_FN(mix); TEST_FN_FUNC_FN_FN_F(mix); TEST_FN_FUNC_FN_PFN(modf); TEST_FN_FUNC_FN_PFN(modf); // nan // nan TEST_FN_FUNC_FN_FN(nextafter); TEST_FN_FUNC_FN_FN(nextafter); TEST_FN_FUNC_FN(normalize); TEST_FN_FUNC_FN_FN(pow); TEST_FN_FUNC_FN_FN(pow); TEST_FN_FUNC_FN_IN(pown); TEST_FN_FUNC_FN_IN(pown); TEST_FN_FUNC_FN_FN(powr); TEST_FN_FUNC_FN_FN(powr); TEST_FN_FUNC_FN(radians); TEST_FN_FUNC_FN_FN(remainder); TEST_FN_FUNC_FN_FN(remainder); TEST_FN_FUNC_FN_FN_PIN(remquo); TEST_FN_FUNC_FN_FN_PIN(remquo); TEST_FN_FUNC_FN(rint); TEST_FN_FUNC_FN(rint); TEST_FN_FUNC_FN_IN(rootn); TEST_FN_FUNC_FN_IN(rootn); TEST_FN_FUNC_FN(round); TEST_FN_FUNC_FN(round); TEST_FN_FUNC_FN(rsqrt); TEST_FN_FUNC_FN(rsqrt); TEST_FN_FUNC_FN(sign); TEST_FN_FUNC_FN(sin); TEST_FN_FUNC_FN(sin); TEST_FN_FUNC_FN_PFN(sincos); TEST_FN_FUNC_FN_PFN(sincos); TEST_FN_FUNC_FN(sinh); TEST_FN_FUNC_FN(sinh); TEST_FN_FUNC_FN(sinpi); TEST_FN_FUNC_FN(sinpi); TEST_FN_FUNC_FN(sqrt); TEST_FN_FUNC_FN(sqrt); TEST_FN_FUNC_FN_FN(step); TEST_FN_FUNC_FN_F(step); TEST_FN_FUNC_FN(tan); TEST_FN_FUNC_FN(tan); TEST_FN_FUNC_FN(tanh); TEST_FN_FUNC_FN(tanh); TEST_FN_FUNC_FN(tanpi); TEST_FN_FUNC_FN(tanpi); Loading @@ -193,59 +338,27 @@ static bool test_fp_math(uint32_t index) { return failed; return failed; } } #define DECL_INT(prefix) \ static bool test_int_math(uint32_t index) { volatile char prefix##_c_1 = 1; \ bool failed = false; volatile char2 prefix##_c_2 = 1; \ start(); volatile char3 prefix##_c_3 = 1; \ volatile char4 prefix##_c_4 = 1; \ volatile uchar prefix##_uc_1 = 1; \ volatile uchar2 prefix##_uc_2 = 1; \ volatile uchar3 prefix##_uc_3 = 1; \ volatile uchar4 prefix##_uc_4 = 1; \ volatile short prefix##_s_1 = 1; \ volatile short2 prefix##_s_2 = 1; \ volatile short3 prefix##_s_3 = 1; \ volatile short4 prefix##_s_4 = 1; \ volatile ushort prefix##_us_1 = 1; \ volatile ushort2 prefix##_us_2 = 1; \ volatile ushort3 prefix##_us_3 = 1; \ volatile ushort4 prefix##_us_4 = 1; \ volatile int prefix##_i_1 = 1; \ volatile int2 prefix##_i_2 = 1; \ volatile int3 prefix##_i_3 = 1; \ volatile int4 prefix##_i_4 = 1; \ volatile uint prefix##_ui_1 = 1; \ volatile uint2 prefix##_ui_2 = 1; \ volatile uint3 prefix##_ui_3 = 1; \ volatile uint4 prefix##_ui_4 = 1; \ volatile long prefix##_l_1 = 1; \ volatile ulong prefix##_ul_1 = 1; #define TEST_INT_OP_TYPE(op, type) \ TEST_UIN_FUNC_IN(abs); rsDebug("Testing " #op " for " #type "1", i++); \ TEST_IN_FUNC_IN(clz); res_##type##_1 = src1_##type##_1 op src2_##type##_1; \ TEST_IN_FUNC_IN_IN(min); rsDebug("Testing " #op " for " #type "2", i++); \ TEST_IN_FUNC_IN_IN(max); res_##type##_2 = src1_##type##_2 op src2_##type##_2; \ TEST_I_FUNC_I_I_I(rsClamp); rsDebug("Testing " #op " for " #type "3", i++); \ res_##type##_3 = src1_##type##_3 op src2_##type##_3; \ rsDebug("Testing " #op " for " #type "4", i++); \ res_##type##_4 = src1_##type##_4 op src2_##type##_4; #define TEST_INT_OP(op) \ float time = end(index); TEST_INT_OP_TYPE(op, c) \ TEST_INT_OP_TYPE(op, uc) \ TEST_INT_OP_TYPE(op, s) \ TEST_INT_OP_TYPE(op, us) \ TEST_INT_OP_TYPE(op, i) \ TEST_INT_OP_TYPE(op, ui) \ rsDebug("Testing " #op " for l1", i++); \ res_l_1 = src1_l_1 op src2_l_1; \ rsDebug("Testing " #op " for ul1", i++); \ res_ul_1 = src1_ul_1 op src2_ul_1; DECL_INT(res) if (failed) { DECL_INT(src1) rsDebug("test_int_math FAILED", time); DECL_INT(src2) } else { rsDebug("test_int_math PASSED", time); } return failed; } static bool test_basic_operators() { static bool test_basic_operators() { bool failed = false; bool failed = false; Loading Loading @@ -310,6 +423,7 @@ void math_test(uint32_t index, int test_num) { bool failed = false; bool failed = false; failed |= test_convert(); failed |= test_convert(); failed |= test_fp_math(index); failed |= test_fp_math(index); failed |= test_int_math(index); failed |= test_basic_operators(); failed |= test_basic_operators(); if (failed) { if (failed) { Loading Loading
tests/RenderScriptTests/tests/src/com/android/rs/test/math.rs +165 −51 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,108 @@ volatile uchar2 uc2; volatile uchar3 uc3; volatile uchar3 uc3; volatile uchar4 uc4; volatile uchar4 uc4; #define DECL_INT(prefix) \ volatile char prefix##_c_1 = 1; \ volatile char2 prefix##_c_2 = 1; \ volatile char3 prefix##_c_3 = 1; \ volatile char4 prefix##_c_4 = 1; \ volatile uchar prefix##_uc_1 = 1; \ volatile uchar2 prefix##_uc_2 = 1; \ volatile uchar3 prefix##_uc_3 = 1; \ volatile uchar4 prefix##_uc_4 = 1; \ volatile short prefix##_s_1 = 1; \ volatile short2 prefix##_s_2 = 1; \ volatile short3 prefix##_s_3 = 1; \ volatile short4 prefix##_s_4 = 1; \ volatile ushort prefix##_us_1 = 1; \ volatile ushort2 prefix##_us_2 = 1; \ volatile ushort3 prefix##_us_3 = 1; \ volatile ushort4 prefix##_us_4 = 1; \ volatile int prefix##_i_1 = 1; \ volatile int2 prefix##_i_2 = 1; \ volatile int3 prefix##_i_3 = 1; \ volatile int4 prefix##_i_4 = 1; \ volatile uint prefix##_ui_1 = 1; \ volatile uint2 prefix##_ui_2 = 1; \ volatile uint3 prefix##_ui_3 = 1; \ volatile uint4 prefix##_ui_4 = 1; \ volatile long prefix##_l_1 = 1; \ volatile ulong prefix##_ul_1 = 1; DECL_INT(res) DECL_INT(src1) DECL_INT(src2) #define TEST_INT_OP_TYPE(op, type) \ rsDebug("Testing " #op " for " #type "1", i++); \ res_##type##_1 = src1_##type##_1 op src2_##type##_1; \ rsDebug("Testing " #op " for " #type "2", i++); \ res_##type##_2 = src1_##type##_2 op src2_##type##_2; \ rsDebug("Testing " #op " for " #type "3", i++); \ res_##type##_3 = src1_##type##_3 op src2_##type##_3; \ rsDebug("Testing " #op " for " #type "4", i++); \ res_##type##_4 = src1_##type##_4 op src2_##type##_4; #define TEST_INT_OP(op) \ TEST_INT_OP_TYPE(op, c) \ TEST_INT_OP_TYPE(op, uc) \ TEST_INT_OP_TYPE(op, s) \ TEST_INT_OP_TYPE(op, us) \ TEST_INT_OP_TYPE(op, i) \ TEST_INT_OP_TYPE(op, ui) \ rsDebug("Testing " #op " for l1", i++); \ res_l_1 = src1_l_1 op src2_l_1; \ rsDebug("Testing " #op " for ul1", i++); \ res_ul_1 = src1_ul_1 op src2_ul_1; #define TEST_XN_FUNC_YN(typeout, fnc, typein) \ res_##typeout##_1 = fnc(src1_##typein##_1); \ res_##typeout##_2 = fnc(src1_##typein##_2); \ res_##typeout##_3 = fnc(src1_##typein##_3); \ res_##typeout##_4 = fnc(src1_##typein##_4); #define TEST_XN_FUNC_XN_XN(type, fnc) \ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \ res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \ res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \ res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4); #define TEST_X_FUNC_X_X_X(type, fnc) \ res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1); #define TEST_IN_FUNC_IN(fnc) \ rsDebug("Testing " #fnc, 0); \ TEST_XN_FUNC_YN(uc, fnc, uc) \ TEST_XN_FUNC_YN(c, fnc, c) \ TEST_XN_FUNC_YN(us, fnc, us) \ TEST_XN_FUNC_YN(s, fnc, s) \ TEST_XN_FUNC_YN(ui, fnc, ui) \ TEST_XN_FUNC_YN(i, fnc, i) #define TEST_UIN_FUNC_IN(fnc) \ rsDebug("Testing " #fnc, 0); \ TEST_XN_FUNC_YN(uc, fnc, c) \ TEST_XN_FUNC_YN(us, fnc, s) \ TEST_XN_FUNC_YN(ui, fnc, i) \ #define TEST_IN_FUNC_IN_IN(fnc) \ rsDebug("Testing " #fnc, 0); \ TEST_XN_FUNC_XN_XN(uc, fnc) \ TEST_XN_FUNC_XN_XN(c, fnc) \ TEST_XN_FUNC_XN_XN(us, fnc) \ TEST_XN_FUNC_XN_XN(s, fnc) \ TEST_XN_FUNC_XN_XN(ui, fnc) \ TEST_XN_FUNC_XN_XN(i, fnc) #define TEST_I_FUNC_I_I_I(fnc) \ rsDebug("Testing " #fnc, 0); \ TEST_X_FUNC_X_X_X(uc, fnc) \ TEST_X_FUNC_X_X_X(c, fnc) \ TEST_X_FUNC_X_X_X(us, fnc) \ TEST_X_FUNC_X_X_X(s, fnc) \ TEST_X_FUNC_X_X_X(ui, fnc) \ TEST_X_FUNC_X_X_X(i, fnc) #define TEST_FN_FUNC_FN(fnc) \ #define TEST_FN_FUNC_FN(fnc) \ rsDebug("Testing " #fnc, 0); \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1); \ f1 = fnc(f1); \ Loading @@ -58,6 +160,11 @@ volatile uchar4 uc4; f3 = fnc(f3, f3); \ f3 = fnc(f3, f3); \ f4 = fnc(f4, f4); f4 = fnc(f4, f4); #define TEST_F34_FUNC_F34_F34(fnc) \ rsDebug("Testing " #fnc, 0); \ f3 = fnc(f3, f3); \ f4 = fnc(f4, f4); #define TEST_FN_FUNC_FN_F(fnc) \ #define TEST_FN_FUNC_FN_F(fnc) \ rsDebug("Testing " #fnc, 0); \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, f1); \ f1 = fnc(f1, f1); \ Loading @@ -65,6 +172,20 @@ volatile uchar4 uc4; f3 = fnc(f3, f1); \ f3 = fnc(f3, f1); \ f4 = fnc(f4, f1); f4 = fnc(f4, f1); #define TEST_F_FUNC_FN(fnc) \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1); \ f1 = fnc(f2); \ f1 = fnc(f3); \ f1 = fnc(f4); #define TEST_F_FUNC_FN_FN(fnc) \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, f1); \ f1 = fnc(f2, f2); \ f1 = fnc(f3, f3); \ f1 = fnc(f4, f4); #define TEST_FN_FUNC_FN_IN(fnc) \ #define TEST_FN_FUNC_FN_IN(fnc) \ rsDebug("Testing " #fnc, 0); \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, i1); \ f1 = fnc(f1, i1); \ Loading @@ -86,6 +207,13 @@ volatile uchar4 uc4; f3 = fnc(f3, f3, f3); \ f3 = fnc(f3, f3, f3); \ f4 = fnc(f4, f4, f4); f4 = fnc(f4, f4, f4); #define TEST_FN_FUNC_FN_FN_F(fnc) \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, f1, f1); \ f2 = fnc(f2, f1, f1); \ f3 = fnc(f3, f1, f1); \ f4 = fnc(f4, f1, f1); #define TEST_FN_FUNC_FN_PIN(fnc) \ #define TEST_FN_FUNC_FN_PIN(fnc) \ rsDebug("Testing " #fnc, 0); \ rsDebug("Testing " #fnc, 0); \ f1 = fnc(f1, (int*) &i1); \ f1 = fnc(f1, (int*) &i1); \ Loading @@ -107,7 +235,6 @@ volatile uchar4 uc4; i3 = fnc(f3); \ i3 = fnc(f3); \ i4 = fnc(f4); i4 = fnc(f4); static bool test_fp_math(uint32_t index) { static bool test_fp_math(uint32_t index) { bool failed = false; bool failed = false; start(); start(); Loading @@ -125,10 +252,16 @@ static bool test_fp_math(uint32_t index) { TEST_FN_FUNC_FN_FN(atan2pi); TEST_FN_FUNC_FN_FN(atan2pi); TEST_FN_FUNC_FN(cbrt); TEST_FN_FUNC_FN(cbrt); TEST_FN_FUNC_FN(ceil); TEST_FN_FUNC_FN(ceil); TEST_FN_FUNC_FN_FN_FN(clamp); TEST_FN_FUNC_FN_FN_F(clamp); TEST_FN_FUNC_FN_FN(copysign); TEST_FN_FUNC_FN_FN(copysign); TEST_FN_FUNC_FN(cos); TEST_FN_FUNC_FN(cos); TEST_FN_FUNC_FN(cosh); TEST_FN_FUNC_FN(cosh); TEST_FN_FUNC_FN(cospi); TEST_FN_FUNC_FN(cospi); TEST_F34_FUNC_F34_F34(cross); TEST_FN_FUNC_FN(degrees); TEST_F_FUNC_FN_FN(distance); TEST_F_FUNC_FN_FN(dot); TEST_FN_FUNC_FN(erfc); TEST_FN_FUNC_FN(erfc); TEST_FN_FUNC_FN(erf); TEST_FN_FUNC_FN(erf); TEST_FN_FUNC_FN(exp); TEST_FN_FUNC_FN(exp); Loading @@ -150,6 +283,7 @@ static bool test_fp_math(uint32_t index) { TEST_IN_FUNC_FN(ilogb); TEST_IN_FUNC_FN(ilogb); TEST_FN_FUNC_FN_IN(ldexp); TEST_FN_FUNC_FN_IN(ldexp); TEST_FN_FUNC_FN_I(ldexp); TEST_FN_FUNC_FN_I(ldexp); TEST_F_FUNC_FN(length); TEST_FN_FUNC_FN(lgamma); TEST_FN_FUNC_FN(lgamma); TEST_FN_FUNC_FN_PIN(lgamma); TEST_FN_FUNC_FN_PIN(lgamma); TEST_FN_FUNC_FN(log); TEST_FN_FUNC_FN(log); Loading @@ -158,23 +292,34 @@ static bool test_fp_math(uint32_t index) { TEST_FN_FUNC_FN(log1p); TEST_FN_FUNC_FN(log1p); TEST_FN_FUNC_FN(logb); TEST_FN_FUNC_FN(logb); TEST_FN_FUNC_FN_FN_FN(mad); TEST_FN_FUNC_FN_FN_FN(mad); TEST_FN_FUNC_FN_FN(max); TEST_FN_FUNC_FN_F(max); TEST_FN_FUNC_FN_FN(min); TEST_FN_FUNC_FN_F(min); TEST_FN_FUNC_FN_FN_FN(mix); TEST_FN_FUNC_FN_FN_F(mix); TEST_FN_FUNC_FN_PFN(modf); TEST_FN_FUNC_FN_PFN(modf); // nan // nan TEST_FN_FUNC_FN_FN(nextafter); TEST_FN_FUNC_FN_FN(nextafter); TEST_FN_FUNC_FN(normalize); TEST_FN_FUNC_FN_FN(pow); TEST_FN_FUNC_FN_FN(pow); TEST_FN_FUNC_FN_IN(pown); TEST_FN_FUNC_FN_IN(pown); TEST_FN_FUNC_FN_FN(powr); TEST_FN_FUNC_FN_FN(powr); TEST_FN_FUNC_FN(radians); TEST_FN_FUNC_FN_FN(remainder); TEST_FN_FUNC_FN_FN(remainder); TEST_FN_FUNC_FN_FN_PIN(remquo); TEST_FN_FUNC_FN_FN_PIN(remquo); TEST_FN_FUNC_FN(rint); TEST_FN_FUNC_FN(rint); TEST_FN_FUNC_FN_IN(rootn); TEST_FN_FUNC_FN_IN(rootn); TEST_FN_FUNC_FN(round); TEST_FN_FUNC_FN(round); TEST_FN_FUNC_FN(rsqrt); TEST_FN_FUNC_FN(rsqrt); TEST_FN_FUNC_FN(sign); TEST_FN_FUNC_FN(sin); TEST_FN_FUNC_FN(sin); TEST_FN_FUNC_FN_PFN(sincos); TEST_FN_FUNC_FN_PFN(sincos); TEST_FN_FUNC_FN(sinh); TEST_FN_FUNC_FN(sinh); TEST_FN_FUNC_FN(sinpi); TEST_FN_FUNC_FN(sinpi); TEST_FN_FUNC_FN(sqrt); TEST_FN_FUNC_FN(sqrt); TEST_FN_FUNC_FN_FN(step); TEST_FN_FUNC_FN_F(step); TEST_FN_FUNC_FN(tan); TEST_FN_FUNC_FN(tan); TEST_FN_FUNC_FN(tanh); TEST_FN_FUNC_FN(tanh); TEST_FN_FUNC_FN(tanpi); TEST_FN_FUNC_FN(tanpi); Loading @@ -193,59 +338,27 @@ static bool test_fp_math(uint32_t index) { return failed; return failed; } } #define DECL_INT(prefix) \ static bool test_int_math(uint32_t index) { volatile char prefix##_c_1 = 1; \ bool failed = false; volatile char2 prefix##_c_2 = 1; \ start(); volatile char3 prefix##_c_3 = 1; \ volatile char4 prefix##_c_4 = 1; \ volatile uchar prefix##_uc_1 = 1; \ volatile uchar2 prefix##_uc_2 = 1; \ volatile uchar3 prefix##_uc_3 = 1; \ volatile uchar4 prefix##_uc_4 = 1; \ volatile short prefix##_s_1 = 1; \ volatile short2 prefix##_s_2 = 1; \ volatile short3 prefix##_s_3 = 1; \ volatile short4 prefix##_s_4 = 1; \ volatile ushort prefix##_us_1 = 1; \ volatile ushort2 prefix##_us_2 = 1; \ volatile ushort3 prefix##_us_3 = 1; \ volatile ushort4 prefix##_us_4 = 1; \ volatile int prefix##_i_1 = 1; \ volatile int2 prefix##_i_2 = 1; \ volatile int3 prefix##_i_3 = 1; \ volatile int4 prefix##_i_4 = 1; \ volatile uint prefix##_ui_1 = 1; \ volatile uint2 prefix##_ui_2 = 1; \ volatile uint3 prefix##_ui_3 = 1; \ volatile uint4 prefix##_ui_4 = 1; \ volatile long prefix##_l_1 = 1; \ volatile ulong prefix##_ul_1 = 1; #define TEST_INT_OP_TYPE(op, type) \ TEST_UIN_FUNC_IN(abs); rsDebug("Testing " #op " for " #type "1", i++); \ TEST_IN_FUNC_IN(clz); res_##type##_1 = src1_##type##_1 op src2_##type##_1; \ TEST_IN_FUNC_IN_IN(min); rsDebug("Testing " #op " for " #type "2", i++); \ TEST_IN_FUNC_IN_IN(max); res_##type##_2 = src1_##type##_2 op src2_##type##_2; \ TEST_I_FUNC_I_I_I(rsClamp); rsDebug("Testing " #op " for " #type "3", i++); \ res_##type##_3 = src1_##type##_3 op src2_##type##_3; \ rsDebug("Testing " #op " for " #type "4", i++); \ res_##type##_4 = src1_##type##_4 op src2_##type##_4; #define TEST_INT_OP(op) \ float time = end(index); TEST_INT_OP_TYPE(op, c) \ TEST_INT_OP_TYPE(op, uc) \ TEST_INT_OP_TYPE(op, s) \ TEST_INT_OP_TYPE(op, us) \ TEST_INT_OP_TYPE(op, i) \ TEST_INT_OP_TYPE(op, ui) \ rsDebug("Testing " #op " for l1", i++); \ res_l_1 = src1_l_1 op src2_l_1; \ rsDebug("Testing " #op " for ul1", i++); \ res_ul_1 = src1_ul_1 op src2_ul_1; DECL_INT(res) if (failed) { DECL_INT(src1) rsDebug("test_int_math FAILED", time); DECL_INT(src2) } else { rsDebug("test_int_math PASSED", time); } return failed; } static bool test_basic_operators() { static bool test_basic_operators() { bool failed = false; bool failed = false; Loading Loading @@ -310,6 +423,7 @@ void math_test(uint32_t index, int test_num) { bool failed = false; bool failed = false; failed |= test_convert(); failed |= test_convert(); failed |= test_fp_math(index); failed |= test_fp_math(index); failed |= test_int_math(index); failed |= test_basic_operators(); failed |= test_basic_operators(); if (failed) { if (failed) { Loading