00001 static char *tst_cc_loc = NULL;
00002
00003 #define cris_tst_cc_init() \
00004 do { tst_cc_loc = "test_cc failed at " CURRENT_LOCATION; } while(0)
00005
00006
00007 void _err(void) {
00008 if (!tst_cc_loc)
00009 tst_cc_loc = "tst_cc_failed\n";
00010 _fail(tst_cc_loc);
00011 }
00012
00013 extern inline void cris_tst_cc_n1(void)
00014 {
00015 asm volatile ("bpl _err\n"
00016 "nop\n");
00017 }
00018 extern inline void cris_tst_cc_n0(void)
00019 {
00020 asm volatile ("bmi _err\n"
00021 "nop\n");
00022 }
00023
00024 extern inline void cris_tst_cc_z1(void)
00025 {
00026 asm volatile ("bne _err\n"
00027 "nop\n");
00028 }
00029 extern inline void cris_tst_cc_z0(void)
00030 {
00031 asm volatile ("beq _err\n"
00032 "nop\n");
00033 }
00034 extern inline void cris_tst_cc_v1(void)
00035 {
00036 asm volatile ("bvc _err\n"
00037 "nop\n");
00038 }
00039 extern inline void cris_tst_cc_v0(void)
00040 {
00041 asm volatile ("bvs _err\n"
00042 "nop\n");
00043 }
00044
00045 extern inline void cris_tst_cc_c1(void)
00046 {
00047 asm volatile ("bcc _err\n"
00048 "nop\n");
00049 }
00050 extern inline void cris_tst_cc_c0(void)
00051 {
00052 asm volatile ("bcs _err\n"
00053 "nop\n");
00054 }
00055
00056 extern inline void cris_tst_mov_cc(int n, int z)
00057 {
00058 if (n) cris_tst_cc_n1(); else cris_tst_cc_n0();
00059 if (z) cris_tst_cc_z1(); else cris_tst_cc_z0();
00060 asm volatile ("" : : "g" (_err));
00061 }
00062
00063 extern inline void cris_tst_cc(const int n, const int z,
00064 const int v, const int c)
00065 {
00066 if (n) cris_tst_cc_n1(); else cris_tst_cc_n0();
00067 if (z) cris_tst_cc_z1(); else cris_tst_cc_z0();
00068 if (v) cris_tst_cc_v1(); else cris_tst_cc_v0();
00069 if (c) cris_tst_cc_c1(); else cris_tst_cc_c0();
00070 asm volatile ("" : : "g" (_err));
00071 }