diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-08 13:32:20 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-08 13:32:20 +0000 |
commit | dd43edf4e136bff05cbbb6b42b96c024c591dbb9 (patch) | |
tree | d1f03b9c92753846ba462c5a1583af5106333d58 /tests/cris/crisutils.h | |
parent | 83fa1010ae342c5ad0392182fcdcce438c71b163 (diff) |
CRIS testsuite, based on the SIM testsuite, by Edgar E. Iglesias.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3365 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests/cris/crisutils.h')
-rw-r--r-- | tests/cris/crisutils.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/cris/crisutils.h b/tests/cris/crisutils.h new file mode 100644 index 0000000000..63c713897c --- /dev/null +++ b/tests/cris/crisutils.h @@ -0,0 +1,71 @@ +static char *tst_cc_loc = NULL; + +#define cris_tst_cc_init() \ +do { tst_cc_loc = "test_cc failed at " CURRENT_LOCATION; } while(0) + +/* We need a real symbol to signal error. */ +static void _err(void) { + if (!tst_cc_loc) + tst_cc_loc = "tst_cc_failed\n"; + _fail(tst_cc_loc); +} + +extern inline void cris_tst_cc_n1(void) +{ + asm volatile ("bpl _err\n" + "nop\n"); +} +extern inline void cris_tst_cc_n0(void) +{ + asm volatile ("bmi _err\n" + "nop\n"); +} + +extern inline void cris_tst_cc_z1(void) +{ + asm volatile ("bne _err\n" + "nop\n"); +} +extern inline void cris_tst_cc_z0(void) +{ + asm volatile ("beq _err\n" + "nop\n"); +} +extern inline void cris_tst_cc_v1(void) +{ + asm volatile ("bvc _err\n" + "nop\n"); +} +extern inline void cris_tst_cc_v0(void) +{ + asm volatile ("bvs _err\n" + "nop\n"); +} + +extern inline void cris_tst_cc_c1(void) +{ + asm volatile ("bcc _err\n" + "nop\n"); +} +extern inline void cris_tst_cc_c0(void) +{ + asm volatile ("bcs _err\n" + "nop\n"); +} + +extern inline void cris_tst_mov_cc(int n, int z) +{ + if (n) cris_tst_cc_n1(); else cris_tst_cc_n0(); + if (z) cris_tst_cc_z1(); else cris_tst_cc_z0(); + asm volatile ("" : : "g" (_err)); +} + +extern inline void cris_tst_cc(const int n, const int z, + const int v, const int c) +{ + if (n) cris_tst_cc_n1(); else cris_tst_cc_n0(); + if (z) cris_tst_cc_z1(); else cris_tst_cc_z0(); + if (v) cris_tst_cc_v1(); else cris_tst_cc_v0(); + if (c) cris_tst_cc_c1(); else cris_tst_cc_c0(); + asm volatile ("" : : "g" (_err)); +} |