38 #include "unit_test_common.h" 43 #define TEST_LENGTH_SAMPLES 1024 44 #define TEST_COUNT 5000 54 for (i = 0; i < len; i++)
61 void test_compute_aabb_vec2f_conformance()
63 #if defined ENABLE_NE10_PHYSICS_COMPUTE_AABB_VEC2F_NEON 71 fprintf (stdout,
"----------%30s start\n", __FUNCTION__);
85 #if defined (REGRESSION_TEST) 92 printf (
"----vertex_count %d\n", vertex_count);
95 #else // defined (SMOKE_TEST) 102 printf (
"----vertex_count %d\n", vertex_count);
107 free (vertices_neon);
111 void test_compute_aabb_vec2f_performance()
121 fprintf (stdout,
"----------%30s start\n", __FUNCTION__);
122 fprintf (stdout,
"%25s%20s%20s%20s%20s\n",
"vertex count",
"C Time (micro-s)",
"NEON Time (micro-s)",
"Time Savings",
"Performance Ratio");
133 xf.
c2.
r1 = sin (tmp);
134 xf.
c2.
r2 = cos (tmp);
147 #ifdef ENABLE_NE10_PHYSICS_COMPUTE_AABB_VEC2F_NEON 157 #endif // ENABLE_NE10_PHYSICS_COMPUTE_AABB_VEC2F_NEON 159 time_savings = ( ( (
ne10_float32_t) (time_c - time_neon)) / time_c) * 100;
160 printf (
"vertax count: %10d time C: %10lld time NEON: %10lld\n", vertex_count, time_c, time_neon);
164 free (vertices_neon);
167 void test_relative_v_vec2f_conformance()
169 #if defined ENABLE_NE10_PHYSICS_RELATIVE_V_VEC2F_NEON 178 fprintf (stdout,
"----------%30s start\n", __FUNCTION__);
196 #if defined (REGRESSION_TEST) 207 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) dv_c, count * vec_size));
208 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) dv_neon, count * vec_size));
209 printf (
"----count %d\n", count);
210 for (i = 0; i < count; i++)
213 #else // defined (SMOKE_TEST) 224 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) dv_c, count * vec_size));
225 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) dv_neon, count * vec_size));
226 printf (
"----count %d\n", count);
227 for (i = 0; i < count; i++)
236 free (guarded_dv_neon);
240 void test_relative_v_vec2f_performance()
250 fprintf (stdout,
"----------%30s start\n", __FUNCTION__);
251 fprintf (stdout,
"%25s%20s%20s%20s%20s\n",
"count",
"C Time (micro-s)",
"NEON Time (micro-s)",
"Time Savings",
"Performance Ratio");
279 #ifdef ENABLE_NE10_PHYSICS_RELATIVE_V_VEC2F_NEON 289 time_savings = ( ( (
ne10_float32_t) (time_c - time_neon)) / time_c) * 100;
290 printf (
"count: %10d time C: %10lld time NEON: %10lld\n", count, time_c, time_neon);
292 #endif // ENABLE_NE10_PHYSICS_RELATIVE_V_VEC2F_NEON 300 free (guarded_dv_neon);
303 void test_apply_impulse_vec2f_conformance()
305 #if defined ENABLE_NE10_PHYSICS_APPLY_IMPULSE_VEC2F_NEON 306 ne10_vec3f_t *guarded_v_wa_c, *guarded_v_wa_neon, *guarded_v_wb_c, *guarded_v_wb_neon;
313 fprintf (stdout,
"----------%30s start\n", __FUNCTION__);
341 #if defined (REGRESSION_TEST) 354 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) v_wa_c, count * vec_size));
355 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) v_wa_neon, count * vec_size));
356 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) v_wb_c, count * vec_size));
357 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) v_wb_neon, count * vec_size));
359 printf (
"----count %d\n", count);
360 for (i = 0; i < count; i++)
366 #else // defined (SMOKE_TEST) 379 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) v_wa_c, count * vec_size));
380 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) v_wa_neon, count * vec_size));
381 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) v_wb_c, count * vec_size));
382 assert_true (CHECK_ARRAY_GUARD ( (
ne10_float32_t*) v_wb_neon, count * vec_size));
383 printf (
"----count %d\n", count);
384 for (i = 0; i < count; i++)
396 free (guarded_v_wa_c);
397 free (guarded_v_wa_neon);
398 free (guarded_v_wb_c);
399 free (guarded_v_wb_neon);
403 void test_apply_impulse_vec2f_performance()
405 ne10_vec3f_t *guarded_v_wa_c, *guarded_v_wa_neon, *guarded_v_wb_c, *guarded_v_wb_neon;
412 fprintf (stdout,
"----------%30s start\n", __FUNCTION__);
413 fprintf (stdout,
"%25s%20s%20s%20s%20s\n",
"count",
"C Time (micro-s)",
"NEON Time (micro-s)",
"Time Savings",
"Performance Ratio");
452 #ifdef ENABLE_NE10_PHYSICS_APPLY_IMPULSE_VEC2F_NEON 461 #endif // ENABLE_NE10_PHYSICS_APPLY_IMPULSE_VEC2F_NEON 463 time_savings = ( ( (
ne10_float32_t) (time_c - time_neon)) / time_c) * 100;
464 printf (
"count: %10d time C: %10lld time NEON: %10lld\n", count, time_c, time_neon);
473 free (guarded_v_wa_c);
474 free (guarded_v_wa_neon);
475 free (guarded_v_wb_c);
476 free (guarded_v_wb_neon);
479 void test_compute_aabb_vec2f()
481 #if defined (SMOKE_TEST)||(REGRESSION_TEST) 482 test_compute_aabb_vec2f_conformance();
485 #if defined (PERFORMANCE_TEST) 486 test_compute_aabb_vec2f_performance();
490 void test_relative_v_vec2f()
492 #if defined (SMOKE_TEST)||(REGRESSION_TEST) 493 test_relative_v_vec2f_conformance();
496 #if defined (PERFORMANCE_TEST) 497 test_relative_v_vec2f_performance();
501 void test_apply_impulse_vec2f()
503 #if defined (SMOKE_TEST)||(REGRESSION_TEST) 504 test_apply_impulse_vec2f_conformance();
507 #if defined (PERFORMANCE_TEST) 508 test_apply_impulse_vec2f_performance();
522 void test_fixture_physics (
void)
524 test_fixture_start();
529 run_test (test_compute_aabb_vec2f);
530 run_test (test_relative_v_vec2f);
531 run_test (test_apply_impulse_vec2f);
A 2-tuple of ne10_float32_t values.
void ne10_physics_compute_aabb_vec2f_neon(ne10_mat2x2f_t *aabb, ne10_vec2f_t *vertices, ne10_mat2x2f_t *xf, ne10_vec2f_t *radius, ne10_uint32_t vertex_count)
Specific implementation of ne10_physics_compute_aabb_vec2f using NEON SIMD capabilities.
void ne10_physics_apply_impulse_vec2f_c(ne10_vec3f_t *v_wa, ne10_vec3f_t *v_wb, ne10_vec2f_t *ra, ne10_vec2f_t *rb, ne10_vec2f_t *ima, ne10_vec2f_t *imb, ne10_vec2f_t *p, ne10_uint32_t count)
Specific implementation of ne10_physics_apply_impulse_vec2f using plain C.
void ne10_physics_compute_aabb_vec2f_c(ne10_mat2x2f_t *aabb, ne10_vec2f_t *vertices, ne10_mat2x2f_t *xf, ne10_vec2f_t *radius, ne10_uint32_t vertex_count)
Specific implementation of ne10_physics_compute_aabb_vec2f using plain C.
#define TEST_LENGTH_SAMPLES
void ne10_physics_relative_v_vec2f_c(ne10_vec2f_t *dv, ne10_vec3f_t *v_wa, ne10_vec2f_t *ra, ne10_vec3f_t *v_wb, ne10_vec2f_t *rb, ne10_uint32_t count)
Specific implementation of ne10_physics_relative_v_vec2f using plain C.
void ne10_physics_relative_v_vec2f_neon(ne10_vec2f_t *dv, ne10_vec3f_t *v_wa, ne10_vec2f_t *ra, ne10_vec3f_t *v_wb, ne10_vec2f_t *rb, ne10_uint32_t count) asm("ne10_physics_relative_v_vec2f_neon")
Specific implementation of ne10_physics_relative_v_vec2f using NEON SIMD capabilities.
void my_test_teardown(void)
A 3-tuple of ne10_float32_t values.
void ne10_physics_apply_impulse_vec2f_neon(ne10_vec3f_t *v_wa, ne10_vec3f_t *v_wb, ne10_vec2f_t *ra, ne10_vec2f_t *rb, ne10_vec2f_t *ima, ne10_vec2f_t *imb, ne10_vec2f_t *p, ne10_uint32_t count) asm("ne10_physics_apply_impulse_vec2f_neon")
Specific implementation of ne10_physics_apply_impulse_vec2f using NEON SIMD capabilities.