xref: /openbmc/qemu/target/mips/helper.h (revision b14df228)
1 DEF_HELPER_3(raise_exception_err, noreturn, env, i32, int)
2 DEF_HELPER_2(raise_exception, noreturn, env, i32)
3 DEF_HELPER_1(raise_exception_debug, noreturn, env)
4 
5 #ifdef TARGET_MIPS64
6 DEF_HELPER_4(sdl, void, env, tl, tl, int)
7 DEF_HELPER_4(sdr, void, env, tl, tl, int)
8 #endif
9 DEF_HELPER_4(swl, void, env, tl, tl, int)
10 DEF_HELPER_4(swr, void, env, tl, tl, int)
11 
12 #ifndef CONFIG_USER_ONLY
13 DEF_HELPER_3(ll, tl, env, tl, int)
14 #ifdef TARGET_MIPS64
15 DEF_HELPER_3(lld, tl, env, tl, int)
16 #endif
17 #endif
18 
19 DEF_HELPER_FLAGS_1(bitswap, TCG_CALL_NO_RWG_SE, tl, tl)
20 #ifdef TARGET_MIPS64
21 DEF_HELPER_FLAGS_1(dbitswap, TCG_CALL_NO_RWG_SE, tl, tl)
22 #endif
23 
24 DEF_HELPER_FLAGS_4(rotx, TCG_CALL_NO_RWG_SE, tl, tl, i32, i32, i32)
25 
26 /* microMIPS functions */
27 DEF_HELPER_4(lwm, void, env, tl, tl, i32)
28 DEF_HELPER_4(swm, void, env, tl, tl, i32)
29 #ifdef TARGET_MIPS64
30 DEF_HELPER_4(ldm, void, env, tl, tl, i32)
31 DEF_HELPER_4(sdm, void, env, tl, tl, i32)
32 #endif
33 
34 DEF_HELPER_2(fork, void, tl, tl)
35 DEF_HELPER_2(yield, tl, env, tl)
36 
37 /* CP1 functions */
38 DEF_HELPER_2(cfc1, tl, env, i32)
39 DEF_HELPER_4(ctc1, void, env, tl, i32, i32)
40 
41 DEF_HELPER_2(float_cvtd_s, i64, env, i32)
42 DEF_HELPER_2(float_cvtd_w, i64, env, i32)
43 DEF_HELPER_2(float_cvtd_l, i64, env, i64)
44 DEF_HELPER_2(float_cvtps_pw, i64, env, i64)
45 DEF_HELPER_2(float_cvtpw_ps, i64, env, i64)
46 DEF_HELPER_2(float_cvts_d, i32, env, i64)
47 DEF_HELPER_2(float_cvts_w, i32, env, i32)
48 DEF_HELPER_2(float_cvts_l, i32, env, i64)
49 DEF_HELPER_2(float_cvts_pl, i32, env, i32)
50 DEF_HELPER_2(float_cvts_pu, i32, env, i32)
51 
52 DEF_HELPER_3(float_addr_ps, i64, env, i64, i64)
53 DEF_HELPER_3(float_mulr_ps, i64, env, i64, i64)
54 
55 DEF_HELPER_FLAGS_2(float_class_s, TCG_CALL_NO_RWG_SE, i32, env, i32)
56 DEF_HELPER_FLAGS_2(float_class_d, TCG_CALL_NO_RWG_SE, i64, env, i64)
57 
58 #define FOP_PROTO(op)                                     \
59 DEF_HELPER_4(float_ ## op ## _s, i32, env, i32, i32, i32) \
60 DEF_HELPER_4(float_ ## op ## _d, i64, env, i64, i64, i64)
61 FOP_PROTO(maddf)
62 FOP_PROTO(msubf)
63 #undef FOP_PROTO
64 
65 #define FOP_PROTO(op)                                \
66 DEF_HELPER_3(float_ ## op ## _s, i32, env, i32, i32) \
67 DEF_HELPER_3(float_ ## op ## _d, i64, env, i64, i64)
68 FOP_PROTO(max)
69 FOP_PROTO(maxa)
70 FOP_PROTO(min)
71 FOP_PROTO(mina)
72 #undef FOP_PROTO
73 
74 #define FOP_PROTO(op)                            \
75 DEF_HELPER_2(float_ ## op ## _l_s, i64, env, i32) \
76 DEF_HELPER_2(float_ ## op ## _l_d, i64, env, i64) \
77 DEF_HELPER_2(float_ ## op ## _w_s, i32, env, i32) \
78 DEF_HELPER_2(float_ ## op ## _w_d, i32, env, i64)
79 FOP_PROTO(cvt)
80 FOP_PROTO(round)
81 FOP_PROTO(trunc)
82 FOP_PROTO(ceil)
83 FOP_PROTO(floor)
84 FOP_PROTO(cvt_2008)
85 FOP_PROTO(round_2008)
86 FOP_PROTO(trunc_2008)
87 FOP_PROTO(ceil_2008)
88 FOP_PROTO(floor_2008)
89 #undef FOP_PROTO
90 
91 #define FOP_PROTO(op)                            \
92 DEF_HELPER_2(float_ ## op ## _s, i32, env, i32)  \
93 DEF_HELPER_2(float_ ## op ## _d, i64, env, i64)
94 FOP_PROTO(sqrt)
95 FOP_PROTO(rsqrt)
96 FOP_PROTO(recip)
97 FOP_PROTO(rint)
98 #undef FOP_PROTO
99 
100 #define FOP_PROTO(op)                       \
101 DEF_HELPER_1(float_ ## op ## _s, i32, i32)  \
102 DEF_HELPER_1(float_ ## op ## _d, i64, i64)  \
103 DEF_HELPER_1(float_ ## op ## _ps, i64, i64)
104 FOP_PROTO(abs)
105 FOP_PROTO(chs)
106 #undef FOP_PROTO
107 
108 #define FOP_PROTO(op)                            \
109 DEF_HELPER_2(float_ ## op ## _s, i32, env, i32)  \
110 DEF_HELPER_2(float_ ## op ## _d, i64, env, i64)  \
111 DEF_HELPER_2(float_ ## op ## _ps, i64, env, i64)
112 FOP_PROTO(recip1)
113 FOP_PROTO(rsqrt1)
114 #undef FOP_PROTO
115 
116 #define FOP_PROTO(op)                                  \
117 DEF_HELPER_3(float_ ## op ## _s, i32, env, i32, i32)   \
118 DEF_HELPER_3(float_ ## op ## _d, i64, env, i64, i64)   \
119 DEF_HELPER_3(float_ ## op ## _ps, i64, env, i64, i64)
120 FOP_PROTO(add)
121 FOP_PROTO(sub)
122 FOP_PROTO(mul)
123 FOP_PROTO(div)
124 FOP_PROTO(recip2)
125 FOP_PROTO(rsqrt2)
126 #undef FOP_PROTO
127 
128 #define FOP_PROTO(op)                                      \
129 DEF_HELPER_4(float_ ## op ## _s, i32, env, i32, i32, i32)  \
130 DEF_HELPER_4(float_ ## op ## _d, i64, env, i64, i64, i64)  \
131 DEF_HELPER_4(float_ ## op ## _ps, i64, env, i64, i64, i64)
132 FOP_PROTO(madd)
133 FOP_PROTO(msub)
134 FOP_PROTO(nmadd)
135 FOP_PROTO(nmsub)
136 #undef FOP_PROTO
137 
138 #define FOP_PROTO(op)                                    \
139 DEF_HELPER_4(cmp_d_ ## op, void, env, i64, i64, int)     \
140 DEF_HELPER_4(cmpabs_d_ ## op, void, env, i64, i64, int)  \
141 DEF_HELPER_4(cmp_s_ ## op, void, env, i32, i32, int)     \
142 DEF_HELPER_4(cmpabs_s_ ## op, void, env, i32, i32, int)  \
143 DEF_HELPER_4(cmp_ps_ ## op, void, env, i64, i64, int)    \
144 DEF_HELPER_4(cmpabs_ps_ ## op, void, env, i64, i64, int)
145 FOP_PROTO(f)
146 FOP_PROTO(un)
147 FOP_PROTO(eq)
148 FOP_PROTO(ueq)
149 FOP_PROTO(olt)
150 FOP_PROTO(ult)
151 FOP_PROTO(ole)
152 FOP_PROTO(ule)
153 FOP_PROTO(sf)
154 FOP_PROTO(ngle)
155 FOP_PROTO(seq)
156 FOP_PROTO(ngl)
157 FOP_PROTO(lt)
158 FOP_PROTO(nge)
159 FOP_PROTO(le)
160 FOP_PROTO(ngt)
161 #undef FOP_PROTO
162 
163 #define FOP_PROTO(op) \
164 DEF_HELPER_3(r6_cmp_d_ ## op, i64, env, i64, i64) \
165 DEF_HELPER_3(r6_cmp_s_ ## op, i32, env, i32, i32)
166 FOP_PROTO(af)
167 FOP_PROTO(un)
168 FOP_PROTO(eq)
169 FOP_PROTO(ueq)
170 FOP_PROTO(lt)
171 FOP_PROTO(ult)
172 FOP_PROTO(le)
173 FOP_PROTO(ule)
174 FOP_PROTO(saf)
175 FOP_PROTO(sun)
176 FOP_PROTO(seq)
177 FOP_PROTO(sueq)
178 FOP_PROTO(slt)
179 FOP_PROTO(sult)
180 FOP_PROTO(sle)
181 FOP_PROTO(sule)
182 FOP_PROTO(or)
183 FOP_PROTO(une)
184 FOP_PROTO(ne)
185 FOP_PROTO(sor)
186 FOP_PROTO(sune)
187 FOP_PROTO(sne)
188 #undef FOP_PROTO
189 
190 DEF_HELPER_1(rdhwr_cpunum, tl, env)
191 DEF_HELPER_1(rdhwr_synci_step, tl, env)
192 DEF_HELPER_1(rdhwr_cc, tl, env)
193 DEF_HELPER_1(rdhwr_ccres, tl, env)
194 DEF_HELPER_1(rdhwr_performance, tl, env)
195 DEF_HELPER_1(rdhwr_xnp, tl, env)
196 DEF_HELPER_2(pmon, void, env, int)
197 DEF_HELPER_1(wait, void, env)
198 
199 /* Loongson multimedia functions.  */
200 DEF_HELPER_FLAGS_2(paddsh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
201 DEF_HELPER_FLAGS_2(paddush, TCG_CALL_NO_RWG_SE, i64, i64, i64)
202 DEF_HELPER_FLAGS_2(paddh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
203 DEF_HELPER_FLAGS_2(paddw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
204 DEF_HELPER_FLAGS_2(paddsb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
205 DEF_HELPER_FLAGS_2(paddusb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
206 DEF_HELPER_FLAGS_2(paddb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
207 
208 DEF_HELPER_FLAGS_2(psubsh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
209 DEF_HELPER_FLAGS_2(psubush, TCG_CALL_NO_RWG_SE, i64, i64, i64)
210 DEF_HELPER_FLAGS_2(psubh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
211 DEF_HELPER_FLAGS_2(psubw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
212 DEF_HELPER_FLAGS_2(psubsb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
213 DEF_HELPER_FLAGS_2(psubusb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
214 DEF_HELPER_FLAGS_2(psubb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
215 
216 DEF_HELPER_FLAGS_2(pshufh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
217 DEF_HELPER_FLAGS_2(packsswh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
218 DEF_HELPER_FLAGS_2(packsshb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
219 DEF_HELPER_FLAGS_2(packushb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
220 
221 DEF_HELPER_FLAGS_2(punpcklhw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
222 DEF_HELPER_FLAGS_2(punpckhhw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
223 DEF_HELPER_FLAGS_2(punpcklbh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
224 DEF_HELPER_FLAGS_2(punpckhbh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
225 DEF_HELPER_FLAGS_2(punpcklwd, TCG_CALL_NO_RWG_SE, i64, i64, i64)
226 DEF_HELPER_FLAGS_2(punpckhwd, TCG_CALL_NO_RWG_SE, i64, i64, i64)
227 
228 DEF_HELPER_FLAGS_2(pavgh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
229 DEF_HELPER_FLAGS_2(pavgb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
230 DEF_HELPER_FLAGS_2(pmaxsh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
231 DEF_HELPER_FLAGS_2(pminsh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
232 DEF_HELPER_FLAGS_2(pmaxub, TCG_CALL_NO_RWG_SE, i64, i64, i64)
233 DEF_HELPER_FLAGS_2(pminub, TCG_CALL_NO_RWG_SE, i64, i64, i64)
234 
235 DEF_HELPER_FLAGS_2(pcmpeqw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
236 DEF_HELPER_FLAGS_2(pcmpgtw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
237 DEF_HELPER_FLAGS_2(pcmpeqh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
238 DEF_HELPER_FLAGS_2(pcmpgth, TCG_CALL_NO_RWG_SE, i64, i64, i64)
239 DEF_HELPER_FLAGS_2(pcmpeqb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
240 DEF_HELPER_FLAGS_2(pcmpgtb, TCG_CALL_NO_RWG_SE, i64, i64, i64)
241 
242 DEF_HELPER_FLAGS_2(psllw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
243 DEF_HELPER_FLAGS_2(psllh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
244 DEF_HELPER_FLAGS_2(psrlw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
245 DEF_HELPER_FLAGS_2(psrlh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
246 DEF_HELPER_FLAGS_2(psraw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
247 DEF_HELPER_FLAGS_2(psrah, TCG_CALL_NO_RWG_SE, i64, i64, i64)
248 
249 DEF_HELPER_FLAGS_2(pmullh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
250 DEF_HELPER_FLAGS_2(pmulhh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
251 DEF_HELPER_FLAGS_2(pmulhuh, TCG_CALL_NO_RWG_SE, i64, i64, i64)
252 DEF_HELPER_FLAGS_2(pmaddhw, TCG_CALL_NO_RWG_SE, i64, i64, i64)
253 
254 DEF_HELPER_FLAGS_2(pasubub, TCG_CALL_NO_RWG_SE, i64, i64, i64)
255 DEF_HELPER_FLAGS_1(biadd, TCG_CALL_NO_RWG_SE, i64, i64)
256 DEF_HELPER_FLAGS_1(pmovmskb, TCG_CALL_NO_RWG_SE, i64, i64)
257 
258 /*** MIPS DSP ***/
259 /* DSP Arithmetic Sub-class insns */
260 DEF_HELPER_FLAGS_3(addq_ph, 0, tl, tl, tl, env)
261 DEF_HELPER_FLAGS_3(addq_s_ph, 0, tl, tl, tl, env)
262 #if defined(TARGET_MIPS64)
263 DEF_HELPER_FLAGS_3(addq_qh, 0, tl, tl, tl, env)
264 DEF_HELPER_FLAGS_3(addq_s_qh, 0, tl, tl, tl, env)
265 #endif
266 DEF_HELPER_FLAGS_3(addq_s_w, 0, tl, tl, tl, env)
267 #if defined(TARGET_MIPS64)
268 DEF_HELPER_FLAGS_3(addq_pw, 0, tl, tl, tl, env)
269 DEF_HELPER_FLAGS_3(addq_s_pw, 0, tl, tl, tl, env)
270 #endif
271 DEF_HELPER_FLAGS_3(addu_qb, 0, tl, tl, tl, env)
272 DEF_HELPER_FLAGS_3(addu_s_qb, 0, tl, tl, tl, env)
273 DEF_HELPER_FLAGS_2(adduh_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
274 DEF_HELPER_FLAGS_2(adduh_r_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
275 DEF_HELPER_FLAGS_3(addu_ph, 0, tl, tl, tl, env)
276 DEF_HELPER_FLAGS_3(addu_s_ph, 0, tl, tl, tl, env)
277 DEF_HELPER_FLAGS_2(addqh_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
278 DEF_HELPER_FLAGS_2(addqh_r_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
279 DEF_HELPER_FLAGS_2(addqh_w, TCG_CALL_NO_RWG_SE, tl, tl, tl)
280 DEF_HELPER_FLAGS_2(addqh_r_w, TCG_CALL_NO_RWG_SE, tl, tl, tl)
281 #if defined(TARGET_MIPS64)
282 DEF_HELPER_FLAGS_3(addu_ob, 0, tl, tl, tl, env)
283 DEF_HELPER_FLAGS_3(addu_s_ob, 0, tl, tl, tl, env)
284 DEF_HELPER_FLAGS_2(adduh_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
285 DEF_HELPER_FLAGS_2(adduh_r_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
286 DEF_HELPER_FLAGS_3(addu_qh, 0, tl, tl, tl, env)
287 DEF_HELPER_FLAGS_3(addu_s_qh, 0, tl, tl, tl, env)
288 #endif
289 DEF_HELPER_FLAGS_3(subq_ph, 0, tl, tl, tl, env)
290 DEF_HELPER_FLAGS_3(subq_s_ph, 0, tl, tl, tl, env)
291 #if defined(TARGET_MIPS64)
292 DEF_HELPER_FLAGS_3(subq_qh, 0, tl, tl, tl, env)
293 DEF_HELPER_FLAGS_3(subq_s_qh, 0, tl, tl, tl, env)
294 #endif
295 DEF_HELPER_FLAGS_3(subq_s_w, 0, tl, tl, tl, env)
296 #if defined(TARGET_MIPS64)
297 DEF_HELPER_FLAGS_3(subq_pw, 0, tl, tl, tl, env)
298 DEF_HELPER_FLAGS_3(subq_s_pw, 0, tl, tl, tl, env)
299 #endif
300 DEF_HELPER_FLAGS_3(subu_qb, 0, tl, tl, tl, env)
301 DEF_HELPER_FLAGS_3(subu_s_qb, 0, tl, tl, tl, env)
302 DEF_HELPER_FLAGS_2(subuh_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
303 DEF_HELPER_FLAGS_2(subuh_r_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
304 DEF_HELPER_FLAGS_3(subu_ph, 0, tl, tl, tl, env)
305 DEF_HELPER_FLAGS_3(subu_s_ph, 0, tl, tl, tl, env)
306 DEF_HELPER_FLAGS_2(subqh_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
307 DEF_HELPER_FLAGS_2(subqh_r_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
308 DEF_HELPER_FLAGS_2(subqh_w, TCG_CALL_NO_RWG_SE, tl, tl, tl)
309 DEF_HELPER_FLAGS_2(subqh_r_w, TCG_CALL_NO_RWG_SE, tl, tl, tl)
310 #if defined(TARGET_MIPS64)
311 DEF_HELPER_FLAGS_3(subu_ob, 0, tl, tl, tl, env)
312 DEF_HELPER_FLAGS_3(subu_s_ob, 0, tl, tl, tl, env)
313 DEF_HELPER_FLAGS_2(subuh_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
314 DEF_HELPER_FLAGS_2(subuh_r_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
315 DEF_HELPER_FLAGS_3(subu_qh, 0, tl, tl, tl, env)
316 DEF_HELPER_FLAGS_3(subu_s_qh, 0, tl, tl, tl, env)
317 #endif
318 DEF_HELPER_FLAGS_3(addsc, 0, tl, tl, tl, env)
319 DEF_HELPER_FLAGS_3(addwc, 0, tl, tl, tl, env)
320 DEF_HELPER_FLAGS_2(modsub, TCG_CALL_NO_RWG_SE, tl, tl, tl)
321 DEF_HELPER_FLAGS_1(raddu_w_qb, TCG_CALL_NO_RWG_SE, tl, tl)
322 #if defined(TARGET_MIPS64)
323 DEF_HELPER_FLAGS_1(raddu_l_ob, TCG_CALL_NO_RWG_SE, tl, tl)
324 #endif
325 DEF_HELPER_FLAGS_2(absq_s_qb, 0, tl, tl, env)
326 DEF_HELPER_FLAGS_2(absq_s_ph, 0, tl, tl, env)
327 DEF_HELPER_FLAGS_2(absq_s_w, 0, tl, tl, env)
328 #if defined(TARGET_MIPS64)
329 DEF_HELPER_FLAGS_2(absq_s_ob, 0, tl, tl, env)
330 DEF_HELPER_FLAGS_2(absq_s_qh, 0, tl, tl, env)
331 DEF_HELPER_FLAGS_2(absq_s_pw, 0, tl, tl, env)
332 #endif
333 DEF_HELPER_FLAGS_2(precr_qb_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
334 DEF_HELPER_FLAGS_2(precrq_qb_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
335 DEF_HELPER_FLAGS_3(precr_sra_ph_w, TCG_CALL_NO_RWG_SE,
336                    tl, i32, tl, tl)
337 DEF_HELPER_FLAGS_3(precr_sra_r_ph_w, TCG_CALL_NO_RWG_SE,
338                    tl, i32, tl, tl)
339 DEF_HELPER_FLAGS_2(precrq_ph_w, TCG_CALL_NO_RWG_SE, tl, tl, tl)
340 DEF_HELPER_FLAGS_3(precrq_rs_ph_w, 0, tl, tl, tl, env)
341 #if defined(TARGET_MIPS64)
342 DEF_HELPER_FLAGS_2(precr_ob_qh, TCG_CALL_NO_RWG_SE, tl, tl, tl)
343 DEF_HELPER_FLAGS_3(precr_sra_qh_pw,
344                    TCG_CALL_NO_RWG_SE, tl, tl, tl, i32)
345 DEF_HELPER_FLAGS_3(precr_sra_r_qh_pw,
346                    TCG_CALL_NO_RWG_SE, tl, tl, tl, i32)
347 DEF_HELPER_FLAGS_2(precrq_ob_qh, TCG_CALL_NO_RWG_SE, tl, tl, tl)
348 DEF_HELPER_FLAGS_2(precrq_qh_pw, TCG_CALL_NO_RWG_SE, tl, tl, tl)
349 DEF_HELPER_FLAGS_3(precrq_rs_qh_pw,
350                    TCG_CALL_NO_RWG_SE, tl, tl, tl, env)
351 DEF_HELPER_FLAGS_2(precrq_pw_l, TCG_CALL_NO_RWG_SE, tl, tl, tl)
352 #endif
353 DEF_HELPER_FLAGS_3(precrqu_s_qb_ph, 0, tl, tl, tl, env)
354 #if defined(TARGET_MIPS64)
355 DEF_HELPER_FLAGS_3(precrqu_s_ob_qh,
356                    TCG_CALL_NO_RWG_SE, tl, tl, tl, env)
357 
358 DEF_HELPER_FLAGS_1(preceq_pw_qhl, TCG_CALL_NO_RWG_SE, tl, tl)
359 DEF_HELPER_FLAGS_1(preceq_pw_qhr, TCG_CALL_NO_RWG_SE, tl, tl)
360 DEF_HELPER_FLAGS_1(preceq_pw_qhla, TCG_CALL_NO_RWG_SE, tl, tl)
361 DEF_HELPER_FLAGS_1(preceq_pw_qhra, TCG_CALL_NO_RWG_SE, tl, tl)
362 #endif
363 DEF_HELPER_FLAGS_1(precequ_ph_qbl, TCG_CALL_NO_RWG_SE, tl, tl)
364 DEF_HELPER_FLAGS_1(precequ_ph_qbr, TCG_CALL_NO_RWG_SE, tl, tl)
365 DEF_HELPER_FLAGS_1(precequ_ph_qbla, TCG_CALL_NO_RWG_SE, tl, tl)
366 DEF_HELPER_FLAGS_1(precequ_ph_qbra, TCG_CALL_NO_RWG_SE, tl, tl)
367 #if defined(TARGET_MIPS64)
368 DEF_HELPER_FLAGS_1(precequ_qh_obl, TCG_CALL_NO_RWG_SE, tl, tl)
369 DEF_HELPER_FLAGS_1(precequ_qh_obr, TCG_CALL_NO_RWG_SE, tl, tl)
370 DEF_HELPER_FLAGS_1(precequ_qh_obla, TCG_CALL_NO_RWG_SE, tl, tl)
371 DEF_HELPER_FLAGS_1(precequ_qh_obra, TCG_CALL_NO_RWG_SE, tl, tl)
372 #endif
373 DEF_HELPER_FLAGS_1(preceu_ph_qbl, TCG_CALL_NO_RWG_SE, tl, tl)
374 DEF_HELPER_FLAGS_1(preceu_ph_qbr, TCG_CALL_NO_RWG_SE, tl, tl)
375 DEF_HELPER_FLAGS_1(preceu_ph_qbla, TCG_CALL_NO_RWG_SE, tl, tl)
376 DEF_HELPER_FLAGS_1(preceu_ph_qbra, TCG_CALL_NO_RWG_SE, tl, tl)
377 #if defined(TARGET_MIPS64)
378 DEF_HELPER_FLAGS_1(preceu_qh_obl, TCG_CALL_NO_RWG_SE, tl, tl)
379 DEF_HELPER_FLAGS_1(preceu_qh_obr, TCG_CALL_NO_RWG_SE, tl, tl)
380 DEF_HELPER_FLAGS_1(preceu_qh_obla, TCG_CALL_NO_RWG_SE, tl, tl)
381 DEF_HELPER_FLAGS_1(preceu_qh_obra, TCG_CALL_NO_RWG_SE, tl, tl)
382 #endif
383 
384 /* DSP GPR-Based Shift Sub-class insns */
385 DEF_HELPER_FLAGS_3(shll_qb, 0, tl, tl, tl, env)
386 #if defined(TARGET_MIPS64)
387 DEF_HELPER_FLAGS_3(shll_ob, 0, tl, tl, tl, env)
388 #endif
389 DEF_HELPER_FLAGS_3(shll_ph, 0, tl, tl, tl, env)
390 DEF_HELPER_FLAGS_3(shll_s_ph, 0, tl, tl, tl, env)
391 #if defined(TARGET_MIPS64)
392 DEF_HELPER_FLAGS_3(shll_qh, 0, tl, tl, tl, env)
393 DEF_HELPER_FLAGS_3(shll_s_qh, 0, tl, tl, tl, env)
394 #endif
395 DEF_HELPER_FLAGS_3(shll_s_w, 0, tl, tl, tl, env)
396 #if defined(TARGET_MIPS64)
397 DEF_HELPER_FLAGS_3(shll_pw, 0, tl, tl, tl, env)
398 DEF_HELPER_FLAGS_3(shll_s_pw, 0, tl, tl, tl, env)
399 #endif
400 DEF_HELPER_FLAGS_2(shrl_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
401 DEF_HELPER_FLAGS_2(shrl_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
402 #if defined(TARGET_MIPS64)
403 DEF_HELPER_FLAGS_2(shrl_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
404 DEF_HELPER_FLAGS_2(shrl_qh, TCG_CALL_NO_RWG_SE, tl, tl, tl)
405 #endif
406 DEF_HELPER_FLAGS_2(shra_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
407 DEF_HELPER_FLAGS_2(shra_r_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
408 #if defined(TARGET_MIPS64)
409 DEF_HELPER_FLAGS_2(shra_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
410 DEF_HELPER_FLAGS_2(shra_r_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
411 #endif
412 DEF_HELPER_FLAGS_2(shra_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
413 DEF_HELPER_FLAGS_2(shra_r_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
414 DEF_HELPER_FLAGS_2(shra_r_w, TCG_CALL_NO_RWG_SE, tl, tl, tl)
415 #if defined(TARGET_MIPS64)
416 DEF_HELPER_FLAGS_2(shra_qh, TCG_CALL_NO_RWG_SE, tl, tl, tl)
417 DEF_HELPER_FLAGS_2(shra_r_qh, TCG_CALL_NO_RWG_SE, tl, tl, tl)
418 DEF_HELPER_FLAGS_2(shra_pw, TCG_CALL_NO_RWG_SE, tl, tl, tl)
419 DEF_HELPER_FLAGS_2(shra_r_pw, TCG_CALL_NO_RWG_SE, tl, tl, tl)
420 #endif
421 
422 /* DSP Multiply Sub-class insns */
423 DEF_HELPER_FLAGS_3(muleu_s_ph_qbl, 0, tl, tl, tl, env)
424 DEF_HELPER_FLAGS_3(muleu_s_ph_qbr, 0, tl, tl, tl, env)
425 #if defined(TARGET_MIPS64)
426 DEF_HELPER_FLAGS_3(muleu_s_qh_obl, 0, tl, tl, tl, env)
427 DEF_HELPER_FLAGS_3(muleu_s_qh_obr, 0, tl, tl, tl, env)
428 #endif
429 DEF_HELPER_FLAGS_3(mulq_rs_ph, 0, tl, tl, tl, env)
430 #if defined(TARGET_MIPS64)
431 DEF_HELPER_FLAGS_3(mulq_rs_qh, 0, tl, tl, tl, env)
432 #endif
433 DEF_HELPER_FLAGS_3(muleq_s_w_phl, 0, tl, tl, tl, env)
434 DEF_HELPER_FLAGS_3(muleq_s_w_phr, 0, tl, tl, tl, env)
435 #if defined(TARGET_MIPS64)
436 DEF_HELPER_FLAGS_3(muleq_s_pw_qhl, 0, tl, tl, tl, env)
437 DEF_HELPER_FLAGS_3(muleq_s_pw_qhr, 0, tl, tl, tl, env)
438 #endif
439 DEF_HELPER_FLAGS_4(dpau_h_qbl, 0, void, i32, tl, tl, env)
440 DEF_HELPER_FLAGS_4(dpau_h_qbr, 0, void, i32, tl, tl, env)
441 #if defined(TARGET_MIPS64)
442 DEF_HELPER_FLAGS_4(dpau_h_obl, 0, void, tl, tl, i32, env)
443 DEF_HELPER_FLAGS_4(dpau_h_obr, 0, void, tl, tl, i32, env)
444 #endif
445 DEF_HELPER_FLAGS_4(dpsu_h_qbl, 0, void, i32, tl, tl, env)
446 DEF_HELPER_FLAGS_4(dpsu_h_qbr, 0, void, i32, tl, tl, env)
447 #if defined(TARGET_MIPS64)
448 DEF_HELPER_FLAGS_4(dpsu_h_obl, 0, void, tl, tl, i32, env)
449 DEF_HELPER_FLAGS_4(dpsu_h_obr, 0, void, tl, tl, i32, env)
450 #endif
451 DEF_HELPER_FLAGS_4(dpa_w_ph, 0, void, i32, tl, tl, env)
452 #if defined(TARGET_MIPS64)
453 DEF_HELPER_FLAGS_4(dpa_w_qh, 0, void, tl, tl, i32, env)
454 #endif
455 DEF_HELPER_FLAGS_4(dpax_w_ph, 0, void, i32, tl, tl, env)
456 DEF_HELPER_FLAGS_4(dpaq_s_w_ph, 0, void, i32, tl, tl, env)
457 #if defined(TARGET_MIPS64)
458 DEF_HELPER_FLAGS_4(dpaq_s_w_qh, 0, void, tl, tl, i32, env)
459 #endif
460 DEF_HELPER_FLAGS_4(dpaqx_s_w_ph, 0, void, i32, tl, tl, env)
461 DEF_HELPER_FLAGS_4(dpaqx_sa_w_ph, 0, void, i32, tl, tl, env)
462 DEF_HELPER_FLAGS_4(dps_w_ph, 0, void, i32, tl, tl, env)
463 #if defined(TARGET_MIPS64)
464 DEF_HELPER_FLAGS_4(dps_w_qh, 0, void, tl, tl, i32, env)
465 #endif
466 DEF_HELPER_FLAGS_4(dpsx_w_ph, 0, void, i32, tl, tl, env)
467 DEF_HELPER_FLAGS_4(dpsq_s_w_ph, 0, void, i32, tl, tl, env)
468 #if defined(TARGET_MIPS64)
469 DEF_HELPER_FLAGS_4(dpsq_s_w_qh, 0, void, tl, tl, i32, env)
470 #endif
471 DEF_HELPER_FLAGS_4(dpsqx_s_w_ph, 0, void, i32, tl, tl, env)
472 DEF_HELPER_FLAGS_4(dpsqx_sa_w_ph, 0, void, i32, tl, tl, env)
473 DEF_HELPER_FLAGS_4(mulsaq_s_w_ph, 0, void, i32, tl, tl, env)
474 #if defined(TARGET_MIPS64)
475 DEF_HELPER_FLAGS_4(mulsaq_s_w_qh, 0, void, tl, tl, i32, env)
476 #endif
477 DEF_HELPER_FLAGS_4(dpaq_sa_l_w, 0, void, i32, tl, tl, env)
478 #if defined(TARGET_MIPS64)
479 DEF_HELPER_FLAGS_4(dpaq_sa_l_pw, 0, void, tl, tl, i32, env)
480 #endif
481 DEF_HELPER_FLAGS_4(dpsq_sa_l_w, 0, void, i32, tl, tl, env)
482 #if defined(TARGET_MIPS64)
483 DEF_HELPER_FLAGS_4(dpsq_sa_l_pw, 0, void, tl, tl, i32, env)
484 DEF_HELPER_FLAGS_4(mulsaq_s_l_pw, 0, void, tl, tl, i32, env)
485 #endif
486 DEF_HELPER_FLAGS_4(maq_s_w_phl, 0, void, i32, tl, tl, env)
487 DEF_HELPER_FLAGS_4(maq_s_w_phr, 0, void, i32, tl, tl, env)
488 DEF_HELPER_FLAGS_4(maq_sa_w_phl, 0, void, i32, tl, tl, env)
489 DEF_HELPER_FLAGS_4(maq_sa_w_phr, 0, void, i32, tl, tl, env)
490 DEF_HELPER_FLAGS_3(mul_ph, 0, tl, tl, tl, env)
491 DEF_HELPER_FLAGS_3(mul_s_ph, 0, tl, tl, tl, env)
492 DEF_HELPER_FLAGS_3(mulq_s_ph, 0, tl, tl, tl, env)
493 DEF_HELPER_FLAGS_3(mulq_s_w, 0, tl, tl, tl, env)
494 DEF_HELPER_FLAGS_3(mulq_rs_w, 0, tl, tl, tl, env)
495 DEF_HELPER_FLAGS_4(mulsa_w_ph, 0, void, i32, tl, tl, env)
496 #if defined(TARGET_MIPS64)
497 DEF_HELPER_FLAGS_4(maq_s_w_qhll, 0, void, tl, tl, i32, env)
498 DEF_HELPER_FLAGS_4(maq_s_w_qhlr, 0, void, tl, tl, i32, env)
499 DEF_HELPER_FLAGS_4(maq_s_w_qhrl, 0, void, tl, tl, i32, env)
500 DEF_HELPER_FLAGS_4(maq_s_w_qhrr, 0, void, tl, tl, i32, env)
501 DEF_HELPER_FLAGS_4(maq_sa_w_qhll, 0, void, tl, tl, i32, env)
502 DEF_HELPER_FLAGS_4(maq_sa_w_qhlr, 0, void, tl, tl, i32, env)
503 DEF_HELPER_FLAGS_4(maq_sa_w_qhrl, 0, void, tl, tl, i32, env)
504 DEF_HELPER_FLAGS_4(maq_sa_w_qhrr, 0, void, tl, tl, i32, env)
505 DEF_HELPER_FLAGS_4(maq_s_l_pwl, 0, void, tl, tl, i32, env)
506 DEF_HELPER_FLAGS_4(maq_s_l_pwr, 0, void, tl, tl, i32, env)
507 DEF_HELPER_FLAGS_4(dmadd, 0, void, tl, tl, i32, env)
508 DEF_HELPER_FLAGS_4(dmaddu, 0, void, tl, tl, i32, env)
509 DEF_HELPER_FLAGS_4(dmsub, 0, void, tl, tl, i32, env)
510 DEF_HELPER_FLAGS_4(dmsubu, 0, void, tl, tl, i32, env)
511 #endif
512 
513 /* DSP Bit/Manipulation Sub-class insns */
514 DEF_HELPER_FLAGS_1(bitrev, TCG_CALL_NO_RWG_SE, tl, tl)
515 DEF_HELPER_FLAGS_3(insv, 0, tl, env, tl, tl)
516 #if defined(TARGET_MIPS64)
517 DEF_HELPER_FLAGS_3(dinsv, 0, tl, env, tl, tl)
518 #endif
519 
520 /* DSP Compare-Pick Sub-class insns */
521 DEF_HELPER_FLAGS_3(cmpu_eq_qb, 0, void, tl, tl, env)
522 DEF_HELPER_FLAGS_3(cmpu_lt_qb, 0, void, tl, tl, env)
523 DEF_HELPER_FLAGS_3(cmpu_le_qb, 0, void, tl, tl, env)
524 DEF_HELPER_FLAGS_2(cmpgu_eq_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
525 DEF_HELPER_FLAGS_2(cmpgu_lt_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
526 DEF_HELPER_FLAGS_2(cmpgu_le_qb, TCG_CALL_NO_RWG_SE, tl, tl, tl)
527 DEF_HELPER_FLAGS_3(cmp_eq_ph, 0, void, tl, tl, env)
528 DEF_HELPER_FLAGS_3(cmp_lt_ph, 0, void, tl, tl, env)
529 DEF_HELPER_FLAGS_3(cmp_le_ph, 0, void, tl, tl, env)
530 #if defined(TARGET_MIPS64)
531 DEF_HELPER_FLAGS_3(cmpu_eq_ob, 0, void, tl, tl, env)
532 DEF_HELPER_FLAGS_3(cmpu_lt_ob, 0, void, tl, tl, env)
533 DEF_HELPER_FLAGS_3(cmpu_le_ob, 0, void, tl, tl, env)
534 DEF_HELPER_FLAGS_3(cmpgdu_eq_ob, 0, tl, tl, tl, env)
535 DEF_HELPER_FLAGS_3(cmpgdu_lt_ob, 0, tl, tl, tl, env)
536 DEF_HELPER_FLAGS_3(cmpgdu_le_ob, 0, tl, tl, tl, env)
537 DEF_HELPER_FLAGS_2(cmpgu_eq_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
538 DEF_HELPER_FLAGS_2(cmpgu_lt_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
539 DEF_HELPER_FLAGS_2(cmpgu_le_ob, TCG_CALL_NO_RWG_SE, tl, tl, tl)
540 DEF_HELPER_FLAGS_3(cmp_eq_qh, 0, void, tl, tl, env)
541 DEF_HELPER_FLAGS_3(cmp_lt_qh, 0, void, tl, tl, env)
542 DEF_HELPER_FLAGS_3(cmp_le_qh, 0, void, tl, tl, env)
543 DEF_HELPER_FLAGS_3(cmp_eq_pw, 0, void, tl, tl, env)
544 DEF_HELPER_FLAGS_3(cmp_lt_pw, 0, void, tl, tl, env)
545 DEF_HELPER_FLAGS_3(cmp_le_pw, 0, void, tl, tl, env)
546 #endif
547 DEF_HELPER_FLAGS_3(pick_qb, 0, tl, tl, tl, env)
548 DEF_HELPER_FLAGS_3(pick_ph, 0, tl, tl, tl, env)
549 #if defined(TARGET_MIPS64)
550 DEF_HELPER_FLAGS_3(pick_ob, 0, tl, tl, tl, env)
551 DEF_HELPER_FLAGS_3(pick_qh, 0, tl, tl, tl, env)
552 DEF_HELPER_FLAGS_3(pick_pw, 0, tl, tl, tl, env)
553 #endif
554 DEF_HELPER_FLAGS_2(packrl_ph, TCG_CALL_NO_RWG_SE, tl, tl, tl)
555 #if defined(TARGET_MIPS64)
556 DEF_HELPER_FLAGS_2(packrl_pw, TCG_CALL_NO_RWG_SE, tl, tl, tl)
557 #endif
558 
559 /* DSP Accumulator and DSPControl Access Sub-class insns */
560 DEF_HELPER_FLAGS_3(extr_w, 0, tl, tl, tl, env)
561 DEF_HELPER_FLAGS_3(extr_r_w, 0, tl, tl, tl, env)
562 DEF_HELPER_FLAGS_3(extr_rs_w, 0, tl, tl, tl, env)
563 #if defined(TARGET_MIPS64)
564 DEF_HELPER_FLAGS_3(dextr_w, 0, tl, tl, tl, env)
565 DEF_HELPER_FLAGS_3(dextr_r_w, 0, tl, tl, tl, env)
566 DEF_HELPER_FLAGS_3(dextr_rs_w, 0, tl, tl, tl, env)
567 DEF_HELPER_FLAGS_3(dextr_l, 0, tl, tl, tl, env)
568 DEF_HELPER_FLAGS_3(dextr_r_l, 0, tl, tl, tl, env)
569 DEF_HELPER_FLAGS_3(dextr_rs_l, 0, tl, tl, tl, env)
570 #endif
571 DEF_HELPER_FLAGS_3(extr_s_h, 0, tl, tl, tl, env)
572 #if defined(TARGET_MIPS64)
573 DEF_HELPER_FLAGS_3(dextr_s_h, 0, tl, tl, tl, env)
574 #endif
575 DEF_HELPER_FLAGS_3(extp, 0, tl, tl, tl, env)
576 DEF_HELPER_FLAGS_3(extpdp, 0, tl, tl, tl, env)
577 #if defined(TARGET_MIPS64)
578 DEF_HELPER_FLAGS_3(dextp, 0, tl, tl, tl, env)
579 DEF_HELPER_FLAGS_3(dextpdp, 0, tl, tl, tl, env)
580 #endif
581 DEF_HELPER_FLAGS_3(shilo, 0, void, tl, tl, env)
582 #if defined(TARGET_MIPS64)
583 DEF_HELPER_FLAGS_3(dshilo, 0, void, tl, tl, env)
584 #endif
585 DEF_HELPER_FLAGS_3(mthlip, 0, void, tl, tl, env)
586 #if defined(TARGET_MIPS64)
587 DEF_HELPER_FLAGS_3(dmthlip, 0, void, tl, tl, env)
588 #endif
589 DEF_HELPER_FLAGS_3(wrdsp, 0, void, tl, tl, env)
590 DEF_HELPER_FLAGS_2(rddsp, 0, tl, tl, env)
591 
592 #ifndef CONFIG_USER_ONLY
593 #include "tcg/sysemu_helper.h.inc"
594 #endif /* !CONFIG_USER_ONLY */
595 
596 #include "tcg/msa_helper.h.inc"
597 
598 /* Vendor extensions */
599 #include "tcg/vr54xx_helper.h.inc"
600