blob: 76fb451e77603ab6a0b5a066455a54cc04264922 [file] [log] [blame]
pbrooka7812ae2008-11-17 14:43:54 +00001#include "def-helper.h"
ths30898802008-05-21 02:04:15 +00002
Stefan Weil59821ae2012-03-18 23:16:03 +01003DEF_HELPER_2(raise_exception_err, noreturn, i32, int)
4DEF_HELPER_1(raise_exception, noreturn, i32)
ths7dd9e552008-06-08 07:42:23 +00005
thsc8c22272008-06-20 15:12:14 +00006#ifdef TARGET_MIPS64
pbrooka7812ae2008-11-17 14:43:54 +00007DEF_HELPER_3(ldl, tl, tl, tl, int)
8DEF_HELPER_3(ldr, tl, tl, tl, int)
9DEF_HELPER_3(sdl, void, tl, tl, int)
10DEF_HELPER_3(sdr, void, tl, tl, int)
thsc8c22272008-06-20 15:12:14 +000011#endif
pbrooka7812ae2008-11-17 14:43:54 +000012DEF_HELPER_3(lwl, tl, tl, tl, int)
13DEF_HELPER_3(lwr, tl, tl, tl, int)
14DEF_HELPER_3(swl, void, tl, tl, int)
15DEF_HELPER_3(swr, void, tl, tl, int)
thsc8c22272008-06-20 15:12:14 +000016
Aurelien Jarnoe7139c42009-11-30 15:39:54 +010017#ifndef CONFIG_USER_ONLY
18DEF_HELPER_2(ll, tl, tl, int)
19DEF_HELPER_3(sc, tl, tl, tl, int)
20#ifdef TARGET_MIPS64
21DEF_HELPER_2(lld, tl, tl, int)
22DEF_HELPER_3(scd, tl, tl, tl, int)
23#endif
24#endif
25
aurel32e7a69652009-04-06 12:34:07 +000026DEF_HELPER_FLAGS_1(clo, TCG_CALL_CONST | TCG_CALL_PURE, tl, tl)
27DEF_HELPER_FLAGS_1(clz, TCG_CALL_CONST | TCG_CALL_PURE, tl, tl)
ths7dd9e552008-06-08 07:42:23 +000028#ifdef TARGET_MIPS64
aurel32e7a69652009-04-06 12:34:07 +000029DEF_HELPER_FLAGS_1(dclo, TCG_CALL_CONST | TCG_CALL_PURE, tl, tl)
30DEF_HELPER_FLAGS_1(dclz, TCG_CALL_CONST | TCG_CALL_PURE, tl, tl)
pbrooka7812ae2008-11-17 14:43:54 +000031DEF_HELPER_2(dmult, void, tl, tl)
32DEF_HELPER_2(dmultu, void, tl, tl)
ths7dd9e552008-06-08 07:42:23 +000033#endif
thsf1aa6322008-06-09 07:13:38 +000034
pbrooka7812ae2008-11-17 14:43:54 +000035DEF_HELPER_2(muls, tl, tl, tl)
36DEF_HELPER_2(mulsu, tl, tl, tl)
37DEF_HELPER_2(macc, tl, tl, tl)
38DEF_HELPER_2(maccu, tl, tl, tl)
39DEF_HELPER_2(msac, tl, tl, tl)
40DEF_HELPER_2(msacu, tl, tl, tl)
41DEF_HELPER_2(mulhi, tl, tl, tl)
42DEF_HELPER_2(mulhiu, tl, tl, tl)
43DEF_HELPER_2(mulshi, tl, tl, tl)
44DEF_HELPER_2(mulshiu, tl, tl, tl)
45DEF_HELPER_2(macchi, tl, tl, tl)
46DEF_HELPER_2(macchiu, tl, tl, tl)
47DEF_HELPER_2(msachi, tl, tl, tl)
48DEF_HELPER_2(msachiu, tl, tl, tl)
ths92af06d2008-06-20 14:35:19 +000049
thsf1aa6322008-06-09 07:13:38 +000050#ifndef CONFIG_USER_ONLY
ths0eaef5a2008-07-23 16:14:22 +000051/* CP0 helpers */
pbrooka7812ae2008-11-17 14:43:54 +000052DEF_HELPER_0(mfc0_mvpcontrol, tl)
53DEF_HELPER_0(mfc0_mvpconf0, tl)
54DEF_HELPER_0(mfc0_mvpconf1, tl)
Edgar E. Iglesias5a25ce92011-08-29 23:07:34 +020055DEF_HELPER_0(mftc0_vpecontrol, tl)
56DEF_HELPER_0(mftc0_vpeconf0, tl)
pbrooka7812ae2008-11-17 14:43:54 +000057DEF_HELPER_0(mfc0_random, tl)
58DEF_HELPER_0(mfc0_tcstatus, tl)
59DEF_HELPER_0(mftc0_tcstatus, tl)
60DEF_HELPER_0(mfc0_tcbind, tl)
61DEF_HELPER_0(mftc0_tcbind, tl)
62DEF_HELPER_0(mfc0_tcrestart, tl)
63DEF_HELPER_0(mftc0_tcrestart, tl)
64DEF_HELPER_0(mfc0_tchalt, tl)
65DEF_HELPER_0(mftc0_tchalt, tl)
66DEF_HELPER_0(mfc0_tccontext, tl)
67DEF_HELPER_0(mftc0_tccontext, tl)
68DEF_HELPER_0(mfc0_tcschedule, tl)
69DEF_HELPER_0(mftc0_tcschedule, tl)
70DEF_HELPER_0(mfc0_tcschefback, tl)
71DEF_HELPER_0(mftc0_tcschefback, tl)
72DEF_HELPER_0(mfc0_count, tl)
73DEF_HELPER_0(mftc0_entryhi, tl)
74DEF_HELPER_0(mftc0_status, tl)
Edgar E. Iglesias5a25ce92011-08-29 23:07:34 +020075DEF_HELPER_0(mftc0_cause, tl)
76DEF_HELPER_0(mftc0_epc, tl)
77DEF_HELPER_0(mftc0_ebase, tl)
78DEF_HELPER_1(mftc0_configx, tl, tl)
pbrooka7812ae2008-11-17 14:43:54 +000079DEF_HELPER_0(mfc0_lladdr, tl)
80DEF_HELPER_1(mfc0_watchlo, tl, i32)
81DEF_HELPER_1(mfc0_watchhi, tl, i32)
82DEF_HELPER_0(mfc0_debug, tl)
83DEF_HELPER_0(mftc0_debug, tl)
thsf1aa6322008-06-09 07:13:38 +000084#ifdef TARGET_MIPS64
pbrooka7812ae2008-11-17 14:43:54 +000085DEF_HELPER_0(dmfc0_tcrestart, tl)
86DEF_HELPER_0(dmfc0_tchalt, tl)
87DEF_HELPER_0(dmfc0_tccontext, tl)
88DEF_HELPER_0(dmfc0_tcschedule, tl)
89DEF_HELPER_0(dmfc0_tcschefback, tl)
90DEF_HELPER_0(dmfc0_lladdr, tl)
91DEF_HELPER_1(dmfc0_watchlo, tl, i32)
thsf1aa6322008-06-09 07:13:38 +000092#endif /* TARGET_MIPS64 */
93
pbrooka7812ae2008-11-17 14:43:54 +000094DEF_HELPER_1(mtc0_index, void, tl)
95DEF_HELPER_1(mtc0_mvpcontrol, void, tl)
96DEF_HELPER_1(mtc0_vpecontrol, void, tl)
Edgar E. Iglesias5a25ce92011-08-29 23:07:34 +020097DEF_HELPER_1(mttc0_vpecontrol, void, tl)
pbrooka7812ae2008-11-17 14:43:54 +000098DEF_HELPER_1(mtc0_vpeconf0, void, tl)
Edgar E. Iglesias5a25ce92011-08-29 23:07:34 +020099DEF_HELPER_1(mttc0_vpeconf0, void, tl)
pbrooka7812ae2008-11-17 14:43:54 +0000100DEF_HELPER_1(mtc0_vpeconf1, void, tl)
101DEF_HELPER_1(mtc0_yqmask, void, tl)
102DEF_HELPER_1(mtc0_vpeopt, void, tl)
103DEF_HELPER_1(mtc0_entrylo0, void, tl)
104DEF_HELPER_1(mtc0_tcstatus, void, tl)
105DEF_HELPER_1(mttc0_tcstatus, void, tl)
106DEF_HELPER_1(mtc0_tcbind, void, tl)
107DEF_HELPER_1(mttc0_tcbind, void, tl)
108DEF_HELPER_1(mtc0_tcrestart, void, tl)
109DEF_HELPER_1(mttc0_tcrestart, void, tl)
110DEF_HELPER_1(mtc0_tchalt, void, tl)
111DEF_HELPER_1(mttc0_tchalt, void, tl)
112DEF_HELPER_1(mtc0_tccontext, void, tl)
113DEF_HELPER_1(mttc0_tccontext, void, tl)
114DEF_HELPER_1(mtc0_tcschedule, void, tl)
115DEF_HELPER_1(mttc0_tcschedule, void, tl)
116DEF_HELPER_1(mtc0_tcschefback, void, tl)
117DEF_HELPER_1(mttc0_tcschefback, void, tl)
118DEF_HELPER_1(mtc0_entrylo1, void, tl)
119DEF_HELPER_1(mtc0_context, void, tl)
120DEF_HELPER_1(mtc0_pagemask, void, tl)
121DEF_HELPER_1(mtc0_pagegrain, void, tl)
122DEF_HELPER_1(mtc0_wired, void, tl)
123DEF_HELPER_1(mtc0_srsconf0, void, tl)
124DEF_HELPER_1(mtc0_srsconf1, void, tl)
125DEF_HELPER_1(mtc0_srsconf2, void, tl)
126DEF_HELPER_1(mtc0_srsconf3, void, tl)
127DEF_HELPER_1(mtc0_srsconf4, void, tl)
128DEF_HELPER_1(mtc0_hwrena, void, tl)
129DEF_HELPER_1(mtc0_count, void, tl)
130DEF_HELPER_1(mtc0_entryhi, void, tl)
131DEF_HELPER_1(mttc0_entryhi, void, tl)
132DEF_HELPER_1(mtc0_compare, void, tl)
133DEF_HELPER_1(mtc0_status, void, tl)
134DEF_HELPER_1(mttc0_status, void, tl)
135DEF_HELPER_1(mtc0_intctl, void, tl)
136DEF_HELPER_1(mtc0_srsctl, void, tl)
137DEF_HELPER_1(mtc0_cause, void, tl)
Edgar E. Iglesias5a25ce92011-08-29 23:07:34 +0200138DEF_HELPER_1(mttc0_cause, void, tl)
pbrooka7812ae2008-11-17 14:43:54 +0000139DEF_HELPER_1(mtc0_ebase, void, tl)
Edgar E. Iglesias5a25ce92011-08-29 23:07:34 +0200140DEF_HELPER_1(mttc0_ebase, void, tl)
pbrooka7812ae2008-11-17 14:43:54 +0000141DEF_HELPER_1(mtc0_config0, void, tl)
142DEF_HELPER_1(mtc0_config2, void, tl)
Aurelien Jarno2a6e32d2009-11-22 13:22:54 +0100143DEF_HELPER_1(mtc0_lladdr, void, tl)
pbrooka7812ae2008-11-17 14:43:54 +0000144DEF_HELPER_2(mtc0_watchlo, void, tl, i32)
145DEF_HELPER_2(mtc0_watchhi, void, tl, i32)
146DEF_HELPER_1(mtc0_xcontext, void, tl)
147DEF_HELPER_1(mtc0_framemask, void, tl)
148DEF_HELPER_1(mtc0_debug, void, tl)
149DEF_HELPER_1(mttc0_debug, void, tl)
150DEF_HELPER_1(mtc0_performance0, void, tl)
151DEF_HELPER_1(mtc0_taglo, void, tl)
152DEF_HELPER_1(mtc0_datalo, void, tl)
153DEF_HELPER_1(mtc0_taghi, void, tl)
154DEF_HELPER_1(mtc0_datahi, void, tl)
thsf1aa6322008-06-09 07:13:38 +0000155
156/* MIPS MT functions */
pbrooka7812ae2008-11-17 14:43:54 +0000157DEF_HELPER_1(mftgpr, tl, i32);
158DEF_HELPER_1(mftlo, tl, i32)
159DEF_HELPER_1(mfthi, tl, i32)
160DEF_HELPER_1(mftacx, tl, i32)
161DEF_HELPER_0(mftdsp, tl)
162DEF_HELPER_2(mttgpr, void, tl, i32)
163DEF_HELPER_2(mttlo, void, tl, i32)
164DEF_HELPER_2(mtthi, void, tl, i32)
165DEF_HELPER_2(mttacx, void, tl, i32)
166DEF_HELPER_1(mttdsp, void, tl)
Nathan Froyd9ed57262010-10-29 07:48:46 -0700167DEF_HELPER_0(dmt, tl)
168DEF_HELPER_0(emt, tl)
169DEF_HELPER_0(dvpe, tl)
170DEF_HELPER_0(evpe, tl)
ths0eaef5a2008-07-23 16:14:22 +0000171#endif /* !CONFIG_USER_ONLY */
Nathan Froyd3c824102010-06-08 13:29:59 -0700172
173/* microMIPS functions */
174DEF_HELPER_3(lwm, void, tl, tl, i32);
175DEF_HELPER_3(swm, void, tl, tl, i32);
176#ifdef TARGET_MIPS64
177DEF_HELPER_3(ldm, void, tl, tl, i32);
178DEF_HELPER_3(sdm, void, tl, tl, i32);
179#endif
180
pbrooka7812ae2008-11-17 14:43:54 +0000181DEF_HELPER_2(fork, void, tl, tl)
182DEF_HELPER_1(yield, tl, tl)
thsf1aa6322008-06-09 07:13:38 +0000183
184/* CP1 functions */
pbrooka7812ae2008-11-17 14:43:54 +0000185DEF_HELPER_1(cfc1, tl, i32)
186DEF_HELPER_2(ctc1, void, tl, i32)
ths5d0fc902008-06-11 15:27:54 +0000187
pbrooka7812ae2008-11-17 14:43:54 +0000188DEF_HELPER_1(float_cvtd_s, i64, i32)
189DEF_HELPER_1(float_cvtd_w, i64, i32)
190DEF_HELPER_1(float_cvtd_l, i64, i64)
191DEF_HELPER_1(float_cvtl_d, i64, i64)
192DEF_HELPER_1(float_cvtl_s, i64, i32)
193DEF_HELPER_1(float_cvtps_pw, i64, i64)
194DEF_HELPER_1(float_cvtpw_ps, i64, i64)
195DEF_HELPER_1(float_cvts_d, i32, i64)
196DEF_HELPER_1(float_cvts_w, i32, i32)
197DEF_HELPER_1(float_cvts_l, i32, i64)
198DEF_HELPER_1(float_cvts_pl, i32, i32)
199DEF_HELPER_1(float_cvts_pu, i32, i32)
200DEF_HELPER_1(float_cvtw_s, i32, i32)
201DEF_HELPER_1(float_cvtw_d, i32, i64)
ths5d0fc902008-06-11 15:27:54 +0000202
pbrooka7812ae2008-11-17 14:43:54 +0000203DEF_HELPER_2(float_addr_ps, i64, i64, i64)
204DEF_HELPER_2(float_mulr_ps, i64, i64, i64)
ths5d0fc902008-06-11 15:27:54 +0000205
pbrooka7812ae2008-11-17 14:43:54 +0000206#define FOP_PROTO(op) \
207DEF_HELPER_1(float_ ## op ## l_s, i64, i32) \
208DEF_HELPER_1(float_ ## op ## l_d, i64, i64) \
209DEF_HELPER_1(float_ ## op ## w_s, i32, i32) \
210DEF_HELPER_1(float_ ## op ## w_d, i32, i64)
thsb6d96be2008-07-09 11:05:10 +0000211FOP_PROTO(round)
212FOP_PROTO(trunc)
213FOP_PROTO(ceil)
214FOP_PROTO(floor)
215#undef FOP_PROTO
216
pbrooka7812ae2008-11-17 14:43:54 +0000217#define FOP_PROTO(op) \
218DEF_HELPER_1(float_ ## op ## _s, i32, i32) \
219DEF_HELPER_1(float_ ## op ## _d, i64, i64)
thsa16336e2008-06-19 18:35:02 +0000220FOP_PROTO(sqrt)
ths5d0fc902008-06-11 15:27:54 +0000221FOP_PROTO(rsqrt)
222FOP_PROTO(recip)
223#undef FOP_PROTO
224
pbrooka7812ae2008-11-17 14:43:54 +0000225#define FOP_PROTO(op) \
226DEF_HELPER_1(float_ ## op ## _s, i32, i32) \
227DEF_HELPER_1(float_ ## op ## _d, i64, i64) \
228DEF_HELPER_1(float_ ## op ## _ps, i64, i64)
thsb6d96be2008-07-09 11:05:10 +0000229FOP_PROTO(abs)
230FOP_PROTO(chs)
231FOP_PROTO(recip1)
232FOP_PROTO(rsqrt1)
233#undef FOP_PROTO
234
pbrooka7812ae2008-11-17 14:43:54 +0000235#define FOP_PROTO(op) \
236DEF_HELPER_2(float_ ## op ## _s, i32, i32, i32) \
237DEF_HELPER_2(float_ ## op ## _d, i64, i64, i64) \
238DEF_HELPER_2(float_ ## op ## _ps, i64, i64, i64)
ths5d0fc902008-06-11 15:27:54 +0000239FOP_PROTO(add)
240FOP_PROTO(sub)
241FOP_PROTO(mul)
242FOP_PROTO(div)
thsb6d96be2008-07-09 11:05:10 +0000243FOP_PROTO(recip2)
244FOP_PROTO(rsqrt2)
245#undef FOP_PROTO
246
pbrooka7812ae2008-11-17 14:43:54 +0000247#define FOP_PROTO(op) \
248DEF_HELPER_3(float_ ## op ## _s, i32, i32, i32, i32) \
249DEF_HELPER_3(float_ ## op ## _d, i64, i64, i64, i64) \
250DEF_HELPER_3(float_ ## op ## _ps, i64, i64, i64, i64)
thsa16336e2008-06-19 18:35:02 +0000251FOP_PROTO(muladd)
252FOP_PROTO(mulsub)
253FOP_PROTO(nmuladd)
254FOP_PROTO(nmulsub)
ths5d0fc902008-06-11 15:27:54 +0000255#undef FOP_PROTO
256
pbrooka7812ae2008-11-17 14:43:54 +0000257#define FOP_PROTO(op) \
258DEF_HELPER_3(cmp_d_ ## op, void, i64, i64, int) \
259DEF_HELPER_3(cmpabs_d_ ## op, void, i64, i64, int) \
260DEF_HELPER_3(cmp_s_ ## op, void, i32, i32, int) \
261DEF_HELPER_3(cmpabs_s_ ## op, void, i32, i32, int) \
262DEF_HELPER_3(cmp_ps_ ## op, void, i64, i64, int) \
263DEF_HELPER_3(cmpabs_ps_ ## op, void, i64, i64, int)
ths5d0fc902008-06-11 15:27:54 +0000264FOP_PROTO(f)
265FOP_PROTO(un)
266FOP_PROTO(eq)
267FOP_PROTO(ueq)
268FOP_PROTO(olt)
269FOP_PROTO(ult)
270FOP_PROTO(ole)
271FOP_PROTO(ule)
272FOP_PROTO(sf)
273FOP_PROTO(ngle)
274FOP_PROTO(seq)
275FOP_PROTO(ngl)
276FOP_PROTO(lt)
277FOP_PROTO(nge)
278FOP_PROTO(le)
279FOP_PROTO(ngt)
280#undef FOP_PROTO
ths08ba7962008-06-12 03:15:13 +0000281
282/* Special functions */
ths0eaef5a2008-07-23 16:14:22 +0000283#ifndef CONFIG_USER_ONLY
pbrooka7812ae2008-11-17 14:43:54 +0000284DEF_HELPER_0(tlbwi, void)
285DEF_HELPER_0(tlbwr, void)
286DEF_HELPER_0(tlbp, void)
287DEF_HELPER_0(tlbr, void)
288DEF_HELPER_0(di, tl)
289DEF_HELPER_0(ei, tl)
290DEF_HELPER_0(eret, void)
291DEF_HELPER_0(deret, void)
ths0eaef5a2008-07-23 16:14:22 +0000292#endif /* !CONFIG_USER_ONLY */
pbrooka7812ae2008-11-17 14:43:54 +0000293DEF_HELPER_0(rdhwr_cpunum, tl)
294DEF_HELPER_0(rdhwr_synci_step, tl)
295DEF_HELPER_0(rdhwr_cc, tl)
296DEF_HELPER_0(rdhwr_ccres, tl)
297DEF_HELPER_1(pmon, void, int)
298DEF_HELPER_0(wait, void)
299
300#include "def-helper.h"