root / target-arm / helpers.h @ d9ba4830
History | View | Annotate | Download (4 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 | d9ba4830 | pbrook | #define DEF_HELPER_1_0(name, ret, args) \
|
23 | d9ba4830 | pbrook | DEF_HELPER(name, ret, args) \ |
24 | d9ba4830 | pbrook | static inline void gen_helper_##name(TCGv ret) \ |
25 | d9ba4830 | pbrook | { \ |
26 | d9ba4830 | pbrook | tcg_gen_helper_1_0(helper_##name, ret); \ |
27 | d9ba4830 | pbrook | } |
28 | 1497c961 | pbrook | #define DEF_HELPER_1_1(name, ret, args) \
|
29 | 1497c961 | pbrook | DEF_HELPER(name, ret, args) \ |
30 | 1497c961 | pbrook | static inline void gen_helper_##name(TCGv ret, TCGv arg1) \ |
31 | 1497c961 | pbrook | { \ |
32 | 1497c961 | pbrook | tcg_gen_helper_1_1(helper_##name, ret, arg1); \ |
33 | 1497c961 | pbrook | } |
34 | 1497c961 | pbrook | #define DEF_HELPER_1_2(name, ret, args) \
|
35 | 1497c961 | pbrook | DEF_HELPER(name, ret, args) \ |
36 | 1497c961 | pbrook | static inline void gen_helper_##name(TCGv ret, TCGv arg1, TCGv arg2) \ |
37 | 1497c961 | pbrook | { \ |
38 | 1497c961 | pbrook | tcg_gen_helper_1_2(helper_##name, ret, arg1, arg2); \ |
39 | 1497c961 | pbrook | } |
40 | 6ddbc6e4 | pbrook | #define DEF_HELPER_1_3(name, ret, args) \
|
41 | 6ddbc6e4 | pbrook | DEF_HELPER(name, ret, args) \ |
42 | 6ddbc6e4 | pbrook | static inline void gen_helper_##name(TCGv ret, \ |
43 | 6ddbc6e4 | pbrook | TCGv arg1, TCGv arg2, TCGv arg3) \ |
44 | 6ddbc6e4 | pbrook | { \ |
45 | 6ddbc6e4 | pbrook | tcg_gen_helper_1_3(helper_##name, ret, arg1, arg2, arg3); \ |
46 | 6ddbc6e4 | pbrook | } |
47 | 1497c961 | pbrook | #else /* !GEN_HELPER */ |
48 | d9ba4830 | pbrook | #define DEF_HELPER_0_0 DEF_HELPER
|
49 | d9ba4830 | pbrook | #define DEF_HELPER_0_1 DEF_HELPER
|
50 | d9ba4830 | pbrook | #define DEF_HELPER_0_2 DEF_HELPER
|
51 | d9ba4830 | pbrook | #define DEF_HELPER_1_0 DEF_HELPER
|
52 | 1497c961 | pbrook | #define DEF_HELPER_1_1 DEF_HELPER
|
53 | 1497c961 | pbrook | #define DEF_HELPER_1_2 DEF_HELPER
|
54 | 6ddbc6e4 | pbrook | #define DEF_HELPER_1_3 DEF_HELPER
|
55 | 6ddbc6e4 | pbrook | #define HELPER(x) glue(helper_,x)
|
56 | b26eefb6 | pbrook | #endif
|
57 | b26eefb6 | pbrook | |
58 | 1497c961 | pbrook | DEF_HELPER_1_1(clz, uint32_t, (uint32_t)) |
59 | 1497c961 | pbrook | DEF_HELPER_1_1(sxtb16, uint32_t, (uint32_t)) |
60 | 1497c961 | pbrook | DEF_HELPER_1_1(uxtb16, uint32_t, (uint32_t)) |
61 | 1497c961 | pbrook | |
62 | 1497c961 | pbrook | DEF_HELPER_1_2(add_setq, uint32_t, (uint32_t, uint32_t)) |
63 | 1497c961 | pbrook | DEF_HELPER_1_2(add_saturate, uint32_t, (uint32_t, uint32_t)) |
64 | 1497c961 | pbrook | DEF_HELPER_1_2(sub_saturate, uint32_t, (uint32_t, uint32_t)) |
65 | 1497c961 | pbrook | DEF_HELPER_1_2(add_usaturate, uint32_t, (uint32_t, uint32_t)) |
66 | 1497c961 | pbrook | DEF_HELPER_1_2(sub_usaturate, uint32_t, (uint32_t, uint32_t)) |
67 | 1497c961 | pbrook | DEF_HELPER_1_1(double_saturate, uint32_t, (int32_t)) |
68 | 3670669c | pbrook | DEF_HELPER_1_2(sdiv, int32_t, (int32_t, int32_t)) |
69 | 3670669c | pbrook | DEF_HELPER_1_2(udiv, uint32_t, (uint32_t, uint32_t)) |
70 | 3670669c | pbrook | DEF_HELPER_1_1(rbit, uint32_t, (uint32_t)) |
71 | 1497c961 | pbrook | |
72 | 6ddbc6e4 | pbrook | #define PAS_OP(pfx) \
|
73 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## add8, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
74 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## sub8, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
75 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## sub16, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
76 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## add16, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
77 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## addsubx, uint32_t, (uint32_t, uint32_t, uint32_t *)) \ |
78 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(pfx ## subaddx, uint32_t, (uint32_t, uint32_t, uint32_t *)) |
79 | 6ddbc6e4 | pbrook | |
80 | 6ddbc6e4 | pbrook | PAS_OP(s) |
81 | 6ddbc6e4 | pbrook | PAS_OP(u) |
82 | 6ddbc6e4 | pbrook | #undef PAS_OP
|
83 | 6ddbc6e4 | pbrook | |
84 | 6ddbc6e4 | pbrook | #define PAS_OP(pfx) \
|
85 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## add8, uint32_t, (uint32_t, uint32_t)) \ |
86 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## sub8, uint32_t, (uint32_t, uint32_t)) \ |
87 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## sub16, uint32_t, (uint32_t, uint32_t)) \ |
88 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## add16, uint32_t, (uint32_t, uint32_t)) \ |
89 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## addsubx, uint32_t, (uint32_t, uint32_t)) \ |
90 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(pfx ## subaddx, uint32_t, (uint32_t, uint32_t)) |
91 | 6ddbc6e4 | pbrook | PAS_OP(q) |
92 | 6ddbc6e4 | pbrook | PAS_OP(sh) |
93 | 6ddbc6e4 | pbrook | PAS_OP(uq) |
94 | 6ddbc6e4 | pbrook | PAS_OP(uh) |
95 | 6ddbc6e4 | pbrook | #undef PAS_OP
|
96 | 6ddbc6e4 | pbrook | |
97 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(ssat, uint32_t, (uint32_t, uint32_t)) |
98 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(usat, uint32_t, (uint32_t, uint32_t)) |
99 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(ssat16, uint32_t, (uint32_t, uint32_t)) |
100 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(usat16, uint32_t, (uint32_t, uint32_t)) |
101 | 6ddbc6e4 | pbrook | |
102 | 6ddbc6e4 | pbrook | DEF_HELPER_1_2(usad8, uint32_t, (uint32_t, uint32_t)) |
103 | 6ddbc6e4 | pbrook | |
104 | 6ddbc6e4 | pbrook | DEF_HELPER_1_3(sel_flags, uint32_t, (uint32_t, uint32_t, uint32_t)) |
105 | d9ba4830 | pbrook | DEF_HELPER_0_1(exception, void, (uint32_t))
|
106 | d9ba4830 | pbrook | DEF_HELPER_0_0(wfi, void, (void)) |
107 | d9ba4830 | pbrook | |
108 | d9ba4830 | pbrook | DEF_HELPER_0_2(cpsr_write, void, (uint32_t, uint32_t))
|
109 | d9ba4830 | pbrook | DEF_HELPER_1_0(cpsr_read, uint32_t, (void))
|
110 | 6ddbc6e4 | pbrook | |
111 | 1497c961 | pbrook | #undef DEF_HELPER
|
112 | d9ba4830 | pbrook | #undef DEF_HELPER_0_0
|
113 | d9ba4830 | pbrook | #undef DEF_HELPER_0_1
|
114 | d9ba4830 | pbrook | #undef DEF_HELPER_0_2
|
115 | d9ba4830 | pbrook | #undef DEF_HELPER_1_0
|
116 | 1497c961 | pbrook | #undef DEF_HELPER_1_1
|
117 | 1497c961 | pbrook | #undef DEF_HELPER_1_2
|
118 | d9ba4830 | pbrook | #undef DEF_HELPER_1_3
|
119 | 1497c961 | pbrook | #undef GEN_HELPER |