blob: 29b71cd7b935fccbda859c84a90a14cf44861001 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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. */
void _err(void) {
if (!tst_cc_loc)
tst_cc_loc = "tst_cc_failed\n";
_fail(tst_cc_loc);
}
static inline void cris_tst_cc_n1(void)
{
asm volatile ("bpl _err\n"
"nop\n");
}
static inline void cris_tst_cc_n0(void)
{
asm volatile ("bmi _err\n"
"nop\n");
}
static inline void cris_tst_cc_z1(void)
{
asm volatile ("bne _err\n"
"nop\n");
}
static inline void cris_tst_cc_z0(void)
{
asm volatile ("beq _err\n"
"nop\n");
}
static inline void cris_tst_cc_v1(void)
{
asm volatile ("bvc _err\n"
"nop\n");
}
static inline void cris_tst_cc_v0(void)
{
asm volatile ("bvs _err\n"
"nop\n");
}
static inline void cris_tst_cc_c1(void)
{
asm volatile ("bcc _err\n"
"nop\n");
}
static inline void cris_tst_cc_c0(void)
{
asm volatile ("bcs _err\n"
"nop\n");
}
static 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));
}
static 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));
}
|