root / target-arm / helpers.h @ b0109805
History | View | Annotate | Download (4.5 kB)
1 | 6ddbc6e4 | pbrook | #define DEF_HELPER(name, ret, args) ret glue(helper_,name) args;
|
---|---|---|---|
2 | 1497c961 | pbrook | |
3 | 1497c961 | pbrook | #ifdef GEN_HELPER
|
4 | d9ba4830 | pbrook | #define DEF_HELPER_0_0(name, ret, args) \
|
5 | d9ba4830 | pbrook | DEF_HELPER(name, ret, args) \ |
6 | d9ba4830 | pbrook | static inline void gen_helper_##name(void) \ |
7 | d9ba4830 | pbrook | { \ |
8 | d9ba4830 | pbrook | tcg_gen_helper_0_0(helper_##name); \ |
9 | d9ba4830 | pbrook | } |
10 | d9ba4830 | pbrook | #define DEF_HELPER_0_1(name, ret, args) \
|
11 | d9ba4830 | pbrook | DEF_HELPER(name, ret, args) \ |
12 | d9ba4830 | pbrook | static inline void gen_helper_##name(TCGv arg1) \ |
13 | d9ba4830 | pbrook | { \ |
14 | d9ba4830 | pbrook | tcg_gen_helper_0_1(helper_##name, arg1); \ |
15 | d9ba4830 | pbrook | } |
16 | d9ba4830 | pbrook | #define DEF_HELPER_0_2(name, ret, args) \
|
17 | d9ba4830 | pbrook | DEF_HELPER(name, ret, args) \ |
18 | d9ba4830 | pbrook | static inline void gen_helper_##name(TCGv arg1, TCGv arg2) \ |
19 | d9ba4830 | pbrook | { \ |
20 | d9ba4830 | pbrook | tcg_gen_helper_0_2(helper_##name, arg1, arg2); \ |
21 | d9ba4830 | pbrook | } |
22 | b0109805 | pbrook | #define DEF_HELPER_0_3(name, ret, args) \
|
23 | b0109805 | pbrook | DEF_HELPER(name, ret, args) \ |
24 | b0109805 | pbrook | static inline void gen_helper_##name( \ |
25 | b0109805 | pbrook | TCGv arg1, TCGv arg2, TCGv arg3) \ |
26 | b0109805 | pbrook | { \ |
27 | b0109805 | pbrook | tcg_gen_helper_0_3(helper_##name, arg1, arg2, arg3); \ |
28 | b0109805 | pbrook | } |
29 | d9ba4830 | pbrook | #define DEF_HELPER_1_0(name, ret, args) \
|
30 | d9ba4830 | pbrook | DEF_HELPER(name, ret, args) \ |
31 | d9ba4830 | pbrook | static inline void gen_helper_##name(TCGv ret) \ |
32 | d9ba4830 | pbrook | { \ |
33 | d9ba4830 | pbrook | tcg_gen_helper_1_0(helper_##name, ret); \ |
34 | d9ba4830 | pbrook | } |
35 | 1497c961 | pbrook | #define DEF_HELPER_1_1(name, ret, args) \
|
36 | 1497c961 | pbrook | DEF_HELPER(name, ret, args) \ |
37 | 1497c961 | pbrook | static inline void gen_helper_##name(TCGv ret, TCGv arg1) \ |
38 | 1497c961 | pbrook | { \ |
39 | 1497c961 | pbrook | tcg_gen_helper_1_1(helper_##name, ret, arg1); \ |
40 | 1497c961 | pbrook | } |
41 | 1497c961 | pbrook | #define DEF_HELPER_1_2(name, ret, args) \
|
42 | 1497c961 | pbrook | DEF_HELPER(name, ret, args) \ |
43 | 1497c961 | pbrook | static inline void gen_helper_##name(TCGv ret, TCGv arg1, TCGv arg2) \ |
44 | 1497c961 | pbrook | { \ |
45 | 1497c961 | pbrook | tcg_gen_helper_1_2(helper_##name, ret, arg1, arg2); \ |
46 | 1497c961 | pbrook | } |
47 | 6ddbc6e4 | pbrook | #define DEF_HELPER_1_3(name, ret, args) \
|
48 | 6ddbc6e4 | pbrook | DEF_HELPER(name, ret, args) \ |
49 | 6ddbc6e4 | pbrook | static inline void gen_helper_##name(TCGv ret, \ |
50 | 6ddbc6e4 | pbrook | TCGv arg1, TCGv arg2, TCGv arg3) \ |
51 | 6ddbc6e4 | pbrook | { \ |
52 | 6ddbc6e4 | pbrook | tcg_gen_helper_1_3(helper_##name, ret, arg1, arg2, arg3); \ |
53 | 6ddbc6e4 | pbrook | } |
54 | 1497c961 | pbrook | #else /* !GEN_HELPER */ |
55 | d9ba4830 | pbrook | #define DEF_HELPER_0_0 DEF_HELPER
|
56 | d9ba4830 | pbrook | #define DEF_HELPER_0_1 DEF_HELPER
|
57 | d9ba4830 | pbrook | #define DEF_HELPER_0_2 DEF_HELPER
|
58 | b0109805 | pbrook | #define DEF_HELPER_0_3 DEF_HELPER
|
59 | d9ba4830 | pbrook | #define DEF_HELPER_1_0 DEF_HELPER
|
60 | 1497c961 | pbrook | #define DEF_HELPER_1_1 DEF_HELPER
|
61 | 1497c961 | pbrook | #define DEF_HELPER_1_2 DEF_HELPER
|
62 | 6ddbc6e4 | pbrook | #define DEF_HELPER_1_3 DEF_HELPER
|
63 | 6ddbc6e4 | pbrook | #define HELPER(x) glue(helper_,x)
|
64 | b26eefb6 | pbrook | #endif
|
65 | b26eefb6 | pbrook | |
66 | 1497c961 | pbrook | DEF_HELPER_1_1(clz, uint32_t, (uint32_t)) |
67 | 1497c961 | pbrook | DEF_HELPER_1_1(sxtb16, uint32_t, (uint32_t)) |
68 | 1497c961 | pbrook | DEF_HELPER_1_1(uxtb16, uint32_t, (uint32_t)) |
69 | 1497c961 | pbrook | |
70 | 1497c961 | pbrook | DEF_HELPER_1_2(add_setq, uint32_t, (uint32_t, uint32_t)) |
71 | 1497c961 | pbrook | DEF_HELPER_1_2(add_saturate, uint32_t, (uint32_t, uint32_t)) |
72 | 1497c961 | pbrook | DEF_HELPER_1_2(sub_saturate, uint32_t, (uint32_t, uint32_t)) |
73 | 1497c961 | pbrook | DEF_HELPER_1_2(add_usaturate, uint32_t, (uint32_t, uint32_t)) |
74 | 1497c961 | pbrook | DEF_HELPER_1_2(sub_usaturate, uint32_t, (uint32_t, uint32_t)) |
75 | 1497c961 | pbrook | DEF_HELPER_1_1(double_saturate, uint32_t, (int32_t)) |
76 | 3670669c | pbrook | DEF_HELPER_1_2(sdiv, int32_t, (int32_t, int32_t)) |
77 | 3670669c | pbrook | DEF_HELPER_1_2(udiv, uint32_t, (uint32_t, uint32_t)) |
78 | 3670669c | pbrook | DEF_HELPER_1_1(rbit, uint32_t, (uint32_t)) |
79 | 1497c961 | pbrook | |
80 | 6ddbc6e4 | pbrook | #define PAS_OP(pfx) \
|
81 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## add8, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
82 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## sub8, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
83 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## sub16, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
84 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## add16, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
85 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## addsubx, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
86 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## subaddx, uint32_t, (uint32_t, uint32_t, uint32_t *)) |
87 | 6ddbc6e4 | pbrook | |
88 | 6ddbc6e4 | pbrook | PAS_OP(s) |
89 | 6ddbc6e4 | pbrook | PAS_OP(u) |
90 | 6ddbc6e4 | pbrook | #undef PAS_OP
|
91 | 6ddbc6e4 | pbrook | |
92 | 6ddbc6e4 | pbrook | #define PAS_OP(pfx) \
|
93 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## add8, uint32_t, (uint32_t, uint32_t)) \ |
94 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## sub8, uint32_t, (uint32_t, uint32_t)) \ |
95 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## sub16, uint32_t, (uint32_t, uint32_t)) \ |
96 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## add16, uint32_t, (uint32_t, uint32_t)) \ |
97 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## addsubx, uint32_t, (uint32_t, uint32_t)) \ |
98 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## subaddx, uint32_t, (uint32_t, uint32_t)) |
99 | 6ddbc6e4 | pbrook | PAS_OP(q) |
100 | 6ddbc6e4 | pbrook | PAS_OP(sh) |
101 | 6ddbc6e4 | pbrook | PAS_OP(uq) |
102 | 6ddbc6e4 | pbrook | PAS_OP(uh) |
103 | 6ddbc6e4 | pbrook | #undef PAS_OP
|
104 | 6ddbc6e4 | pbrook | |
105 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(ssat, uint32_t, (uint32_t, uint32_t)) |
106 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(usat, uint32_t, (uint32_t, uint32_t)) |
107 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(ssat16, uint32_t, (uint32_t, uint32_t)) |
108 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(usat16, uint32_t, (uint32_t, uint32_t)) |
109 | 6ddbc6e4 | pbrook | |
110 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(usad8, uint32_t, (uint32_t, uint32_t)) |
111 | 6ddbc6e4 | pbrook | |
112 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(sel_flags, uint32_t, (uint32_t, uint32_t, uint32_t)) |
113 | d9ba4830 | pbrook | DEF_HELPER_0_1(exception, void, (uint32_t))
|
114 | d9ba4830 | pbrook | DEF_HELPER_0_0(wfi, void, (void)) |
115 | d9ba4830 | pbrook | |
116 | d9ba4830 | pbrook | DEF_HELPER_0_2(cpsr_write, void, (uint32_t, uint32_t))
|
117 | d9ba4830 | pbrook | DEF_HELPER_1_0(cpsr_read, uint32_t, (void))
|
118 | 6ddbc6e4 | pbrook | |
119 | b0109805 | pbrook | DEF_HELPER_1_2(get_r13_banked, uint32_t, (CPUState *, uint32_t)) |
120 | b0109805 | pbrook | DEF_HELPER_0_3(set_r13_banked, void, (CPUState *, uint32_t, uint32_t))
|
121 | b0109805 | pbrook | |
122 | b0109805 | pbrook | DEF_HELPER_1_1(get_user_reg, uint32_t, (uint32_t)) |
123 | b0109805 | pbrook | DEF_HELPER_0_2(set_user_reg, void, (uint32_t, uint32_t))
|
124 | b0109805 | pbrook | |
125 | 1497c961 | pbrook | #undef DEF_HELPER
|
126 | d9ba4830 | pbrook | #undef DEF_HELPER_0_0
|
127 | d9ba4830 | pbrook | #undef DEF_HELPER_0_1
|
128 | d9ba4830 | pbrook | #undef DEF_HELPER_0_2
|
129 | d9ba4830 | pbrook | #undef DEF_HELPER_1_0
|
130 | 1497c961 | pbrook | #undef DEF_HELPER_1_1
|
131 | 1497c961 | pbrook | #undef DEF_HELPER_1_2
|
132 | d9ba4830 | pbrook | #undef DEF_HELPER_1_3
|
133 | 1497c961 | pbrook | #undef GEN_HELPER |