Revert "kvm: qemu: fix host_cpuid() on x86_64"
[qemu-kvm/fedora.git] / tcg / tcg-op.h
blob82aebb321985fb5ada0f1c48749e76c54a565f5b
1 /*
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
22 * THE SOFTWARE.
24 #include "tcg.h"
26 /* legacy dyngen operations */
27 #include "gen-op.h"
29 int gen_new_label(void);
31 static inline void tcg_gen_op1(int opc, TCGv arg1)
33 *gen_opc_ptr++ = opc;
34 *gen_opparam_ptr++ = GET_TCGV(arg1);
37 static inline void tcg_gen_op1i(int opc, TCGArg arg1)
39 *gen_opc_ptr++ = opc;
40 *gen_opparam_ptr++ = arg1;
43 static inline void tcg_gen_op2(int opc, TCGv arg1, TCGv arg2)
45 *gen_opc_ptr++ = opc;
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)
52 *gen_opc_ptr++ = opc;
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)
59 *gen_opc_ptr++ = opc;
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)
67 *gen_opc_ptr++ = opc;
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,
74 TCGv arg4)
76 *gen_opc_ptr++ = opc;
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,
84 TCGArg arg4)
86 *gen_opc_ptr++ = opc;
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,
94 TCGArg arg4)
96 *gen_opc_ptr++ = opc;
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,
105 TCGv arg5)
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,
117 TCGArg arg5)
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);
168 /* helper calls */
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,
175 0, NULL, 0, NULL);
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,
182 0, NULL, 1, &arg);
185 static inline void tcg_gen_helper_0_2(void *func, TCGv arg1, TCGv arg2)
187 TCGv args[2];
188 args[0] = arg1;
189 args[1] = arg2;
190 tcg_gen_call(&tcg_ctx,
191 tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
192 0, NULL, 2, args);
195 static inline void tcg_gen_helper_1_2(void *func, TCGv ret,
196 TCGv arg1, TCGv arg2)
198 TCGv args[2];
199 args[0] = arg1;
200 args[1] = arg2;
201 tcg_gen_call(&tcg_ctx,
202 tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
203 1, &ret, 2, args);
206 /* 32 bit ops */
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 tcg_gen_add_i32(ret, arg1, tcg_const_i32(arg2));
258 static inline void tcg_gen_sub_i32(TCGv ret, TCGv arg1, TCGv arg2)
260 tcg_gen_op3(INDEX_op_sub_i32, ret, arg1, arg2);
263 static inline void tcg_gen_subi_i32(TCGv ret, TCGv arg1, int32_t arg2)
265 tcg_gen_sub_i32(ret, arg1, tcg_const_i32(arg2));
268 static inline void tcg_gen_and_i32(TCGv ret, TCGv arg1, TCGv arg2)
270 tcg_gen_op3(INDEX_op_and_i32, ret, arg1, arg2);
273 static inline void tcg_gen_andi_i32(TCGv ret, TCGv arg1, int32_t arg2)
275 /* some cases can be optimized here */
276 if (arg2 == 0) {
277 tcg_gen_movi_i32(ret, 0);
278 } else if (arg2 == 0xffffffff) {
279 tcg_gen_mov_i32(ret, arg1);
280 } else {
281 tcg_gen_and_i32(ret, arg1, tcg_const_i32(arg2));
285 static inline void tcg_gen_or_i32(TCGv ret, TCGv arg1, TCGv arg2)
287 tcg_gen_op3(INDEX_op_or_i32, ret, arg1, arg2);
290 static inline void tcg_gen_ori_i32(TCGv ret, TCGv arg1, int32_t arg2)
292 /* some cases can be optimized here */
293 if (arg2 == 0xffffffff) {
294 tcg_gen_movi_i32(ret, 0);
295 } else if (arg2 == 0) {
296 tcg_gen_mov_i32(ret, arg1);
297 } else {
298 tcg_gen_or_i32(ret, arg1, tcg_const_i32(arg2));
302 static inline void tcg_gen_xor_i32(TCGv ret, TCGv arg1, TCGv arg2)
304 tcg_gen_op3(INDEX_op_xor_i32, ret, arg1, arg2);
307 static inline void tcg_gen_xori_i32(TCGv ret, TCGv arg1, int32_t arg2)
309 /* some cases can be optimized here */
310 if (arg2 == 0) {
311 tcg_gen_mov_i32(ret, arg1);
312 } else {
313 tcg_gen_xor_i32(ret, arg1, tcg_const_i32(arg2));
317 static inline void tcg_gen_shl_i32(TCGv ret, TCGv arg1, TCGv arg2)
319 tcg_gen_op3(INDEX_op_shl_i32, ret, arg1, arg2);
322 static inline void tcg_gen_shli_i32(TCGv ret, TCGv arg1, int32_t arg2)
324 tcg_gen_shl_i32(ret, arg1, tcg_const_i32(arg2));
327 static inline void tcg_gen_shr_i32(TCGv ret, TCGv arg1, TCGv arg2)
329 tcg_gen_op3(INDEX_op_shr_i32, ret, arg1, arg2);
332 static inline void tcg_gen_shri_i32(TCGv ret, TCGv arg1, int32_t arg2)
334 tcg_gen_shr_i32(ret, arg1, tcg_const_i32(arg2));
337 static inline void tcg_gen_sar_i32(TCGv ret, TCGv arg1, TCGv arg2)
339 tcg_gen_op3(INDEX_op_sar_i32, ret, arg1, arg2);
342 static inline void tcg_gen_sari_i32(TCGv ret, TCGv arg1, int32_t arg2)
344 tcg_gen_sar_i32(ret, arg1, tcg_const_i32(arg2));
347 static inline void tcg_gen_brcond_i32(int cond, TCGv arg1, TCGv arg2,
348 int label_index)
350 tcg_gen_op4ii(INDEX_op_brcond_i32, arg1, arg2, cond, label_index);
353 static inline void tcg_gen_mul_i32(TCGv ret, TCGv arg1, TCGv arg2)
355 tcg_gen_op3(INDEX_op_mul_i32, ret, arg1, arg2);
358 #ifdef TCG_TARGET_HAS_div_i32
359 static inline void tcg_gen_div_i32(TCGv ret, TCGv arg1, TCGv arg2)
361 tcg_gen_op3(INDEX_op_div_i32, ret, arg1, arg2);
364 static inline void tcg_gen_rem_i32(TCGv ret, TCGv arg1, TCGv arg2)
366 tcg_gen_op3(INDEX_op_rem_i32, ret, arg1, arg2);
369 static inline void tcg_gen_divu_i32(TCGv ret, TCGv arg1, TCGv arg2)
371 tcg_gen_op3(INDEX_op_divu_i32, ret, arg1, arg2);
374 static inline void tcg_gen_remu_i32(TCGv ret, TCGv arg1, TCGv arg2)
376 tcg_gen_op3(INDEX_op_remu_i32, ret, arg1, arg2);
378 #else
379 static inline void tcg_gen_div_i32(TCGv ret, TCGv arg1, TCGv arg2)
381 TCGv t0;
382 t0 = tcg_temp_new(TCG_TYPE_I32);
383 tcg_gen_sari_i32(t0, arg1, 31);
384 tcg_gen_op5(INDEX_op_div2_i32, ret, t0, arg1, t0, arg2);
387 static inline void tcg_gen_rem_i32(TCGv ret, TCGv arg1, TCGv arg2)
389 TCGv t0;
390 t0 = tcg_temp_new(TCG_TYPE_I32);
391 tcg_gen_sari_i32(t0, arg1, 31);
392 tcg_gen_op5(INDEX_op_div2_i32, t0, ret, arg1, t0, arg2);
395 static inline void tcg_gen_divu_i32(TCGv ret, TCGv arg1, TCGv arg2)
397 TCGv t0;
398 t0 = tcg_temp_new(TCG_TYPE_I32);
399 tcg_gen_movi_i32(t0, 0);
400 tcg_gen_op5(INDEX_op_divu2_i32, ret, t0, arg1, t0, arg2);
403 static inline void tcg_gen_remu_i32(TCGv ret, TCGv arg1, TCGv arg2)
405 TCGv t0;
406 t0 = tcg_temp_new(TCG_TYPE_I32);
407 tcg_gen_movi_i32(t0, 0);
408 tcg_gen_op5(INDEX_op_divu2_i32, t0, ret, arg1, t0, arg2);
410 #endif
412 #if TCG_TARGET_REG_BITS == 32
414 static inline void tcg_gen_mov_i64(TCGv ret, TCGv arg)
416 tcg_gen_mov_i32(ret, arg);
417 tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
420 static inline void tcg_gen_movi_i64(TCGv ret, int64_t arg)
422 tcg_gen_movi_i32(ret, arg);
423 tcg_gen_movi_i32(TCGV_HIGH(ret), arg >> 32);
426 static inline void tcg_gen_ld8u_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
428 tcg_gen_ld8u_i32(ret, arg2, offset);
429 tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
432 static inline void tcg_gen_ld8s_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
434 tcg_gen_ld8s_i32(ret, arg2, offset);
435 tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
438 static inline void tcg_gen_ld16u_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
440 tcg_gen_ld16u_i32(ret, arg2, offset);
441 tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
444 static inline void tcg_gen_ld16s_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
446 tcg_gen_ld16s_i32(ret, arg2, offset);
447 tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
450 static inline void tcg_gen_ld32u_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
452 tcg_gen_ld_i32(ret, arg2, offset);
453 tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
456 static inline void tcg_gen_ld32s_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
458 tcg_gen_ld_i32(ret, arg2, offset);
459 tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
462 static inline void tcg_gen_ld_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
464 /* since arg2 and ret have different types, they cannot be the
465 same temporary */
466 #ifdef TCG_TARGET_WORDS_BIGENDIAN
467 tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset);
468 tcg_gen_ld_i32(ret, arg2, offset + 4);
469 #else
470 tcg_gen_ld_i32(ret, arg2, offset);
471 tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset + 4);
472 #endif
475 static inline void tcg_gen_st8_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
477 tcg_gen_st8_i32(arg1, arg2, offset);
480 static inline void tcg_gen_st16_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
482 tcg_gen_st16_i32(arg1, arg2, offset);
485 static inline void tcg_gen_st32_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
487 tcg_gen_st_i32(arg1, arg2, offset);
490 static inline void tcg_gen_st_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
492 #ifdef TCG_TARGET_WORDS_BIGENDIAN
493 tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset);
494 tcg_gen_st_i32(arg1, arg2, offset + 4);
495 #else
496 tcg_gen_st_i32(arg1, arg2, offset);
497 tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset + 4);
498 #endif
501 static inline void tcg_gen_add_i64(TCGv ret, TCGv arg1, TCGv arg2)
503 tcg_gen_op6(INDEX_op_add2_i32, ret, TCGV_HIGH(ret),
504 arg1, TCGV_HIGH(arg1), arg2, TCGV_HIGH(arg2));
507 static inline void tcg_gen_addi_i64(TCGv ret, TCGv arg1, int64_t arg2)
509 tcg_gen_add_i64(ret, arg1, tcg_const_i64(arg2));
512 static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2)
514 tcg_gen_op6(INDEX_op_sub2_i32, ret, TCGV_HIGH(ret),
515 arg1, TCGV_HIGH(arg1), arg2, TCGV_HIGH(arg2));
518 static inline void tcg_gen_subi_i64(TCGv ret, TCGv arg1, int64_t arg2)
520 tcg_gen_sub_i64(ret, arg1, tcg_const_i64(arg2));
523 static inline void tcg_gen_and_i64(TCGv ret, TCGv arg1, TCGv arg2)
525 tcg_gen_and_i32(ret, arg1, arg2);
526 tcg_gen_and_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2));
529 static inline void tcg_gen_andi_i64(TCGv ret, TCGv arg1, int64_t arg2)
531 tcg_gen_andi_i32(ret, arg1, arg2);
532 tcg_gen_andi_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), arg2 >> 32);
535 static inline void tcg_gen_or_i64(TCGv ret, TCGv arg1, TCGv arg2)
537 tcg_gen_or_i32(ret, arg1, arg2);
538 tcg_gen_or_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2));
541 static inline void tcg_gen_ori_i64(TCGv ret, TCGv arg1, int64_t arg2)
543 tcg_gen_ori_i32(ret, arg1, arg2);
544 tcg_gen_ori_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), arg2 >> 32);
547 static inline void tcg_gen_xor_i64(TCGv ret, TCGv arg1, TCGv arg2)
549 tcg_gen_xor_i32(ret, arg1, arg2);
550 tcg_gen_xor_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2));
553 static inline void tcg_gen_xori_i64(TCGv ret, TCGv arg1, int64_t arg2)
555 tcg_gen_xori_i32(ret, arg1, arg2);
556 tcg_gen_xori_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), arg2 >> 32);
559 /* XXX: use generic code when basic block handling is OK or CPU
560 specific code (x86) */
561 static inline void tcg_gen_shl_i64(TCGv ret, TCGv arg1, TCGv arg2)
563 tcg_gen_helper_1_2(tcg_helper_shl_i64, ret, arg1, arg2);
566 static inline void tcg_gen_shli_i64(TCGv ret, TCGv arg1, int64_t arg2)
568 tcg_gen_shifti_i64(ret, arg1, arg2, 0, 0);
571 static inline void tcg_gen_shr_i64(TCGv ret, TCGv arg1, TCGv arg2)
573 tcg_gen_helper_1_2(tcg_helper_shr_i64, ret, arg1, arg2);
576 static inline void tcg_gen_shri_i64(TCGv ret, TCGv arg1, int64_t arg2)
578 tcg_gen_shifti_i64(ret, arg1, arg2, 1, 0);
581 static inline void tcg_gen_sar_i64(TCGv ret, TCGv arg1, TCGv arg2)
583 tcg_gen_helper_1_2(tcg_helper_sar_i64, ret, arg1, arg2);
586 static inline void tcg_gen_sari_i64(TCGv ret, TCGv arg1, int64_t arg2)
588 tcg_gen_shifti_i64(ret, arg1, arg2, 1, 1);
591 static inline void tcg_gen_brcond_i64(int cond, TCGv arg1, TCGv arg2,
592 int label_index)
594 tcg_gen_op6ii(INDEX_op_brcond2_i32,
595 arg1, TCGV_HIGH(arg1), arg2, TCGV_HIGH(arg2),
596 cond, label_index);
599 static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2)
601 TCGv t0, t1;
603 t0 = tcg_temp_new(TCG_TYPE_I64);
604 t1 = tcg_temp_new(TCG_TYPE_I32);
606 tcg_gen_op4(INDEX_op_mulu2_i32, t0, TCGV_HIGH(t0), arg1, arg2);
608 tcg_gen_mul_i32(t1, arg1, TCGV_HIGH(arg2));
609 tcg_gen_add_i32(TCGV_HIGH(t0), TCGV_HIGH(t0), t1);
610 tcg_gen_mul_i32(t1, TCGV_HIGH(arg1), arg2);
611 tcg_gen_add_i32(TCGV_HIGH(t0), TCGV_HIGH(t0), t1);
613 tcg_gen_mov_i64(ret, t0);
616 static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
618 tcg_gen_helper_1_2(tcg_helper_div_i64, ret, arg1, arg2);
621 static inline void tcg_gen_rem_i64(TCGv ret, TCGv arg1, TCGv arg2)
623 tcg_gen_helper_1_2(tcg_helper_rem_i64, ret, arg1, arg2);
626 static inline void tcg_gen_divu_i64(TCGv ret, TCGv arg1, TCGv arg2)
628 tcg_gen_helper_1_2(tcg_helper_divu_i64, ret, arg1, arg2);
631 static inline void tcg_gen_remu_i64(TCGv ret, TCGv arg1, TCGv arg2)
633 tcg_gen_helper_1_2(tcg_helper_remu_i64, ret, arg1, arg2);
636 #else
638 static inline void tcg_gen_mov_i64(TCGv ret, TCGv arg)
640 tcg_gen_op2(INDEX_op_mov_i64, ret, arg);
643 static inline void tcg_gen_movi_i64(TCGv ret, int64_t arg)
645 tcg_gen_op2i(INDEX_op_movi_i64, ret, arg);
648 static inline void tcg_gen_ld8u_i64(TCGv ret, TCGv arg2,
649 tcg_target_long offset)
651 tcg_gen_op3i(INDEX_op_ld8u_i64, ret, arg2, offset);
654 static inline void tcg_gen_ld8s_i64(TCGv ret, TCGv arg2,
655 tcg_target_long offset)
657 tcg_gen_op3i(INDEX_op_ld8s_i64, ret, arg2, offset);
660 static inline void tcg_gen_ld16u_i64(TCGv ret, TCGv arg2,
661 tcg_target_long offset)
663 tcg_gen_op3i(INDEX_op_ld16u_i64, ret, arg2, offset);
666 static inline void tcg_gen_ld16s_i64(TCGv ret, TCGv arg2,
667 tcg_target_long offset)
669 tcg_gen_op3i(INDEX_op_ld16s_i64, ret, arg2, offset);
672 static inline void tcg_gen_ld32u_i64(TCGv ret, TCGv arg2,
673 tcg_target_long offset)
675 tcg_gen_op3i(INDEX_op_ld32u_i64, ret, arg2, offset);
678 static inline void tcg_gen_ld32s_i64(TCGv ret, TCGv arg2,
679 tcg_target_long offset)
681 tcg_gen_op3i(INDEX_op_ld32s_i64, ret, arg2, offset);
684 static inline void tcg_gen_ld_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
686 tcg_gen_op3i(INDEX_op_ld_i64, ret, arg2, offset);
689 static inline void tcg_gen_st8_i64(TCGv arg1, TCGv arg2,
690 tcg_target_long offset)
692 tcg_gen_op3i(INDEX_op_st8_i64, arg1, arg2, offset);
695 static inline void tcg_gen_st16_i64(TCGv arg1, TCGv arg2,
696 tcg_target_long offset)
698 tcg_gen_op3i(INDEX_op_st16_i64, arg1, arg2, offset);
701 static inline void tcg_gen_st32_i64(TCGv arg1, TCGv arg2,
702 tcg_target_long offset)
704 tcg_gen_op3i(INDEX_op_st32_i64, arg1, arg2, offset);
707 static inline void tcg_gen_st_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
709 tcg_gen_op3i(INDEX_op_st_i64, arg1, arg2, offset);
712 static inline void tcg_gen_add_i64(TCGv ret, TCGv arg1, TCGv arg2)
714 tcg_gen_op3(INDEX_op_add_i64, ret, arg1, arg2);
717 static inline void tcg_gen_addi_i64(TCGv ret, TCGv arg1, int64_t arg2)
719 tcg_gen_add_i64(ret, arg1, tcg_const_i64(arg2));
722 static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2)
724 tcg_gen_op3(INDEX_op_sub_i64, ret, arg1, arg2);
727 static inline void tcg_gen_subi_i64(TCGv ret, TCGv arg1, int64_t arg2)
729 tcg_gen_sub_i64(ret, arg1, tcg_const_i64(arg2));
732 static inline void tcg_gen_and_i64(TCGv ret, TCGv arg1, TCGv arg2)
734 tcg_gen_op3(INDEX_op_and_i64, ret, arg1, arg2);
737 static inline void tcg_gen_andi_i64(TCGv ret, TCGv arg1, int64_t arg2)
739 tcg_gen_and_i64(ret, arg1, tcg_const_i64(arg2));
742 static inline void tcg_gen_or_i64(TCGv ret, TCGv arg1, TCGv arg2)
744 tcg_gen_op3(INDEX_op_or_i64, ret, arg1, arg2);
747 static inline void tcg_gen_ori_i64(TCGv ret, TCGv arg1, int64_t arg2)
749 tcg_gen_or_i64(ret, arg1, tcg_const_i64(arg2));
752 static inline void tcg_gen_xor_i64(TCGv ret, TCGv arg1, TCGv arg2)
754 tcg_gen_op3(INDEX_op_xor_i64, ret, arg1, arg2);
757 static inline void tcg_gen_xori_i64(TCGv ret, TCGv arg1, int64_t arg2)
759 tcg_gen_xor_i64(ret, arg1, tcg_const_i64(arg2));
762 static inline void tcg_gen_shl_i64(TCGv ret, TCGv arg1, TCGv arg2)
764 tcg_gen_op3(INDEX_op_shl_i64, ret, arg1, arg2);
767 static inline void tcg_gen_shli_i64(TCGv ret, TCGv arg1, int64_t arg2)
769 tcg_gen_shl_i64(ret, arg1, tcg_const_i64(arg2));
772 static inline void tcg_gen_shr_i64(TCGv ret, TCGv arg1, TCGv arg2)
774 tcg_gen_op3(INDEX_op_shr_i64, ret, arg1, arg2);
777 static inline void tcg_gen_shri_i64(TCGv ret, TCGv arg1, int64_t arg2)
779 tcg_gen_shr_i64(ret, arg1, tcg_const_i64(arg2));
782 static inline void tcg_gen_sar_i64(TCGv ret, TCGv arg1, TCGv arg2)
784 tcg_gen_op3(INDEX_op_sar_i64, ret, arg1, arg2);
787 static inline void tcg_gen_sari_i64(TCGv ret, TCGv arg1, int64_t arg2)
789 tcg_gen_sar_i64(ret, arg1, tcg_const_i64(arg2));
792 static inline void tcg_gen_brcond_i64(int cond, TCGv arg1, TCGv arg2,
793 int label_index)
795 tcg_gen_op4ii(INDEX_op_brcond_i64, arg1, arg2, cond, label_index);
798 static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2)
800 tcg_gen_op3(INDEX_op_mul_i64, ret, arg1, arg2);
803 #ifdef TCG_TARGET_HAS_div_i64
804 static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
806 tcg_gen_op3(INDEX_op_div_i64, ret, arg1, arg2);
809 static inline void tcg_gen_rem_i64(TCGv ret, TCGv arg1, TCGv arg2)
811 tcg_gen_op3(INDEX_op_rem_i64, ret, arg1, arg2);
814 static inline void tcg_gen_divu_i64(TCGv ret, TCGv arg1, TCGv arg2)
816 tcg_gen_op3(INDEX_op_divu_i64, ret, arg1, arg2);
819 static inline void tcg_gen_remu_i64(TCGv ret, TCGv arg1, TCGv arg2)
821 tcg_gen_op3(INDEX_op_remu_i64, ret, arg1, arg2);
823 #else
824 static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
826 TCGv t0;
827 t0 = tcg_temp_new(TCG_TYPE_I64);
828 tcg_gen_sari_i64(t0, arg1, 63);
829 tcg_gen_op5(INDEX_op_div2_i64, ret, t0, arg1, t0, arg2);
832 static inline void tcg_gen_rem_i64(TCGv ret, TCGv arg1, TCGv arg2)
834 TCGv t0;
835 t0 = tcg_temp_new(TCG_TYPE_I64);
836 tcg_gen_sari_i64(t0, arg1, 63);
837 tcg_gen_op5(INDEX_op_div2_i64, t0, ret, arg1, t0, arg2);
840 static inline void tcg_gen_divu_i64(TCGv ret, TCGv arg1, TCGv arg2)
842 TCGv t0;
843 t0 = tcg_temp_new(TCG_TYPE_I64);
844 tcg_gen_movi_i64(t0, 0);
845 tcg_gen_op5(INDEX_op_divu2_i64, ret, t0, arg1, t0, arg2);
848 static inline void tcg_gen_remu_i64(TCGv ret, TCGv arg1, TCGv arg2)
850 TCGv t0;
851 t0 = tcg_temp_new(TCG_TYPE_I64);
852 tcg_gen_movi_i64(t0, 0);
853 tcg_gen_op5(INDEX_op_divu2_i64, t0, ret, arg1, t0, arg2);
855 #endif
857 #endif
859 /***************************************/
860 /* optional operations */
862 static inline void tcg_gen_ext8s_i32(TCGv ret, TCGv arg)
864 #ifdef TCG_TARGET_HAS_ext8s_i32
865 tcg_gen_op2(INDEX_op_ext8s_i32, ret, arg);
866 #else
867 tcg_gen_shli_i32(ret, arg, 24);
868 tcg_gen_sari_i32(ret, ret, 24);
869 #endif
872 static inline void tcg_gen_ext16s_i32(TCGv ret, TCGv arg)
874 #ifdef TCG_TARGET_HAS_ext16s_i32
875 tcg_gen_op2(INDEX_op_ext16s_i32, ret, arg);
876 #else
877 tcg_gen_shli_i32(ret, arg, 16);
878 tcg_gen_sari_i32(ret, ret, 16);
879 #endif
882 /* Note: we assume the two high bytes are set to zero */
883 static inline void tcg_gen_bswap16_i32(TCGv ret, TCGv arg)
885 #ifdef TCG_TARGET_HAS_bswap16_i32
886 tcg_gen_op2(INDEX_op_bswap16_i32, ret, arg);
887 #else
888 TCGv t0, t1;
889 t0 = tcg_temp_new(TCG_TYPE_I32);
890 t1 = tcg_temp_new(TCG_TYPE_I32);
892 tcg_gen_shri_i32(t0, arg, 8);
893 tcg_gen_andi_i32(t1, arg, 0x000000ff);
894 tcg_gen_shli_i32(t1, t1, 8);
895 tcg_gen_or_i32(ret, t0, t1);
896 #endif
899 static inline void tcg_gen_bswap_i32(TCGv ret, TCGv arg)
901 #ifdef TCG_TARGET_HAS_bswap_i32
902 tcg_gen_op2(INDEX_op_bswap_i32, ret, arg);
903 #else
904 TCGv t0, t1;
905 t0 = tcg_temp_new(TCG_TYPE_I32);
906 t1 = tcg_temp_new(TCG_TYPE_I32);
908 tcg_gen_shli_i32(t0, arg, 24);
910 tcg_gen_andi_i32(t1, arg, 0x0000ff00);
911 tcg_gen_shli_i32(t1, t1, 8);
912 tcg_gen_or_i32(t0, t0, t1);
914 tcg_gen_shri_i32(t1, arg, 8);
915 tcg_gen_andi_i32(t1, t1, 0x0000ff00);
916 tcg_gen_or_i32(t0, t0, t1);
918 tcg_gen_shri_i32(t1, arg, 24);
919 tcg_gen_or_i32(ret, t0, t1);
920 #endif
923 #if TCG_TARGET_REG_BITS == 32
924 static inline void tcg_gen_ext8s_i64(TCGv ret, TCGv arg)
926 tcg_gen_ext8s_i32(ret, arg);
927 tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
930 static inline void tcg_gen_ext16s_i64(TCGv ret, TCGv arg)
932 tcg_gen_ext16s_i32(ret, arg);
933 tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
936 static inline void tcg_gen_ext32s_i64(TCGv ret, TCGv arg)
938 tcg_gen_mov_i32(ret, arg);
939 tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
942 static inline void tcg_gen_trunc_i64_i32(TCGv ret, TCGv arg)
944 tcg_gen_mov_i32(ret, arg);
947 static inline void tcg_gen_extu_i32_i64(TCGv ret, TCGv arg)
949 tcg_gen_mov_i32(ret, arg);
950 tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
953 static inline void tcg_gen_ext_i32_i64(TCGv ret, TCGv arg)
955 tcg_gen_mov_i32(ret, arg);
956 tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
959 static inline void tcg_gen_bswap_i64(TCGv ret, TCGv arg)
961 TCGv t0, t1;
962 t0 = tcg_temp_new(TCG_TYPE_I32);
963 t1 = tcg_temp_new(TCG_TYPE_I32);
965 tcg_gen_bswap_i32(t0, arg);
966 tcg_gen_bswap_i32(t1, TCGV_HIGH(arg));
967 tcg_gen_mov_i32(ret, t1);
968 tcg_gen_mov_i32(TCGV_HIGH(ret), t0);
970 #else
972 static inline void tcg_gen_ext8s_i64(TCGv ret, TCGv arg)
974 #ifdef TCG_TARGET_HAS_ext8s_i64
975 tcg_gen_op2(INDEX_op_ext8s_i64, ret, arg);
976 #else
977 tcg_gen_shli_i64(ret, arg, 56);
978 tcg_gen_sari_i64(ret, ret, 56);
979 #endif
982 static inline void tcg_gen_ext16s_i64(TCGv ret, TCGv arg)
984 #ifdef TCG_TARGET_HAS_ext16s_i64
985 tcg_gen_op2(INDEX_op_ext16s_i64, ret, arg);
986 #else
987 tcg_gen_shli_i64(ret, arg, 48);
988 tcg_gen_sari_i64(ret, ret, 48);
989 #endif
992 static inline void tcg_gen_ext32s_i64(TCGv ret, TCGv arg)
994 #ifdef TCG_TARGET_HAS_ext32s_i64
995 tcg_gen_op2(INDEX_op_ext32s_i64, ret, arg);
996 #else
997 tcg_gen_shli_i64(ret, arg, 32);
998 tcg_gen_sari_i64(ret, ret, 32);
999 #endif
1002 /* Note: we assume the target supports move between 32 and 64 bit
1003 registers. This will probably break MIPS64 targets. */
1004 static inline void tcg_gen_trunc_i64_i32(TCGv ret, TCGv arg)
1006 tcg_gen_mov_i32(ret, arg);
1009 /* Note: we assume the target supports move between 32 and 64 bit
1010 registers */
1011 static inline void tcg_gen_extu_i32_i64(TCGv ret, TCGv arg)
1013 tcg_gen_andi_i64(ret, arg, 0xffffffff);
1016 /* Note: we assume the target supports move between 32 and 64 bit
1017 registers */
1018 static inline void tcg_gen_ext_i32_i64(TCGv ret, TCGv arg)
1020 tcg_gen_ext32s_i64(ret, arg);
1023 static inline void tcg_gen_bswap_i64(TCGv ret, TCGv arg)
1025 #ifdef TCG_TARGET_HAS_bswap_i64
1026 tcg_gen_op2(INDEX_op_bswap_i64, ret, arg);
1027 #else
1028 TCGv t0, t1;
1029 t0 = tcg_temp_new(TCG_TYPE_I32);
1030 t1 = tcg_temp_new(TCG_TYPE_I32);
1032 tcg_gen_shli_i64(t0, arg, 56);
1034 tcg_gen_andi_i64(t1, arg, 0x0000ff00);
1035 tcg_gen_shli_i64(t1, t1, 40);
1036 tcg_gen_or_i64(t0, t0, t1);
1038 tcg_gen_andi_i64(t1, arg, 0x00ff0000);
1039 tcg_gen_shli_i64(t1, t1, 24);
1040 tcg_gen_or_i64(t0, t0, t1);
1042 tcg_gen_andi_i64(t1, arg, 0xff000000);
1043 tcg_gen_shli_i64(t1, t1, 8);
1044 tcg_gen_or_i64(t0, t0, t1);
1046 tcg_gen_shri_i64(t1, arg, 8);
1047 tcg_gen_andi_i64(t1, t1, 0xff000000);
1048 tcg_gen_or_i64(t0, t0, t1);
1050 tcg_gen_shri_i64(t1, arg, 24);
1051 tcg_gen_andi_i64(t1, t1, 0x00ff0000);
1052 tcg_gen_or_i64(t0, t0, t1);
1054 tcg_gen_shri_i64(t1, arg, 40);
1055 tcg_gen_andi_i64(t1, t1, 0x0000ff00);
1056 tcg_gen_or_i64(t0, t0, t1);
1058 tcg_gen_shri_i64(t1, arg, 56);
1059 tcg_gen_or_i64(ret, t0, t1);
1060 #endif
1063 #endif
1066 static inline void tcg_gen_discard_i32(TCGv arg)
1068 tcg_gen_op1(INDEX_op_discard, arg);
1071 #if TCG_TARGET_REG_BITS == 32
1072 static inline void tcg_gen_discard_i64(TCGv arg)
1074 tcg_gen_discard_i32(arg);
1075 tcg_gen_discard_i32(TCGV_HIGH(arg));
1077 #else
1078 static inline void tcg_gen_discard_i64(TCGv arg)
1080 tcg_gen_op1(INDEX_op_discard, arg);
1082 #endif
1084 /***************************************/
1085 static inline void tcg_gen_macro_2(TCGv ret0, TCGv ret1, int macro_id)
1087 tcg_gen_op3i(INDEX_op_macro_2, ret0, ret1, macro_id);
1090 /***************************************/
1091 /* QEMU specific operations. Their type depend on the QEMU CPU
1092 type. */
1093 #ifndef TARGET_LONG_BITS
1094 #error must include QEMU headers
1095 #endif
1097 static inline void tcg_gen_exit_tb(tcg_target_long val)
1099 tcg_gen_op1i(INDEX_op_exit_tb, val);
1102 static inline void tcg_gen_goto_tb(int idx)
1104 tcg_gen_op1i(INDEX_op_goto_tb, idx);
1107 #if TCG_TARGET_REG_BITS == 32
1108 static inline void tcg_gen_qemu_ld8u(TCGv ret, TCGv addr, int mem_index)
1110 #if TARGET_LONG_BITS == 32
1111 tcg_gen_op3i(INDEX_op_qemu_ld8u, ret, addr, mem_index);
1112 #else
1113 tcg_gen_op4i(INDEX_op_qemu_ld8u, ret, addr, TCGV_HIGH(addr), mem_index);
1114 tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
1115 #endif
1118 static inline void tcg_gen_qemu_ld8s(TCGv ret, TCGv addr, int mem_index)
1120 #if TARGET_LONG_BITS == 32
1121 tcg_gen_op3i(INDEX_op_qemu_ld8s, ret, addr, mem_index);
1122 #else
1123 tcg_gen_op4i(INDEX_op_qemu_ld8s, ret, addr, TCGV_HIGH(addr), mem_index);
1124 tcg_gen_ext8s_i32(TCGV_HIGH(ret), ret);
1125 #endif
1128 static inline void tcg_gen_qemu_ld16u(TCGv ret, TCGv addr, int mem_index)
1130 #if TARGET_LONG_BITS == 32
1131 tcg_gen_op3i(INDEX_op_qemu_ld16u, ret, addr, mem_index);
1132 #else
1133 tcg_gen_op4i(INDEX_op_qemu_ld16u, ret, addr, TCGV_HIGH(addr), mem_index);
1134 tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
1135 #endif
1138 static inline void tcg_gen_qemu_ld16s(TCGv ret, TCGv addr, int mem_index)
1140 #if TARGET_LONG_BITS == 32
1141 tcg_gen_op3i(INDEX_op_qemu_ld16s, ret, addr, mem_index);
1142 #else
1143 tcg_gen_op4i(INDEX_op_qemu_ld16s, ret, addr, TCGV_HIGH(addr), mem_index);
1144 tcg_gen_ext16s_i32(TCGV_HIGH(ret), ret);
1145 #endif
1148 static inline void tcg_gen_qemu_ld32u(TCGv ret, TCGv addr, int mem_index)
1150 #if TARGET_LONG_BITS == 32
1151 tcg_gen_op3i(INDEX_op_qemu_ld32u, ret, addr, mem_index);
1152 #else
1153 tcg_gen_op4i(INDEX_op_qemu_ld32u, ret, addr, TCGV_HIGH(addr), mem_index);
1154 tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
1155 #endif
1158 static inline void tcg_gen_qemu_ld32s(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);
1162 #else
1163 tcg_gen_op4i(INDEX_op_qemu_ld32u, ret, addr, TCGV_HIGH(addr), mem_index);
1164 tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
1165 #endif
1168 static inline void tcg_gen_qemu_ld64(TCGv ret, TCGv addr, int mem_index)
1170 #if TARGET_LONG_BITS == 32
1171 tcg_gen_op4i(INDEX_op_qemu_ld64, ret, TCGV_HIGH(ret), addr, mem_index);
1172 #else
1173 tcg_gen_op5i(INDEX_op_qemu_ld64, ret, TCGV_HIGH(ret),
1174 addr, TCGV_HIGH(addr), mem_index);
1175 #endif
1178 static inline void tcg_gen_qemu_st8(TCGv arg, TCGv addr, int mem_index)
1180 #if TARGET_LONG_BITS == 32
1181 tcg_gen_op3i(INDEX_op_qemu_st8, arg, addr, mem_index);
1182 #else
1183 tcg_gen_op4i(INDEX_op_qemu_st8, arg, addr, TCGV_HIGH(addr), mem_index);
1184 #endif
1187 static inline void tcg_gen_qemu_st16(TCGv arg, TCGv addr, int mem_index)
1189 #if TARGET_LONG_BITS == 32
1190 tcg_gen_op3i(INDEX_op_qemu_st16, arg, addr, mem_index);
1191 #else
1192 tcg_gen_op4i(INDEX_op_qemu_st16, arg, addr, TCGV_HIGH(addr), mem_index);
1193 #endif
1196 static inline void tcg_gen_qemu_st32(TCGv arg, TCGv addr, int mem_index)
1198 #if TARGET_LONG_BITS == 32
1199 tcg_gen_op3i(INDEX_op_qemu_st32, arg, addr, mem_index);
1200 #else
1201 tcg_gen_op4i(INDEX_op_qemu_st32, arg, addr, TCGV_HIGH(addr), mem_index);
1202 #endif
1205 static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index)
1207 #if TARGET_LONG_BITS == 32
1208 tcg_gen_op4i(INDEX_op_qemu_st64, arg, TCGV_HIGH(arg), addr, mem_index);
1209 #else
1210 tcg_gen_op5i(INDEX_op_qemu_st64, arg, TCGV_HIGH(arg),
1211 addr, TCGV_HIGH(addr), mem_index);
1212 #endif
1215 #else /* TCG_TARGET_REG_BITS == 32 */
1217 static inline void tcg_gen_qemu_ld8u(TCGv ret, TCGv addr, int mem_index)
1219 tcg_gen_op3i(INDEX_op_qemu_ld8u, ret, addr, mem_index);
1222 static inline void tcg_gen_qemu_ld8s(TCGv ret, TCGv addr, int mem_index)
1224 tcg_gen_op3i(INDEX_op_qemu_ld8s, ret, addr, mem_index);
1227 static inline void tcg_gen_qemu_ld16u(TCGv ret, TCGv addr, int mem_index)
1229 tcg_gen_op3i(INDEX_op_qemu_ld16u, ret, addr, mem_index);
1232 static inline void tcg_gen_qemu_ld16s(TCGv ret, TCGv addr, int mem_index)
1234 tcg_gen_op3i(INDEX_op_qemu_ld16s, ret, addr, mem_index);
1237 static inline void tcg_gen_qemu_ld32u(TCGv ret, TCGv addr, int mem_index)
1239 tcg_gen_op3i(INDEX_op_qemu_ld32u, ret, addr, mem_index);
1242 static inline void tcg_gen_qemu_ld32s(TCGv ret, TCGv addr, int mem_index)
1244 tcg_gen_op3i(INDEX_op_qemu_ld32s, ret, addr, mem_index);
1247 static inline void tcg_gen_qemu_ld64(TCGv ret, TCGv addr, int mem_index)
1249 tcg_gen_op3i(INDEX_op_qemu_ld64, ret, addr, mem_index);
1252 static inline void tcg_gen_qemu_st8(TCGv arg, TCGv addr, int mem_index)
1254 tcg_gen_op3i(INDEX_op_qemu_st8, arg, addr, mem_index);
1257 static inline void tcg_gen_qemu_st16(TCGv arg, TCGv addr, int mem_index)
1259 tcg_gen_op3i(INDEX_op_qemu_st16, arg, addr, mem_index);
1262 static inline void tcg_gen_qemu_st32(TCGv arg, TCGv addr, int mem_index)
1264 tcg_gen_op3i(INDEX_op_qemu_st32, arg, addr, mem_index);
1267 static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index)
1269 tcg_gen_op3i(INDEX_op_qemu_st64, arg, addr, mem_index);
1272 #endif /* TCG_TARGET_REG_BITS != 32 */