blob: ab47b1a3ab6d1ae49a0e8e6736e7937d9a3afd45 [file] [log] [blame]
pbrooka7812ae2008-11-17 14:43:54 +00001#include "def-helper.h"
ths30898802008-05-21 02:04:15 +00002
pbrooka7812ae2008-11-17 14:43:54 +00003DEF_HELPER_2(raise_exception_err, void, i32, int)
4DEF_HELPER_1(raise_exception, void, i32)
5DEF_HELPER_0(interrupt_restart, void)
ths7dd9e552008-06-08 07:42:23 +00006
thsc8c22272008-06-20 15:12:14 +00007#ifdef TARGET_MIPS64
pbrooka7812ae2008-11-17 14:43:54 +00008DEF_HELPER_3(ldl, tl, tl, tl, int)
9DEF_HELPER_3(ldr, tl, tl, tl, int)
10DEF_HELPER_3(sdl, void, tl, tl, int)
11DEF_HELPER_3(sdr, void, tl, tl, int)
thsc8c22272008-06-20 15:12:14 +000012#endif
pbrooka7812ae2008-11-17 14:43:54 +000013DEF_HELPER_3(lwl, tl, tl, tl, int)
14DEF_HELPER_3(lwr, tl, tl, tl, int)
15DEF_HELPER_3(swl, void, tl, tl, int)
16DEF_HELPER_3(swr, void, tl, tl, int)
thsc8c22272008-06-20 15:12:14 +000017
Aurelien Jarnoe7139c42009-11-30 15:39:54 +010018#ifndef CONFIG_USER_ONLY
19DEF_HELPER_2(ll, tl, tl, int)
20DEF_HELPER_3(sc, tl, tl, tl, int)
21#ifdef TARGET_MIPS64
22DEF_HELPER_2(lld, tl, tl, int)
23DEF_HELPER_3(scd, tl, tl, tl, int)
24#endif
25#endif
26
aurel32e7a69652009-04-06 12:34:07 +000027DEF_HELPER_FLAGS_1(clo, TCG_CALL_CONST | TCG_CALL_PURE, tl, tl)
28DEF_HELPER_FLAGS_1(clz, TCG_CALL_CONST | TCG_CALL_PURE, tl, tl)
ths7dd9e552008-06-08 07:42:23 +000029#ifdef TARGET_MIPS64
aurel32e7a69652009-04-06 12:34:07 +000030DEF_HELPER_FLAGS_1(dclo, TCG_CALL_CONST | TCG_CALL_PURE, tl, tl)
31DEF_HELPER_FLAGS_1(dclz, TCG_CALL_CONST | TCG_CALL_PURE, tl, tl)
pbrooka7812ae2008-11-17 14:43:54 +000032DEF_HELPER_2(dmult, void, tl, tl)
33DEF_HELPER_2(dmultu, void, tl, tl)
ths7dd9e552008-06-08 07:42:23 +000034#endif
thsf1aa6322008-06-09 07:13:38 +000035
pbrooka7812ae2008-11-17 14:43:54 +000036DEF_HELPER_2(muls, tl, tl, tl)
37DEF_HELPER_2(mulsu, tl, tl, tl)
38DEF_HELPER_2(macc, tl, tl, tl)
39DEF_HELPER_2(maccu, tl, tl, tl)
40DEF_HELPER_2(msac, tl, tl, tl)
41DEF_HELPER_2(msacu, tl, tl, tl)
42DEF_HELPER_2(mulhi, tl, tl, tl)
43DEF_HELPER_2(mulhiu, tl, tl, tl)
44DEF_HELPER_2(mulshi, tl, tl, tl)
45DEF_HELPER_2(mulshiu, tl, tl, tl)
46DEF_HELPER_2(macchi, tl, tl, tl)
47DEF_HELPER_2(macchiu, tl, tl, tl)
48DEF_HELPER_2(msachi, tl, tl, tl)
49DEF_HELPER_2(msachiu, tl, tl, tl)
ths92af06d2008-06-20 14:35:19 +000050
thsf1aa6322008-06-09 07:13:38 +000051#ifndef CONFIG_USER_ONLY
ths0eaef5a2008-07-23 16:14:22 +000052/* CP0 helpers */
pbrooka7812ae2008-11-17 14:43:54 +000053DEF_HELPER_0(mfc0_mvpcontrol, tl)
54DEF_HELPER_0(mfc0_mvpconf0, tl)
55DEF_HELPER_0(mfc0_mvpconf1, tl)
56DEF_HELPER_0(mfc0_random, tl)
57DEF_HELPER_0(mfc0_tcstatus, tl)
58DEF_HELPER_0(mftc0_tcstatus, tl)
59DEF_HELPER_0(mfc0_tcbind, tl)
60DEF_HELPER_0(mftc0_tcbind, tl)
61DEF_HELPER_0(mfc0_tcrestart, tl)
62DEF_HELPER_0(mftc0_tcrestart, tl)
63DEF_HELPER_0(mfc0_tchalt, tl)
64DEF_HELPER_0(mftc0_tchalt, tl)
65DEF_HELPER_0(mfc0_tccontext, tl)
66DEF_HELPER_0(mftc0_tccontext, tl)
67DEF_HELPER_0(mfc0_tcschedule, tl)
68DEF_HELPER_0(mftc0_tcschedule, tl)
69DEF_HELPER_0(mfc0_tcschefback, tl)
70DEF_HELPER_0(mftc0_tcschefback, tl)
71DEF_HELPER_0(mfc0_count, tl)
72DEF_HELPER_0(mftc0_entryhi, tl)
73DEF_HELPER_0(mftc0_status, tl)
74DEF_HELPER_0(mfc0_lladdr, tl)
75DEF_HELPER_1(mfc0_watchlo, tl, i32)
76DEF_HELPER_1(mfc0_watchhi, tl, i32)
77DEF_HELPER_0(mfc0_debug, tl)
78DEF_HELPER_0(mftc0_debug, tl)
thsf1aa6322008-06-09 07:13:38 +000079#ifdef TARGET_MIPS64
pbrooka7812ae2008-11-17 14:43:54 +000080DEF_HELPER_0(dmfc0_tcrestart, tl)
81DEF_HELPER_0(dmfc0_tchalt, tl)
82DEF_HELPER_0(dmfc0_tccontext, tl)
83DEF_HELPER_0(dmfc0_tcschedule, tl)
84DEF_HELPER_0(dmfc0_tcschefback, tl)
85DEF_HELPER_0(dmfc0_lladdr, tl)
86DEF_HELPER_1(dmfc0_watchlo, tl, i32)
thsf1aa6322008-06-09 07:13:38 +000087#endif /* TARGET_MIPS64 */
88
pbrooka7812ae2008-11-17 14:43:54 +000089DEF_HELPER_1(mtc0_index, void, tl)
90DEF_HELPER_1(mtc0_mvpcontrol, void, tl)
91DEF_HELPER_1(mtc0_vpecontrol, void, tl)
92DEF_HELPER_1(mtc0_vpeconf0, void, tl)
93DEF_HELPER_1(mtc0_vpeconf1, void, tl)
94DEF_HELPER_1(mtc0_yqmask, void, tl)
95DEF_HELPER_1(mtc0_vpeopt, void, tl)
96DEF_HELPER_1(mtc0_entrylo0, void, tl)
97DEF_HELPER_1(mtc0_tcstatus, void, tl)
98DEF_HELPER_1(mttc0_tcstatus, void, tl)
99DEF_HELPER_1(mtc0_tcbind, void, tl)
100DEF_HELPER_1(mttc0_tcbind, void, tl)
101DEF_HELPER_1(mtc0_tcrestart, void, tl)
102DEF_HELPER_1(mttc0_tcrestart, void, tl)
103DEF_HELPER_1(mtc0_tchalt, void, tl)
104DEF_HELPER_1(mttc0_tchalt, void, tl)
105DEF_HELPER_1(mtc0_tccontext, void, tl)
106DEF_HELPER_1(mttc0_tccontext, void, tl)
107DEF_HELPER_1(mtc0_tcschedule, void, tl)
108DEF_HELPER_1(mttc0_tcschedule, void, tl)
109DEF_HELPER_1(mtc0_tcschefback, void, tl)
110DEF_HELPER_1(mttc0_tcschefback, void, tl)
111DEF_HELPER_1(mtc0_entrylo1, void, tl)
112DEF_HELPER_1(mtc0_context, void, tl)
113DEF_HELPER_1(mtc0_pagemask, void, tl)
114DEF_HELPER_1(mtc0_pagegrain, void, tl)
115DEF_HELPER_1(mtc0_wired, void, tl)
116DEF_HELPER_1(mtc0_srsconf0, void, tl)
117DEF_HELPER_1(mtc0_srsconf1, void, tl)
118DEF_HELPER_1(mtc0_srsconf2, void, tl)
119DEF_HELPER_1(mtc0_srsconf3, void, tl)
120DEF_HELPER_1(mtc0_srsconf4, void, tl)
121DEF_HELPER_1(mtc0_hwrena, void, tl)
122DEF_HELPER_1(mtc0_count, void, tl)
123DEF_HELPER_1(mtc0_entryhi, void, tl)
124DEF_HELPER_1(mttc0_entryhi, void, tl)
125DEF_HELPER_1(mtc0_compare, void, tl)
126DEF_HELPER_1(mtc0_status, void, tl)
127DEF_HELPER_1(mttc0_status, void, tl)
128DEF_HELPER_1(mtc0_intctl, void, tl)
129DEF_HELPER_1(mtc0_srsctl, void, tl)
130DEF_HELPER_1(mtc0_cause, void, tl)
131DEF_HELPER_1(mtc0_ebase, void, tl)
132DEF_HELPER_1(mtc0_config0, void, tl)
133DEF_HELPER_1(mtc0_config2, void, tl)
Aurelien Jarno2a6e32d2009-11-22 13:22:54 +0100134DEF_HELPER_1(mtc0_lladdr, void, tl)
pbrooka7812ae2008-11-17 14:43:54 +0000135DEF_HELPER_2(mtc0_watchlo, void, tl, i32)
136DEF_HELPER_2(mtc0_watchhi, void, tl, i32)
137DEF_HELPER_1(mtc0_xcontext, void, tl)
138DEF_HELPER_1(mtc0_framemask, void, tl)
139DEF_HELPER_1(mtc0_debug, void, tl)
140DEF_HELPER_1(mttc0_debug, void, tl)
141DEF_HELPER_1(mtc0_performance0, void, tl)
142DEF_HELPER_1(mtc0_taglo, void, tl)
143DEF_HELPER_1(mtc0_datalo, void, tl)
144DEF_HELPER_1(mtc0_taghi, void, tl)
145DEF_HELPER_1(mtc0_datahi, void, tl)
thsf1aa6322008-06-09 07:13:38 +0000146
147/* MIPS MT functions */
pbrooka7812ae2008-11-17 14:43:54 +0000148DEF_HELPER_1(mftgpr, tl, i32);
149DEF_HELPER_1(mftlo, tl, i32)
150DEF_HELPER_1(mfthi, tl, i32)
151DEF_HELPER_1(mftacx, tl, i32)
152DEF_HELPER_0(mftdsp, tl)
153DEF_HELPER_2(mttgpr, void, tl, i32)
154DEF_HELPER_2(mttlo, void, tl, i32)
155DEF_HELPER_2(mtthi, void, tl, i32)
156DEF_HELPER_2(mttacx, void, tl, i32)
157DEF_HELPER_1(mttdsp, void, tl)
158DEF_HELPER_1(dmt, tl, tl)
159DEF_HELPER_1(emt, tl, tl)
160DEF_HELPER_1(dvpe, tl, tl)
161DEF_HELPER_1(evpe, tl, tl)
ths0eaef5a2008-07-23 16:14:22 +0000162#endif /* !CONFIG_USER_ONLY */
pbrooka7812ae2008-11-17 14:43:54 +0000163DEF_HELPER_2(fork, void, tl, tl)
164DEF_HELPER_1(yield, tl, tl)
thsf1aa6322008-06-09 07:13:38 +0000165
166/* CP1 functions */
pbrooka7812ae2008-11-17 14:43:54 +0000167DEF_HELPER_1(cfc1, tl, i32)
168DEF_HELPER_2(ctc1, void, tl, i32)
ths5d0fc902008-06-11 15:27:54 +0000169
pbrooka7812ae2008-11-17 14:43:54 +0000170DEF_HELPER_1(float_cvtd_s, i64, i32)
171DEF_HELPER_1(float_cvtd_w, i64, i32)
172DEF_HELPER_1(float_cvtd_l, i64, i64)
173DEF_HELPER_1(float_cvtl_d, i64, i64)
174DEF_HELPER_1(float_cvtl_s, i64, i32)
175DEF_HELPER_1(float_cvtps_pw, i64, i64)
176DEF_HELPER_1(float_cvtpw_ps, i64, i64)
177DEF_HELPER_1(float_cvts_d, i32, i64)
178DEF_HELPER_1(float_cvts_w, i32, i32)
179DEF_HELPER_1(float_cvts_l, i32, i64)
180DEF_HELPER_1(float_cvts_pl, i32, i32)
181DEF_HELPER_1(float_cvts_pu, i32, i32)
182DEF_HELPER_1(float_cvtw_s, i32, i32)
183DEF_HELPER_1(float_cvtw_d, i32, i64)
ths5d0fc902008-06-11 15:27:54 +0000184
pbrooka7812ae2008-11-17 14:43:54 +0000185DEF_HELPER_2(float_addr_ps, i64, i64, i64)
186DEF_HELPER_2(float_mulr_ps, i64, i64, i64)
ths5d0fc902008-06-11 15:27:54 +0000187
pbrooka7812ae2008-11-17 14:43:54 +0000188#define FOP_PROTO(op) \
189DEF_HELPER_1(float_ ## op ## l_s, i64, i32) \
190DEF_HELPER_1(float_ ## op ## l_d, i64, i64) \
191DEF_HELPER_1(float_ ## op ## w_s, i32, i32) \
192DEF_HELPER_1(float_ ## op ## w_d, i32, i64)
thsb6d96be2008-07-09 11:05:10 +0000193FOP_PROTO(round)
194FOP_PROTO(trunc)
195FOP_PROTO(ceil)
196FOP_PROTO(floor)
197#undef FOP_PROTO
198
pbrooka7812ae2008-11-17 14:43:54 +0000199#define FOP_PROTO(op) \
200DEF_HELPER_1(float_ ## op ## _s, i32, i32) \
201DEF_HELPER_1(float_ ## op ## _d, i64, i64)
thsa16336e2008-06-19 18:35:02 +0000202FOP_PROTO(sqrt)
ths5d0fc902008-06-11 15:27:54 +0000203FOP_PROTO(rsqrt)
204FOP_PROTO(recip)
205#undef FOP_PROTO
206
pbrooka7812ae2008-11-17 14:43:54 +0000207#define FOP_PROTO(op) \
208DEF_HELPER_1(float_ ## op ## _s, i32, i32) \
209DEF_HELPER_1(float_ ## op ## _d, i64, i64) \
210DEF_HELPER_1(float_ ## op ## _ps, i64, i64)
thsb6d96be2008-07-09 11:05:10 +0000211FOP_PROTO(abs)
212FOP_PROTO(chs)
213FOP_PROTO(recip1)
214FOP_PROTO(rsqrt1)
215#undef FOP_PROTO
216
pbrooka7812ae2008-11-17 14:43:54 +0000217#define FOP_PROTO(op) \
218DEF_HELPER_2(float_ ## op ## _s, i32, i32, i32) \
219DEF_HELPER_2(float_ ## op ## _d, i64, i64, i64) \
220DEF_HELPER_2(float_ ## op ## _ps, i64, i64, i64)
ths5d0fc902008-06-11 15:27:54 +0000221FOP_PROTO(add)
222FOP_PROTO(sub)
223FOP_PROTO(mul)
224FOP_PROTO(div)
thsb6d96be2008-07-09 11:05:10 +0000225FOP_PROTO(recip2)
226FOP_PROTO(rsqrt2)
227#undef FOP_PROTO
228
pbrooka7812ae2008-11-17 14:43:54 +0000229#define FOP_PROTO(op) \
230DEF_HELPER_3(float_ ## op ## _s, i32, i32, i32, i32) \
231DEF_HELPER_3(float_ ## op ## _d, i64, i64, i64, i64) \
232DEF_HELPER_3(float_ ## op ## _ps, i64, i64, i64, i64)
thsa16336e2008-06-19 18:35:02 +0000233FOP_PROTO(muladd)
234FOP_PROTO(mulsub)
235FOP_PROTO(nmuladd)
236FOP_PROTO(nmulsub)
ths5d0fc902008-06-11 15:27:54 +0000237#undef FOP_PROTO
238
pbrooka7812ae2008-11-17 14:43:54 +0000239#define FOP_PROTO(op) \
240DEF_HELPER_3(cmp_d_ ## op, void, i64, i64, int) \
241DEF_HELPER_3(cmpabs_d_ ## op, void, i64, i64, int) \
242DEF_HELPER_3(cmp_s_ ## op, void, i32, i32, int) \
243DEF_HELPER_3(cmpabs_s_ ## op, void, i32, i32, int) \
244DEF_HELPER_3(cmp_ps_ ## op, void, i64, i64, int) \
245DEF_HELPER_3(cmpabs_ps_ ## op, void, i64, i64, int)
ths5d0fc902008-06-11 15:27:54 +0000246FOP_PROTO(f)
247FOP_PROTO(un)
248FOP_PROTO(eq)
249FOP_PROTO(ueq)
250FOP_PROTO(olt)
251FOP_PROTO(ult)
252FOP_PROTO(ole)
253FOP_PROTO(ule)
254FOP_PROTO(sf)
255FOP_PROTO(ngle)
256FOP_PROTO(seq)
257FOP_PROTO(ngl)
258FOP_PROTO(lt)
259FOP_PROTO(nge)
260FOP_PROTO(le)
261FOP_PROTO(ngt)
262#undef FOP_PROTO
ths08ba7962008-06-12 03:15:13 +0000263
264/* Special functions */
ths0eaef5a2008-07-23 16:14:22 +0000265#ifndef CONFIG_USER_ONLY
pbrooka7812ae2008-11-17 14:43:54 +0000266DEF_HELPER_0(tlbwi, void)
267DEF_HELPER_0(tlbwr, void)
268DEF_HELPER_0(tlbp, void)
269DEF_HELPER_0(tlbr, void)
270DEF_HELPER_0(di, tl)
271DEF_HELPER_0(ei, tl)
272DEF_HELPER_0(eret, void)
273DEF_HELPER_0(deret, void)
ths0eaef5a2008-07-23 16:14:22 +0000274#endif /* !CONFIG_USER_ONLY */
pbrooka7812ae2008-11-17 14:43:54 +0000275DEF_HELPER_0(rdhwr_cpunum, tl)
276DEF_HELPER_0(rdhwr_synci_step, tl)
277DEF_HELPER_0(rdhwr_cc, tl)
278DEF_HELPER_0(rdhwr_ccres, tl)
279DEF_HELPER_1(pmon, void, int)
280DEF_HELPER_0(wait, void)
281
282#include "def-helper.h"