Module: xenomai-2.5
Branch: master
Commit: 10220f24fa92084bdd7b2b009299ae122b2cab5e
URL:    
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=10220f24fa92084bdd7b2b009299ae122b2cab5e

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Wed Jan 13 10:57:17 2010 +0100

arith: add testcases to the arith unit test

---

 src/testsuite/unit/arith-noinline.c |    6 ++++
 src/testsuite/unit/arith-noinline.h |    5 +++-
 src/testsuite/unit/arith.c          |   44 ++++++++++++++++++++++++++++++++++-
 3 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/src/testsuite/unit/arith-noinline.c 
b/src/testsuite/unit/arith-noinline.c
index 43e2e6d..9f3f292 100644
--- a/src/testsuite/unit/arith-noinline.c
+++ b/src/testsuite/unit/arith-noinline.c
@@ -21,6 +21,12 @@ do_llmulshft(long long ll, unsigned m, unsigned s)
 }
 
 #ifdef XNARCH_HAVE_NODIV_LLIMD
+unsigned long long
+do_nodiv_ullimd(unsigned long long ll, unsigned long long frac, unsigned integ)
+{
+       return rthal_nodiv_ullimd(ll, frac, integ);
+}
+
 long long
 do_nodiv_llimd(long long ll, unsigned long long frac, unsigned integ)
 {
diff --git a/src/testsuite/unit/arith-noinline.h 
b/src/testsuite/unit/arith-noinline.h
index 404ec9e..ca237e9 100644
--- a/src/testsuite/unit/arith-noinline.h
+++ b/src/testsuite/unit/arith-noinline.h
@@ -9,7 +9,10 @@ do_llimd(long long ull, unsigned m, unsigned d);
 long long
 do_llmulshft(long long ull, unsigned m, unsigned s);
 
+unsigned long long
+do_nodiv_ullimd(unsigned long long ull, unsigned long long frac, unsigned 
integ);
+
 long long
-do_nodiv_llimd(unsigned long long ull, unsigned long long frac, unsigned 
integ);
+do_nodiv_llimd(long long ll, unsigned long long frac, unsigned integ);
 
 #endif /* OUTOFLINE_H */
diff --git a/src/testsuite/unit/arith.c b/src/testsuite/unit/arith.c
index 2ff493f..2d0b458 100644
--- a/src/testsuite/unit/arith.c
+++ b/src/testsuite/unit/arith.c
@@ -24,7 +24,7 @@ static volatile long long arg = 0x3ffffffffffffffULL;
                        end = rt_timer_tsc();                           \
                        delta = end - start;                            \
                                                                        \
-                       if (i == 0 || delta < (avg / i) * 2) {          \
+                       if (i == 0 || delta < (avg / i) * 4) {          \
                                avg += delta;                           \
                        } else                                          \
                                ++rejected;                             \
@@ -58,6 +58,8 @@ int main(void)
        fprintf(stderr, "integ: %d, frac: 0x%08llx\n", frac.integ, frac.frac);
 #endif /* XNARCH_HAVE_NODIV_LLIMD */
 
+       fprintf(stderr, "\nsigned positive operation: 0x%016llx * %u / %d\n",
+               arg, nsec_per_sec, sample_freq);
        bench("inline calibration", 0);
        calib = avg;
        bench("inlined llimd", rthal_llimd(arg, nsec_per_sec, sample_freq));
@@ -77,5 +79,45 @@ int main(void)
        bench("out of line nodiv_llimd",
              do_nodiv_llimd(arg, frac.frac, frac.integ));
 #endif /* XNARCH_HAVE_NODIV_LLIMD */
+
+
+       fprintf(stderr, "\nsigned negative operation: 0x%016llx * %u / %d\n",
+               -arg, nsec_per_sec, sample_freq);
+       calib = 0;
+       bench("inline calibration", 0);
+       calib = avg;
+       bench("inlined llimd", rthal_llimd(-arg, nsec_per_sec, sample_freq));
+       bench("inlined llmulshft", rthal_llmulshft(-arg, mul, shft));
+#ifdef XNARCH_HAVE_NODIV_LLIMD
+       bench("inlined nodiv_llimd",
+             rthal_nodiv_llimd(-arg, frac.frac, frac.integ));
+#endif /* XNARCH_HAVE_NODIV_LLIMD */
+
+       calib = 0;
+       bench("out of line calibration", dummy());
+       calib = avg;
+       bench("out of line llimd",
+             do_llimd(-arg, nsec_per_sec, sample_freq));
+       bench("out of line llmulshft", do_llmulshft(-arg, mul, shft));
+#ifdef XNARCH_HAVE_NODIV_LLIMD
+       bench("out of line nodiv_llimd",
+             do_nodiv_llimd(-arg, frac.frac, frac.integ));
+#endif /* XNARCH_HAVE_NODIV_LLIMD */
+
+#ifdef XNARCH_HAVE_NODIV_LLIMD
+       fprintf(stderr, "\nunsigned operation: 0x%016llx * %u / %d\n",
+               arg, nsec_per_sec, sample_freq);
+       calib = 0;
+       bench("inline calibration", 0);
+       calib = avg;
+       bench("inlined nodiv_ullimd",
+             rthal_nodiv_ullimd(arg, frac.frac, frac.integ));
+
+       calib = 0;
+       bench("out of line calibration", dummy());
+       calib = avg;
+       bench("out of line nodiv_ullimd",
+             do_nodiv_ullimd(arg, frac.frac, frac.integ));
+#endif /* XNARCH_HAVE_NODIV_LLIMD */
        return 0;
 }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to