]>
git.proxmox.com Git - qemu.git/blob - tcg/tcg-op.h
2 * Tiny Code Generator for QEMU
4 * Copyright (c) 2008 Fabrice Bellard
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 /* legacy dyngen operations */
29 int gen_new_label(void);
31 static inline void tcg_gen_op1(int opc
, TCGv arg1
)
34 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
37 static inline void tcg_gen_op1i(int opc
, TCGArg arg1
)
40 *gen_opparam_ptr
++ = arg1
;
43 static inline void tcg_gen_op2(int opc
, TCGv arg1
, TCGv arg2
)
46 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
47 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
50 static inline void tcg_gen_op2i(int opc
, TCGv arg1
, TCGArg arg2
)
53 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
54 *gen_opparam_ptr
++ = arg2
;
57 static inline void tcg_gen_op3(int opc
, TCGv arg1
, TCGv arg2
, TCGv arg3
)
60 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
61 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
62 *gen_opparam_ptr
++ = GET_TCGV(arg3
);
65 static inline void tcg_gen_op3i(int opc
, TCGv arg1
, TCGv arg2
, TCGArg arg3
)
68 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
69 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
70 *gen_opparam_ptr
++ = arg3
;
73 static inline void tcg_gen_op4(int opc
, TCGv arg1
, TCGv arg2
, TCGv arg3
,
77 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
78 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
79 *gen_opparam_ptr
++ = GET_TCGV(arg3
);
80 *gen_opparam_ptr
++ = GET_TCGV(arg4
);
83 static inline void tcg_gen_op4i(int opc
, TCGv arg1
, TCGv arg2
, TCGv arg3
,
87 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
88 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
89 *gen_opparam_ptr
++ = GET_TCGV(arg3
);
90 *gen_opparam_ptr
++ = arg4
;
93 static inline void tcg_gen_op4ii(int opc
, TCGv arg1
, TCGv arg2
, TCGArg arg3
,
97 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
98 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
99 *gen_opparam_ptr
++ = arg3
;
100 *gen_opparam_ptr
++ = arg4
;
103 static inline void tcg_gen_op5(int opc
, TCGv arg1
, TCGv arg2
,
104 TCGv arg3
, TCGv arg4
,
107 *gen_opc_ptr
++ = opc
;
108 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
109 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
110 *gen_opparam_ptr
++ = GET_TCGV(arg3
);
111 *gen_opparam_ptr
++ = GET_TCGV(arg4
);
112 *gen_opparam_ptr
++ = GET_TCGV(arg5
);
115 static inline void tcg_gen_op5i(int opc
, TCGv arg1
, TCGv arg2
,
116 TCGv arg3
, TCGv arg4
,
119 *gen_opc_ptr
++ = opc
;
120 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
121 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
122 *gen_opparam_ptr
++ = GET_TCGV(arg3
);
123 *gen_opparam_ptr
++ = GET_TCGV(arg4
);
124 *gen_opparam_ptr
++ = arg5
;
127 static inline void tcg_gen_op6(int opc
, TCGv arg1
, TCGv arg2
,
128 TCGv arg3
, TCGv arg4
,
129 TCGv arg5
, TCGv arg6
)
131 *gen_opc_ptr
++ = opc
;
132 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
133 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
134 *gen_opparam_ptr
++ = GET_TCGV(arg3
);
135 *gen_opparam_ptr
++ = GET_TCGV(arg4
);
136 *gen_opparam_ptr
++ = GET_TCGV(arg5
);
137 *gen_opparam_ptr
++ = GET_TCGV(arg6
);
140 static inline void tcg_gen_op6ii(int opc
, TCGv arg1
, TCGv arg2
,
141 TCGv arg3
, TCGv arg4
,
142 TCGArg arg5
, TCGArg arg6
)
144 *gen_opc_ptr
++ = opc
;
145 *gen_opparam_ptr
++ = GET_TCGV(arg1
);
146 *gen_opparam_ptr
++ = GET_TCGV(arg2
);
147 *gen_opparam_ptr
++ = GET_TCGV(arg3
);
148 *gen_opparam_ptr
++ = GET_TCGV(arg4
);
149 *gen_opparam_ptr
++ = arg5
;
150 *gen_opparam_ptr
++ = arg6
;
153 static inline void gen_set_label(int n
)
155 tcg_gen_op1i(INDEX_op_set_label
, n
);
158 static inline void tcg_gen_mov_i32(TCGv ret
, TCGv arg
)
160 tcg_gen_op2(INDEX_op_mov_i32
, ret
, arg
);
163 static inline void tcg_gen_movi_i32(TCGv ret
, int32_t arg
)
165 tcg_gen_op2i(INDEX_op_movi_i32
, ret
, arg
);
169 #define TCG_HELPER_CALL_FLAGS 0
171 static inline void tcg_gen_helper_0_0(void *func
)
173 tcg_gen_call(&tcg_ctx
,
174 tcg_const_ptr((tcg_target_long
)func
), TCG_HELPER_CALL_FLAGS
,
178 static inline void tcg_gen_helper_0_1(void *func
, TCGv arg
)
180 tcg_gen_call(&tcg_ctx
,
181 tcg_const_ptr((tcg_target_long
)func
), TCG_HELPER_CALL_FLAGS
,
185 static inline void tcg_gen_helper_0_2(void *func
, TCGv arg1
, TCGv arg2
)
190 tcg_gen_call(&tcg_ctx
,
191 tcg_const_ptr((tcg_target_long
)func
), TCG_HELPER_CALL_FLAGS
,
195 static inline void tcg_gen_helper_1_2(void *func
, TCGv ret
,
196 TCGv arg1
, TCGv arg2
)
201 tcg_gen_call(&tcg_ctx
,
202 tcg_const_ptr((tcg_target_long
)func
), TCG_HELPER_CALL_FLAGS
,
208 static inline void tcg_gen_ld8u_i32(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
210 tcg_gen_op3i(INDEX_op_ld8u_i32
, ret
, arg2
, offset
);
213 static inline void tcg_gen_ld8s_i32(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
215 tcg_gen_op3i(INDEX_op_ld8s_i32
, ret
, arg2
, offset
);
218 static inline void tcg_gen_ld16u_i32(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
220 tcg_gen_op3i(INDEX_op_ld16u_i32
, ret
, arg2
, offset
);
223 static inline void tcg_gen_ld16s_i32(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
225 tcg_gen_op3i(INDEX_op_ld16s_i32
, ret
, arg2
, offset
);
228 static inline void tcg_gen_ld_i32(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
230 tcg_gen_op3i(INDEX_op_ld_i32
, ret
, arg2
, offset
);
233 static inline void tcg_gen_st8_i32(TCGv arg1
, TCGv arg2
, tcg_target_long offset
)
235 tcg_gen_op3i(INDEX_op_st8_i32
, arg1
, arg2
, offset
);
238 static inline void tcg_gen_st16_i32(TCGv arg1
, TCGv arg2
, tcg_target_long offset
)
240 tcg_gen_op3i(INDEX_op_st16_i32
, arg1
, arg2
, offset
);
243 static inline void tcg_gen_st_i32(TCGv arg1
, TCGv arg2
, tcg_target_long offset
)
245 tcg_gen_op3i(INDEX_op_st_i32
, arg1
, arg2
, offset
);
248 static inline void tcg_gen_add_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
250 tcg_gen_op3(INDEX_op_add_i32
, ret
, arg1
, arg2
);
253 static inline void tcg_gen_addi_i32(TCGv ret
, TCGv arg1
, int32_t arg2
)
255 /* some cases can be optimized here */
257 tcg_gen_mov_i32(ret
, arg1
);
259 tcg_gen_add_i32(ret
, arg1
, tcg_const_i32(arg2
));
263 static inline void tcg_gen_sub_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
265 tcg_gen_op3(INDEX_op_sub_i32
, ret
, arg1
, arg2
);
268 static inline void tcg_gen_subi_i32(TCGv ret
, TCGv arg1
, int32_t arg2
)
270 /* some cases can be optimized here */
272 tcg_gen_mov_i32(ret
, arg1
);
274 tcg_gen_sub_i32(ret
, arg1
, tcg_const_i32(arg2
));
278 static inline void tcg_gen_and_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
280 tcg_gen_op3(INDEX_op_and_i32
, ret
, arg1
, arg2
);
283 static inline void tcg_gen_andi_i32(TCGv ret
, TCGv arg1
, int32_t arg2
)
285 /* some cases can be optimized here */
287 tcg_gen_movi_i32(ret
, 0);
288 } else if (arg2
== 0xffffffff) {
289 tcg_gen_mov_i32(ret
, arg1
);
291 tcg_gen_and_i32(ret
, arg1
, tcg_const_i32(arg2
));
295 static inline void tcg_gen_or_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
297 tcg_gen_op3(INDEX_op_or_i32
, ret
, arg1
, arg2
);
300 static inline void tcg_gen_ori_i32(TCGv ret
, TCGv arg1
, int32_t arg2
)
302 /* some cases can be optimized here */
303 if (arg2
== 0xffffffff) {
304 tcg_gen_movi_i32(ret
, 0xffffffff);
305 } else if (arg2
== 0) {
306 tcg_gen_mov_i32(ret
, arg1
);
308 tcg_gen_or_i32(ret
, arg1
, tcg_const_i32(arg2
));
312 static inline void tcg_gen_xor_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
314 tcg_gen_op3(INDEX_op_xor_i32
, ret
, arg1
, arg2
);
317 static inline void tcg_gen_xori_i32(TCGv ret
, TCGv arg1
, int32_t arg2
)
319 /* some cases can be optimized here */
321 tcg_gen_mov_i32(ret
, arg1
);
323 tcg_gen_xor_i32(ret
, arg1
, tcg_const_i32(arg2
));
327 static inline void tcg_gen_shl_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
329 tcg_gen_op3(INDEX_op_shl_i32
, ret
, arg1
, arg2
);
332 static inline void tcg_gen_shli_i32(TCGv ret
, TCGv arg1
, int32_t arg2
)
334 tcg_gen_shl_i32(ret
, arg1
, tcg_const_i32(arg2
));
337 static inline void tcg_gen_shr_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
339 tcg_gen_op3(INDEX_op_shr_i32
, ret
, arg1
, arg2
);
342 static inline void tcg_gen_shri_i32(TCGv ret
, TCGv arg1
, int32_t arg2
)
344 tcg_gen_shr_i32(ret
, arg1
, tcg_const_i32(arg2
));
347 static inline void tcg_gen_sar_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
349 tcg_gen_op3(INDEX_op_sar_i32
, ret
, arg1
, arg2
);
352 static inline void tcg_gen_sari_i32(TCGv ret
, TCGv arg1
, int32_t arg2
)
354 tcg_gen_sar_i32(ret
, arg1
, tcg_const_i32(arg2
));
357 static inline void tcg_gen_brcond_i32(int cond
, TCGv arg1
, TCGv arg2
,
360 tcg_gen_op4ii(INDEX_op_brcond_i32
, arg1
, arg2
, cond
, label_index
);
363 static inline void tcg_gen_mul_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
365 tcg_gen_op3(INDEX_op_mul_i32
, ret
, arg1
, arg2
);
368 #ifdef TCG_TARGET_HAS_div_i32
369 static inline void tcg_gen_div_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
371 tcg_gen_op3(INDEX_op_div_i32
, ret
, arg1
, arg2
);
374 static inline void tcg_gen_rem_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
376 tcg_gen_op3(INDEX_op_rem_i32
, ret
, arg1
, arg2
);
379 static inline void tcg_gen_divu_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
381 tcg_gen_op3(INDEX_op_divu_i32
, ret
, arg1
, arg2
);
384 static inline void tcg_gen_remu_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
386 tcg_gen_op3(INDEX_op_remu_i32
, ret
, arg1
, arg2
);
389 static inline void tcg_gen_div_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
392 t0
= tcg_temp_new(TCG_TYPE_I32
);
393 tcg_gen_sari_i32(t0
, arg1
, 31);
394 tcg_gen_op5(INDEX_op_div2_i32
, ret
, t0
, arg1
, t0
, arg2
);
397 static inline void tcg_gen_rem_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
400 t0
= tcg_temp_new(TCG_TYPE_I32
);
401 tcg_gen_sari_i32(t0
, arg1
, 31);
402 tcg_gen_op5(INDEX_op_div2_i32
, t0
, ret
, arg1
, t0
, arg2
);
405 static inline void tcg_gen_divu_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
408 t0
= tcg_temp_new(TCG_TYPE_I32
);
409 tcg_gen_movi_i32(t0
, 0);
410 tcg_gen_op5(INDEX_op_divu2_i32
, ret
, t0
, arg1
, t0
, arg2
);
413 static inline void tcg_gen_remu_i32(TCGv ret
, TCGv arg1
, TCGv arg2
)
416 t0
= tcg_temp_new(TCG_TYPE_I32
);
417 tcg_gen_movi_i32(t0
, 0);
418 tcg_gen_op5(INDEX_op_divu2_i32
, t0
, ret
, arg1
, t0
, arg2
);
422 #if TCG_TARGET_REG_BITS == 32
424 static inline void tcg_gen_mov_i64(TCGv ret
, TCGv arg
)
426 tcg_gen_mov_i32(ret
, arg
);
427 tcg_gen_mov_i32(TCGV_HIGH(ret
), TCGV_HIGH(arg
));
430 static inline void tcg_gen_movi_i64(TCGv ret
, int64_t arg
)
432 tcg_gen_movi_i32(ret
, arg
);
433 tcg_gen_movi_i32(TCGV_HIGH(ret
), arg
>> 32);
436 static inline void tcg_gen_ld8u_i64(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
438 tcg_gen_ld8u_i32(ret
, arg2
, offset
);
439 tcg_gen_movi_i32(TCGV_HIGH(ret
), 0);
442 static inline void tcg_gen_ld8s_i64(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
444 tcg_gen_ld8s_i32(ret
, arg2
, offset
);
445 tcg_gen_sari_i32(TCGV_HIGH(ret
), ret
, 31);
448 static inline void tcg_gen_ld16u_i64(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
450 tcg_gen_ld16u_i32(ret
, arg2
, offset
);
451 tcg_gen_movi_i32(TCGV_HIGH(ret
), 0);
454 static inline void tcg_gen_ld16s_i64(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
456 tcg_gen_ld16s_i32(ret
, arg2
, offset
);
457 tcg_gen_sari_i32(TCGV_HIGH(ret
), ret
, 31);
460 static inline void tcg_gen_ld32u_i64(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
462 tcg_gen_ld_i32(ret
, arg2
, offset
);
463 tcg_gen_movi_i32(TCGV_HIGH(ret
), 0);
466 static inline void tcg_gen_ld32s_i64(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
468 tcg_gen_ld_i32(ret
, arg2
, offset
);
469 tcg_gen_sari_i32(TCGV_HIGH(ret
), ret
, 31);
472 static inline void tcg_gen_ld_i64(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
474 /* since arg2 and ret have different types, they cannot be the
476 #ifdef TCG_TARGET_WORDS_BIGENDIAN
477 tcg_gen_ld_i32(TCGV_HIGH(ret
), arg2
, offset
);
478 tcg_gen_ld_i32(ret
, arg2
, offset
+ 4);
480 tcg_gen_ld_i32(ret
, arg2
, offset
);
481 tcg_gen_ld_i32(TCGV_HIGH(ret
), arg2
, offset
+ 4);
485 static inline void tcg_gen_st8_i64(TCGv arg1
, TCGv arg2
, tcg_target_long offset
)
487 tcg_gen_st8_i32(arg1
, arg2
, offset
);
490 static inline void tcg_gen_st16_i64(TCGv arg1
, TCGv arg2
, tcg_target_long offset
)
492 tcg_gen_st16_i32(arg1
, arg2
, offset
);
495 static inline void tcg_gen_st32_i64(TCGv arg1
, TCGv arg2
, tcg_target_long offset
)
497 tcg_gen_st_i32(arg1
, arg2
, offset
);
500 static inline void tcg_gen_st_i64(TCGv arg1
, TCGv arg2
, tcg_target_long offset
)
502 #ifdef TCG_TARGET_WORDS_BIGENDIAN
503 tcg_gen_st_i32(TCGV_HIGH(arg1
), arg2
, offset
);
504 tcg_gen_st_i32(arg1
, arg2
, offset
+ 4);
506 tcg_gen_st_i32(arg1
, arg2
, offset
);
507 tcg_gen_st_i32(TCGV_HIGH(arg1
), arg2
, offset
+ 4);
511 static inline void tcg_gen_add_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
513 tcg_gen_op6(INDEX_op_add2_i32
, ret
, TCGV_HIGH(ret
),
514 arg1
, TCGV_HIGH(arg1
), arg2
, TCGV_HIGH(arg2
));
517 static inline void tcg_gen_addi_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
519 tcg_gen_add_i64(ret
, arg1
, tcg_const_i64(arg2
));
522 static inline void tcg_gen_sub_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
524 tcg_gen_op6(INDEX_op_sub2_i32
, ret
, TCGV_HIGH(ret
),
525 arg1
, TCGV_HIGH(arg1
), arg2
, TCGV_HIGH(arg2
));
528 static inline void tcg_gen_subi_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
530 tcg_gen_sub_i64(ret
, arg1
, tcg_const_i64(arg2
));
533 static inline void tcg_gen_and_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
535 tcg_gen_and_i32(ret
, arg1
, arg2
);
536 tcg_gen_and_i32(TCGV_HIGH(ret
), TCGV_HIGH(arg1
), TCGV_HIGH(arg2
));
539 static inline void tcg_gen_andi_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
541 tcg_gen_andi_i32(ret
, arg1
, arg2
);
542 tcg_gen_andi_i32(TCGV_HIGH(ret
), TCGV_HIGH(arg1
), arg2
>> 32);
545 static inline void tcg_gen_or_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
547 tcg_gen_or_i32(ret
, arg1
, arg2
);
548 tcg_gen_or_i32(TCGV_HIGH(ret
), TCGV_HIGH(arg1
), TCGV_HIGH(arg2
));
551 static inline void tcg_gen_ori_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
553 tcg_gen_ori_i32(ret
, arg1
, arg2
);
554 tcg_gen_ori_i32(TCGV_HIGH(ret
), TCGV_HIGH(arg1
), arg2
>> 32);
557 static inline void tcg_gen_xor_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
559 tcg_gen_xor_i32(ret
, arg1
, arg2
);
560 tcg_gen_xor_i32(TCGV_HIGH(ret
), TCGV_HIGH(arg1
), TCGV_HIGH(arg2
));
563 static inline void tcg_gen_xori_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
565 tcg_gen_xori_i32(ret
, arg1
, arg2
);
566 tcg_gen_xori_i32(TCGV_HIGH(ret
), TCGV_HIGH(arg1
), arg2
>> 32);
569 /* XXX: use generic code when basic block handling is OK or CPU
570 specific code (x86) */
571 static inline void tcg_gen_shl_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
573 tcg_gen_helper_1_2(tcg_helper_shl_i64
, ret
, arg1
, arg2
);
576 static inline void tcg_gen_shli_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
578 tcg_gen_shifti_i64(ret
, arg1
, arg2
, 0, 0);
581 static inline void tcg_gen_shr_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
583 tcg_gen_helper_1_2(tcg_helper_shr_i64
, ret
, arg1
, arg2
);
586 static inline void tcg_gen_shri_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
588 tcg_gen_shifti_i64(ret
, arg1
, arg2
, 1, 0);
591 static inline void tcg_gen_sar_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
593 tcg_gen_helper_1_2(tcg_helper_sar_i64
, ret
, arg1
, arg2
);
596 static inline void tcg_gen_sari_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
598 tcg_gen_shifti_i64(ret
, arg1
, arg2
, 1, 1);
601 static inline void tcg_gen_brcond_i64(int cond
, TCGv arg1
, TCGv arg2
,
604 tcg_gen_op6ii(INDEX_op_brcond2_i32
,
605 arg1
, TCGV_HIGH(arg1
), arg2
, TCGV_HIGH(arg2
),
609 static inline void tcg_gen_mul_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
613 t0
= tcg_temp_new(TCG_TYPE_I64
);
614 t1
= tcg_temp_new(TCG_TYPE_I32
);
616 tcg_gen_op4(INDEX_op_mulu2_i32
, t0
, TCGV_HIGH(t0
), arg1
, arg2
);
618 tcg_gen_mul_i32(t1
, arg1
, TCGV_HIGH(arg2
));
619 tcg_gen_add_i32(TCGV_HIGH(t0
), TCGV_HIGH(t0
), t1
);
620 tcg_gen_mul_i32(t1
, TCGV_HIGH(arg1
), arg2
);
621 tcg_gen_add_i32(TCGV_HIGH(t0
), TCGV_HIGH(t0
), t1
);
623 tcg_gen_mov_i64(ret
, t0
);
626 static inline void tcg_gen_div_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
628 tcg_gen_helper_1_2(tcg_helper_div_i64
, ret
, arg1
, arg2
);
631 static inline void tcg_gen_rem_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
633 tcg_gen_helper_1_2(tcg_helper_rem_i64
, ret
, arg1
, arg2
);
636 static inline void tcg_gen_divu_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
638 tcg_gen_helper_1_2(tcg_helper_divu_i64
, ret
, arg1
, arg2
);
641 static inline void tcg_gen_remu_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
643 tcg_gen_helper_1_2(tcg_helper_remu_i64
, ret
, arg1
, arg2
);
648 static inline void tcg_gen_mov_i64(TCGv ret
, TCGv arg
)
650 tcg_gen_op2(INDEX_op_mov_i64
, ret
, arg
);
653 static inline void tcg_gen_movi_i64(TCGv ret
, int64_t arg
)
655 tcg_gen_op2i(INDEX_op_movi_i64
, ret
, arg
);
658 static inline void tcg_gen_ld8u_i64(TCGv ret
, TCGv arg2
,
659 tcg_target_long offset
)
661 tcg_gen_op3i(INDEX_op_ld8u_i64
, ret
, arg2
, offset
);
664 static inline void tcg_gen_ld8s_i64(TCGv ret
, TCGv arg2
,
665 tcg_target_long offset
)
667 tcg_gen_op3i(INDEX_op_ld8s_i64
, ret
, arg2
, offset
);
670 static inline void tcg_gen_ld16u_i64(TCGv ret
, TCGv arg2
,
671 tcg_target_long offset
)
673 tcg_gen_op3i(INDEX_op_ld16u_i64
, ret
, arg2
, offset
);
676 static inline void tcg_gen_ld16s_i64(TCGv ret
, TCGv arg2
,
677 tcg_target_long offset
)
679 tcg_gen_op3i(INDEX_op_ld16s_i64
, ret
, arg2
, offset
);
682 static inline void tcg_gen_ld32u_i64(TCGv ret
, TCGv arg2
,
683 tcg_target_long offset
)
685 tcg_gen_op3i(INDEX_op_ld32u_i64
, ret
, arg2
, offset
);
688 static inline void tcg_gen_ld32s_i64(TCGv ret
, TCGv arg2
,
689 tcg_target_long offset
)
691 tcg_gen_op3i(INDEX_op_ld32s_i64
, ret
, arg2
, offset
);
694 static inline void tcg_gen_ld_i64(TCGv ret
, TCGv arg2
, tcg_target_long offset
)
696 tcg_gen_op3i(INDEX_op_ld_i64
, ret
, arg2
, offset
);
699 static inline void tcg_gen_st8_i64(TCGv arg1
, TCGv arg2
,
700 tcg_target_long offset
)
702 tcg_gen_op3i(INDEX_op_st8_i64
, arg1
, arg2
, offset
);
705 static inline void tcg_gen_st16_i64(TCGv arg1
, TCGv arg2
,
706 tcg_target_long offset
)
708 tcg_gen_op3i(INDEX_op_st16_i64
, arg1
, arg2
, offset
);
711 static inline void tcg_gen_st32_i64(TCGv arg1
, TCGv arg2
,
712 tcg_target_long offset
)
714 tcg_gen_op3i(INDEX_op_st32_i64
, arg1
, arg2
, offset
);
717 static inline void tcg_gen_st_i64(TCGv arg1
, TCGv arg2
, tcg_target_long offset
)
719 tcg_gen_op3i(INDEX_op_st_i64
, arg1
, arg2
, offset
);
722 static inline void tcg_gen_add_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
724 tcg_gen_op3(INDEX_op_add_i64
, ret
, arg1
, arg2
);
727 static inline void tcg_gen_addi_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
729 tcg_gen_add_i64(ret
, arg1
, tcg_const_i64(arg2
));
732 static inline void tcg_gen_sub_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
734 tcg_gen_op3(INDEX_op_sub_i64
, ret
, arg1
, arg2
);
737 static inline void tcg_gen_subi_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
739 tcg_gen_sub_i64(ret
, arg1
, tcg_const_i64(arg2
));
742 static inline void tcg_gen_and_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
744 tcg_gen_op3(INDEX_op_and_i64
, ret
, arg1
, arg2
);
747 static inline void tcg_gen_andi_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
749 tcg_gen_and_i64(ret
, arg1
, tcg_const_i64(arg2
));
752 static inline void tcg_gen_or_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
754 tcg_gen_op3(INDEX_op_or_i64
, ret
, arg1
, arg2
);
757 static inline void tcg_gen_ori_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
759 tcg_gen_or_i64(ret
, arg1
, tcg_const_i64(arg2
));
762 static inline void tcg_gen_xor_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
764 tcg_gen_op3(INDEX_op_xor_i64
, ret
, arg1
, arg2
);
767 static inline void tcg_gen_xori_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
769 tcg_gen_xor_i64(ret
, arg1
, tcg_const_i64(arg2
));
772 static inline void tcg_gen_shl_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
774 tcg_gen_op3(INDEX_op_shl_i64
, ret
, arg1
, arg2
);
777 static inline void tcg_gen_shli_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
779 tcg_gen_shl_i64(ret
, arg1
, tcg_const_i64(arg2
));
782 static inline void tcg_gen_shr_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
784 tcg_gen_op3(INDEX_op_shr_i64
, ret
, arg1
, arg2
);
787 static inline void tcg_gen_shri_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
789 tcg_gen_shr_i64(ret
, arg1
, tcg_const_i64(arg2
));
792 static inline void tcg_gen_sar_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
794 tcg_gen_op3(INDEX_op_sar_i64
, ret
, arg1
, arg2
);
797 static inline void tcg_gen_sari_i64(TCGv ret
, TCGv arg1
, int64_t arg2
)
799 tcg_gen_sar_i64(ret
, arg1
, tcg_const_i64(arg2
));
802 static inline void tcg_gen_brcond_i64(int cond
, TCGv arg1
, TCGv arg2
,
805 tcg_gen_op4ii(INDEX_op_brcond_i64
, arg1
, arg2
, cond
, label_index
);
808 static inline void tcg_gen_mul_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
810 tcg_gen_op3(INDEX_op_mul_i64
, ret
, arg1
, arg2
);
813 #ifdef TCG_TARGET_HAS_div_i64
814 static inline void tcg_gen_div_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
816 tcg_gen_op3(INDEX_op_div_i64
, ret
, arg1
, arg2
);
819 static inline void tcg_gen_rem_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
821 tcg_gen_op3(INDEX_op_rem_i64
, ret
, arg1
, arg2
);
824 static inline void tcg_gen_divu_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
826 tcg_gen_op3(INDEX_op_divu_i64
, ret
, arg1
, arg2
);
829 static inline void tcg_gen_remu_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
831 tcg_gen_op3(INDEX_op_remu_i64
, ret
, arg1
, arg2
);
834 static inline void tcg_gen_div_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
837 t0
= tcg_temp_new(TCG_TYPE_I64
);
838 tcg_gen_sari_i64(t0
, arg1
, 63);
839 tcg_gen_op5(INDEX_op_div2_i64
, ret
, t0
, arg1
, t0
, arg2
);
842 static inline void tcg_gen_rem_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
845 t0
= tcg_temp_new(TCG_TYPE_I64
);
846 tcg_gen_sari_i64(t0
, arg1
, 63);
847 tcg_gen_op5(INDEX_op_div2_i64
, t0
, ret
, arg1
, t0
, arg2
);
850 static inline void tcg_gen_divu_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
853 t0
= tcg_temp_new(TCG_TYPE_I64
);
854 tcg_gen_movi_i64(t0
, 0);
855 tcg_gen_op5(INDEX_op_divu2_i64
, ret
, t0
, arg1
, t0
, arg2
);
858 static inline void tcg_gen_remu_i64(TCGv ret
, TCGv arg1
, TCGv arg2
)
861 t0
= tcg_temp_new(TCG_TYPE_I64
);
862 tcg_gen_movi_i64(t0
, 0);
863 tcg_gen_op5(INDEX_op_divu2_i64
, t0
, ret
, arg1
, t0
, arg2
);
869 /***************************************/
870 /* optional operations */
872 static inline void tcg_gen_ext8s_i32(TCGv ret
, TCGv arg
)
874 #ifdef TCG_TARGET_HAS_ext8s_i32
875 tcg_gen_op2(INDEX_op_ext8s_i32
, ret
, arg
);
877 tcg_gen_shli_i32(ret
, arg
, 24);
878 tcg_gen_sari_i32(ret
, ret
, 24);
882 static inline void tcg_gen_ext16s_i32(TCGv ret
, TCGv arg
)
884 #ifdef TCG_TARGET_HAS_ext16s_i32
885 tcg_gen_op2(INDEX_op_ext16s_i32
, ret
, arg
);
887 tcg_gen_shli_i32(ret
, arg
, 16);
888 tcg_gen_sari_i32(ret
, ret
, 16);
892 /* Note: we assume the two high bytes are set to zero */
893 static inline void tcg_gen_bswap16_i32(TCGv ret
, TCGv arg
)
895 #ifdef TCG_TARGET_HAS_bswap16_i32
896 tcg_gen_op2(INDEX_op_bswap16_i32
, ret
, arg
);
899 t0
= tcg_temp_new(TCG_TYPE_I32
);
900 t1
= tcg_temp_new(TCG_TYPE_I32
);
902 tcg_gen_shri_i32(t0
, arg
, 8);
903 tcg_gen_andi_i32(t1
, arg
, 0x000000ff);
904 tcg_gen_shli_i32(t1
, t1
, 8);
905 tcg_gen_or_i32(ret
, t0
, t1
);
909 static inline void tcg_gen_bswap_i32(TCGv ret
, TCGv arg
)
911 #ifdef TCG_TARGET_HAS_bswap_i32
912 tcg_gen_op2(INDEX_op_bswap_i32
, ret
, arg
);
915 t0
= tcg_temp_new(TCG_TYPE_I32
);
916 t1
= tcg_temp_new(TCG_TYPE_I32
);
918 tcg_gen_shli_i32(t0
, arg
, 24);
920 tcg_gen_andi_i32(t1
, arg
, 0x0000ff00);
921 tcg_gen_shli_i32(t1
, t1
, 8);
922 tcg_gen_or_i32(t0
, t0
, t1
);
924 tcg_gen_shri_i32(t1
, arg
, 8);
925 tcg_gen_andi_i32(t1
, t1
, 0x0000ff00);
926 tcg_gen_or_i32(t0
, t0
, t1
);
928 tcg_gen_shri_i32(t1
, arg
, 24);
929 tcg_gen_or_i32(ret
, t0
, t1
);
933 #if TCG_TARGET_REG_BITS == 32
934 static inline void tcg_gen_ext8s_i64(TCGv ret
, TCGv arg
)
936 tcg_gen_ext8s_i32(ret
, arg
);
937 tcg_gen_sari_i32(TCGV_HIGH(ret
), ret
, 31);
940 static inline void tcg_gen_ext16s_i64(TCGv ret
, TCGv arg
)
942 tcg_gen_ext16s_i32(ret
, arg
);
943 tcg_gen_sari_i32(TCGV_HIGH(ret
), ret
, 31);
946 static inline void tcg_gen_ext32s_i64(TCGv ret
, TCGv arg
)
948 tcg_gen_mov_i32(ret
, arg
);
949 tcg_gen_sari_i32(TCGV_HIGH(ret
), ret
, 31);
952 static inline void tcg_gen_trunc_i64_i32(TCGv ret
, TCGv arg
)
954 tcg_gen_mov_i32(ret
, arg
);
957 static inline void tcg_gen_extu_i32_i64(TCGv ret
, TCGv arg
)
959 tcg_gen_mov_i32(ret
, arg
);
960 tcg_gen_movi_i32(TCGV_HIGH(ret
), 0);
963 static inline void tcg_gen_ext_i32_i64(TCGv ret
, TCGv arg
)
965 tcg_gen_mov_i32(ret
, arg
);
966 tcg_gen_sari_i32(TCGV_HIGH(ret
), ret
, 31);
969 static inline void tcg_gen_bswap_i64(TCGv ret
, TCGv arg
)
972 t0
= tcg_temp_new(TCG_TYPE_I32
);
973 t1
= tcg_temp_new(TCG_TYPE_I32
);
975 tcg_gen_bswap_i32(t0
, arg
);
976 tcg_gen_bswap_i32(t1
, TCGV_HIGH(arg
));
977 tcg_gen_mov_i32(ret
, t1
);
978 tcg_gen_mov_i32(TCGV_HIGH(ret
), t0
);
982 static inline void tcg_gen_ext8s_i64(TCGv ret
, TCGv arg
)
984 #ifdef TCG_TARGET_HAS_ext8s_i64
985 tcg_gen_op2(INDEX_op_ext8s_i64
, ret
, arg
);
987 tcg_gen_shli_i64(ret
, arg
, 56);
988 tcg_gen_sari_i64(ret
, ret
, 56);
992 static inline void tcg_gen_ext16s_i64(TCGv ret
, TCGv arg
)
994 #ifdef TCG_TARGET_HAS_ext16s_i64
995 tcg_gen_op2(INDEX_op_ext16s_i64
, ret
, arg
);
997 tcg_gen_shli_i64(ret
, arg
, 48);
998 tcg_gen_sari_i64(ret
, ret
, 48);
1002 static inline void tcg_gen_ext32s_i64(TCGv ret
, TCGv arg
)
1004 #ifdef TCG_TARGET_HAS_ext32s_i64
1005 tcg_gen_op2(INDEX_op_ext32s_i64
, ret
, arg
);
1007 tcg_gen_shli_i64(ret
, arg
, 32);
1008 tcg_gen_sari_i64(ret
, ret
, 32);
1012 /* Note: we assume the target supports move between 32 and 64 bit
1013 registers. This will probably break MIPS64 targets. */
1014 static inline void tcg_gen_trunc_i64_i32(TCGv ret
, TCGv arg
)
1016 tcg_gen_mov_i32(ret
, arg
);
1019 /* Note: we assume the target supports move between 32 and 64 bit
1021 static inline void tcg_gen_extu_i32_i64(TCGv ret
, TCGv arg
)
1023 tcg_gen_andi_i64(ret
, arg
, 0xffffffff);
1026 /* Note: we assume the target supports move between 32 and 64 bit
1028 static inline void tcg_gen_ext_i32_i64(TCGv ret
, TCGv arg
)
1030 tcg_gen_ext32s_i64(ret
, arg
);
1033 static inline void tcg_gen_bswap_i64(TCGv ret
, TCGv arg
)
1035 #ifdef TCG_TARGET_HAS_bswap_i64
1036 tcg_gen_op2(INDEX_op_bswap_i64
, ret
, arg
);
1039 t0
= tcg_temp_new(TCG_TYPE_I32
);
1040 t1
= tcg_temp_new(TCG_TYPE_I32
);
1042 tcg_gen_shli_i64(t0
, arg
, 56);
1044 tcg_gen_andi_i64(t1
, arg
, 0x0000ff00);
1045 tcg_gen_shli_i64(t1
, t1
, 40);
1046 tcg_gen_or_i64(t0
, t0
, t1
);
1048 tcg_gen_andi_i64(t1
, arg
, 0x00ff0000);
1049 tcg_gen_shli_i64(t1
, t1
, 24);
1050 tcg_gen_or_i64(t0
, t0
, t1
);
1052 tcg_gen_andi_i64(t1
, arg
, 0xff000000);
1053 tcg_gen_shli_i64(t1
, t1
, 8);
1054 tcg_gen_or_i64(t0
, t0
, t1
);
1056 tcg_gen_shri_i64(t1
, arg
, 8);
1057 tcg_gen_andi_i64(t1
, t1
, 0xff000000);
1058 tcg_gen_or_i64(t0
, t0
, t1
);
1060 tcg_gen_shri_i64(t1
, arg
, 24);
1061 tcg_gen_andi_i64(t1
, t1
, 0x00ff0000);
1062 tcg_gen_or_i64(t0
, t0
, t1
);
1064 tcg_gen_shri_i64(t1
, arg
, 40);
1065 tcg_gen_andi_i64(t1
, t1
, 0x0000ff00);
1066 tcg_gen_or_i64(t0
, t0
, t1
);
1068 tcg_gen_shri_i64(t1
, arg
, 56);
1069 tcg_gen_or_i64(ret
, t0
, t1
);
1076 static inline void tcg_gen_discard_i32(TCGv arg
)
1078 tcg_gen_op1(INDEX_op_discard
, arg
);
1081 #if TCG_TARGET_REG_BITS == 32
1082 static inline void tcg_gen_discard_i64(TCGv arg
)
1084 tcg_gen_discard_i32(arg
);
1085 tcg_gen_discard_i32(TCGV_HIGH(arg
));
1088 static inline void tcg_gen_discard_i64(TCGv arg
)
1090 tcg_gen_op1(INDEX_op_discard
, arg
);
1094 /***************************************/
1095 static inline void tcg_gen_macro_2(TCGv ret0
, TCGv ret1
, int macro_id
)
1097 tcg_gen_op3i(INDEX_op_macro_2
, ret0
, ret1
, macro_id
);
1100 /***************************************/
1101 /* QEMU specific operations. Their type depend on the QEMU CPU
1103 #ifndef TARGET_LONG_BITS
1104 #error must include QEMU headers
1107 static inline void tcg_gen_exit_tb(tcg_target_long val
)
1109 tcg_gen_op1i(INDEX_op_exit_tb
, val
);
1112 static inline void tcg_gen_goto_tb(int idx
)
1114 tcg_gen_op1i(INDEX_op_goto_tb
, idx
);
1117 #if TCG_TARGET_REG_BITS == 32
1118 static inline void tcg_gen_qemu_ld8u(TCGv ret
, TCGv addr
, int mem_index
)
1120 #if TARGET_LONG_BITS == 32
1121 tcg_gen_op3i(INDEX_op_qemu_ld8u
, ret
, addr
, mem_index
);
1123 tcg_gen_op4i(INDEX_op_qemu_ld8u
, ret
, addr
, TCGV_HIGH(addr
), mem_index
);
1124 tcg_gen_movi_i32(TCGV_HIGH(ret
), 0);
1128 static inline void tcg_gen_qemu_ld8s(TCGv ret
, TCGv addr
, int mem_index
)
1130 #if TARGET_LONG_BITS == 32
1131 tcg_gen_op3i(INDEX_op_qemu_ld8s
, ret
, addr
, mem_index
);
1133 tcg_gen_op4i(INDEX_op_qemu_ld8s
, ret
, addr
, TCGV_HIGH(addr
), mem_index
);
1134 tcg_gen_ext8s_i32(TCGV_HIGH(ret
), ret
);
1138 static inline void tcg_gen_qemu_ld16u(TCGv ret
, TCGv addr
, int mem_index
)
1140 #if TARGET_LONG_BITS == 32
1141 tcg_gen_op3i(INDEX_op_qemu_ld16u
, ret
, addr
, mem_index
);
1143 tcg_gen_op4i(INDEX_op_qemu_ld16u
, ret
, addr
, TCGV_HIGH(addr
), mem_index
);
1144 tcg_gen_movi_i32(TCGV_HIGH(ret
), 0);
1148 static inline void tcg_gen_qemu_ld16s(TCGv ret
, TCGv addr
, int mem_index
)
1150 #if TARGET_LONG_BITS == 32
1151 tcg_gen_op3i(INDEX_op_qemu_ld16s
, ret
, addr
, mem_index
);
1153 tcg_gen_op4i(INDEX_op_qemu_ld16s
, ret
, addr
, TCGV_HIGH(addr
), mem_index
);
1154 tcg_gen_ext16s_i32(TCGV_HIGH(ret
), ret
);
1158 static inline void tcg_gen_qemu_ld32u(TCGv ret
, TCGv addr
, int mem_index
)
1160 #if TARGET_LONG_BITS == 32
1161 tcg_gen_op3i(INDEX_op_qemu_ld32u
, ret
, addr
, mem_index
);
1163 tcg_gen_op4i(INDEX_op_qemu_ld32u
, ret
, addr
, TCGV_HIGH(addr
), mem_index
);
1164 tcg_gen_movi_i32(TCGV_HIGH(ret
), 0);
1168 static inline void tcg_gen_qemu_ld32s(TCGv ret
, TCGv addr
, int mem_index
)
1170 #if TARGET_LONG_BITS == 32
1171 tcg_gen_op3i(INDEX_op_qemu_ld32u
, ret
, addr
, mem_index
);
1173 tcg_gen_op4i(INDEX_op_qemu_ld32u
, ret
, addr
, TCGV_HIGH(addr
), mem_index
);
1174 tcg_gen_sari_i32(TCGV_HIGH(ret
), ret
, 31);
1178 static inline void tcg_gen_qemu_ld64(TCGv ret
, TCGv addr
, int mem_index
)
1180 #if TARGET_LONG_BITS == 32
1181 tcg_gen_op4i(INDEX_op_qemu_ld64
, ret
, TCGV_HIGH(ret
), addr
, mem_index
);
1183 tcg_gen_op5i(INDEX_op_qemu_ld64
, ret
, TCGV_HIGH(ret
),
1184 addr
, TCGV_HIGH(addr
), mem_index
);
1188 static inline void tcg_gen_qemu_st8(TCGv arg
, TCGv addr
, int mem_index
)
1190 #if TARGET_LONG_BITS == 32
1191 tcg_gen_op3i(INDEX_op_qemu_st8
, arg
, addr
, mem_index
);
1193 tcg_gen_op4i(INDEX_op_qemu_st8
, arg
, addr
, TCGV_HIGH(addr
), mem_index
);
1197 static inline void tcg_gen_qemu_st16(TCGv arg
, TCGv addr
, int mem_index
)
1199 #if TARGET_LONG_BITS == 32
1200 tcg_gen_op3i(INDEX_op_qemu_st16
, arg
, addr
, mem_index
);
1202 tcg_gen_op4i(INDEX_op_qemu_st16
, arg
, addr
, TCGV_HIGH(addr
), mem_index
);
1206 static inline void tcg_gen_qemu_st32(TCGv arg
, TCGv addr
, int mem_index
)
1208 #if TARGET_LONG_BITS == 32
1209 tcg_gen_op3i(INDEX_op_qemu_st32
, arg
, addr
, mem_index
);
1211 tcg_gen_op4i(INDEX_op_qemu_st32
, arg
, addr
, TCGV_HIGH(addr
), mem_index
);
1215 static inline void tcg_gen_qemu_st64(TCGv arg
, TCGv addr
, int mem_index
)
1217 #if TARGET_LONG_BITS == 32
1218 tcg_gen_op4i(INDEX_op_qemu_st64
, arg
, TCGV_HIGH(arg
), addr
, mem_index
);
1220 tcg_gen_op5i(INDEX_op_qemu_st64
, arg
, TCGV_HIGH(arg
),
1221 addr
, TCGV_HIGH(addr
), mem_index
);
1225 #else /* TCG_TARGET_REG_BITS == 32 */
1227 static inline void tcg_gen_qemu_ld8u(TCGv ret
, TCGv addr
, int mem_index
)
1229 tcg_gen_op3i(INDEX_op_qemu_ld8u
, ret
, addr
, mem_index
);
1232 static inline void tcg_gen_qemu_ld8s(TCGv ret
, TCGv addr
, int mem_index
)
1234 tcg_gen_op3i(INDEX_op_qemu_ld8s
, ret
, addr
, mem_index
);
1237 static inline void tcg_gen_qemu_ld16u(TCGv ret
, TCGv addr
, int mem_index
)
1239 tcg_gen_op3i(INDEX_op_qemu_ld16u
, ret
, addr
, mem_index
);
1242 static inline void tcg_gen_qemu_ld16s(TCGv ret
, TCGv addr
, int mem_index
)
1244 tcg_gen_op3i(INDEX_op_qemu_ld16s
, ret
, addr
, mem_index
);
1247 static inline void tcg_gen_qemu_ld32u(TCGv ret
, TCGv addr
, int mem_index
)
1249 tcg_gen_op3i(INDEX_op_qemu_ld32u
, ret
, addr
, mem_index
);
1252 static inline void tcg_gen_qemu_ld32s(TCGv ret
, TCGv addr
, int mem_index
)
1254 tcg_gen_op3i(INDEX_op_qemu_ld32s
, ret
, addr
, mem_index
);
1257 static inline void tcg_gen_qemu_ld64(TCGv ret
, TCGv addr
, int mem_index
)
1259 tcg_gen_op3i(INDEX_op_qemu_ld64
, ret
, addr
, mem_index
);
1262 static inline void tcg_gen_qemu_st8(TCGv arg
, TCGv addr
, int mem_index
)
1264 tcg_gen_op3i(INDEX_op_qemu_st8
, arg
, addr
, mem_index
);
1267 static inline void tcg_gen_qemu_st16(TCGv arg
, TCGv addr
, int mem_index
)
1269 tcg_gen_op3i(INDEX_op_qemu_st16
, arg
, addr
, mem_index
);
1272 static inline void tcg_gen_qemu_st32(TCGv arg
, TCGv addr
, int mem_index
)
1274 tcg_gen_op3i(INDEX_op_qemu_st32
, arg
, addr
, mem_index
);
1277 static inline void tcg_gen_qemu_st64(TCGv arg
, TCGv addr
, int mem_index
)
1279 tcg_gen_op3i(INDEX_op_qemu_st64
, arg
, addr
, mem_index
);
1282 #endif /* TCG_TARGET_REG_BITS != 32 */