xref: /qemu/include/tcg/tcg-op-common.h (revision e0de2f55)
1ad3d0e4dSRichard Henderson /* SPDX-License-Identifier: MIT */
2ad3d0e4dSRichard Henderson /*
3ad3d0e4dSRichard Henderson  * Target independent opcode generation functions.
4ad3d0e4dSRichard Henderson  *
5ad3d0e4dSRichard Henderson  * Copyright (c) 2008 Fabrice Bellard
6ad3d0e4dSRichard Henderson  */
7ad3d0e4dSRichard Henderson 
8ad3d0e4dSRichard Henderson #ifndef TCG_TCG_OP_COMMON_H
9ad3d0e4dSRichard Henderson #define TCG_TCG_OP_COMMON_H
10ad3d0e4dSRichard Henderson 
11ad3d0e4dSRichard Henderson #include "tcg/tcg.h"
12c213ee2dSRichard Henderson #include "exec/helper-proto-common.h"
13e4eff8e4SRichard Henderson #include "exec/helper-gen-common.h"
14ad3d0e4dSRichard Henderson 
15ad3d0e4dSRichard Henderson /* Basic output routines.  Not for general consumption.  */
16ad3d0e4dSRichard Henderson 
17ad3d0e4dSRichard Henderson void tcg_gen_op1(TCGOpcode, TCGArg);
18ad3d0e4dSRichard Henderson void tcg_gen_op2(TCGOpcode, TCGArg, TCGArg);
19ad3d0e4dSRichard Henderson void tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg);
20ad3d0e4dSRichard Henderson void tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg);
21ad3d0e4dSRichard Henderson void tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
22ad3d0e4dSRichard Henderson void tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
23ad3d0e4dSRichard Henderson 
24ad3d0e4dSRichard Henderson void vec_gen_2(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg);
25ad3d0e4dSRichard Henderson void vec_gen_3(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg);
26ad3d0e4dSRichard Henderson void vec_gen_4(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg, TCGArg);
27ad3d0e4dSRichard Henderson 
286fc75d50SRichard Henderson void tcg_gen_op1_i32(TCGOpcode, TCGv_i32);
296fc75d50SRichard Henderson void tcg_gen_op1_i64(TCGOpcode, TCGv_i64);
306fc75d50SRichard Henderson void tcg_gen_op1i(TCGOpcode, TCGArg);
316fc75d50SRichard Henderson void tcg_gen_op2_i32(TCGOpcode, TCGv_i32, TCGv_i32);
326fc75d50SRichard Henderson void tcg_gen_op2_i64(TCGOpcode, TCGv_i64, TCGv_i64);
336fc75d50SRichard Henderson void tcg_gen_op2i_i32(TCGOpcode, TCGv_i32, TCGArg);
346fc75d50SRichard Henderson void tcg_gen_op2i_i64(TCGOpcode, TCGv_i64, TCGArg);
356fc75d50SRichard Henderson void tcg_gen_op2ii(TCGOpcode, TCGArg, TCGArg);
366fc75d50SRichard Henderson void tcg_gen_op3_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32);
376fc75d50SRichard Henderson void tcg_gen_op3_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64);
386fc75d50SRichard Henderson void tcg_gen_op3i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGArg);
396fc75d50SRichard Henderson void tcg_gen_op3i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGArg);
406fc75d50SRichard Henderson void tcg_gen_ldst_op_i32(TCGOpcode, TCGv_i32, TCGv_ptr, TCGArg);
416fc75d50SRichard Henderson void tcg_gen_ldst_op_i64(TCGOpcode, TCGv_i64, TCGv_ptr, TCGArg);
426fc75d50SRichard Henderson void tcg_gen_op4_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, TCGv_i32);
436fc75d50SRichard Henderson void tcg_gen_op4_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64);
446fc75d50SRichard Henderson void tcg_gen_op4i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32, TCGArg);
456fc75d50SRichard Henderson void tcg_gen_op4i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64, TCGArg);
466fc75d50SRichard Henderson void tcg_gen_op4ii_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGArg, TCGArg);
476fc75d50SRichard Henderson void tcg_gen_op4ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGArg, TCGArg);
486fc75d50SRichard Henderson void tcg_gen_op5_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32,
496fc75d50SRichard Henderson                      TCGv_i32, TCGv_i32);
506fc75d50SRichard Henderson void tcg_gen_op5_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64,
516fc75d50SRichard Henderson                      TCGv_i64, TCGv_i64);
526fc75d50SRichard Henderson void tcg_gen_op5i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32,
536fc75d50SRichard Henderson                       TCGv_i32, TCGArg);
546fc75d50SRichard Henderson void tcg_gen_op5i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64,
556fc75d50SRichard Henderson                       TCGv_i64, TCGArg);
566fc75d50SRichard Henderson void tcg_gen_op5ii_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32,
576fc75d50SRichard Henderson                        TCGArg, TCGArg);
586fc75d50SRichard Henderson void tcg_gen_op5ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64,
596fc75d50SRichard Henderson                        TCGArg, TCGArg);
606fc75d50SRichard Henderson void tcg_gen_op6_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32,
616fc75d50SRichard Henderson                      TCGv_i32, TCGv_i32, TCGv_i32);
626fc75d50SRichard Henderson void tcg_gen_op6_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64,
636fc75d50SRichard Henderson                      TCGv_i64, TCGv_i64, TCGv_i64);
646fc75d50SRichard Henderson void tcg_gen_op6i_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32,
656fc75d50SRichard Henderson                       TCGv_i32, TCGv_i32, TCGArg);
666fc75d50SRichard Henderson void tcg_gen_op6i_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64,
676fc75d50SRichard Henderson                       TCGv_i64, TCGv_i64, TCGArg);
686fc75d50SRichard Henderson void tcg_gen_op6ii_i32(TCGOpcode, TCGv_i32, TCGv_i32, TCGv_i32,
696fc75d50SRichard Henderson                        TCGv_i32, TCGArg, TCGArg);
706fc75d50SRichard Henderson void tcg_gen_op6ii_i64(TCGOpcode, TCGv_i64, TCGv_i64, TCGv_i64,
716fc75d50SRichard Henderson                        TCGv_i64, TCGArg, TCGArg);
72ad3d0e4dSRichard Henderson 
73ad3d0e4dSRichard Henderson /* Generic ops.  */
74ad3d0e4dSRichard Henderson 
7501bbb6e3SRichard Henderson void gen_set_label(TCGLabel *l);
76ad3d0e4dSRichard Henderson void tcg_gen_br(TCGLabel *l);
77ad3d0e4dSRichard Henderson void tcg_gen_mb(TCGBar);
78ad3d0e4dSRichard Henderson 
79ad3d0e4dSRichard Henderson /**
80ad3d0e4dSRichard Henderson  * tcg_gen_exit_tb() - output exit_tb TCG operation
81ad3d0e4dSRichard Henderson  * @tb: The TranslationBlock from which we are exiting
82ad3d0e4dSRichard Henderson  * @idx: Direct jump slot index, or exit request
83ad3d0e4dSRichard Henderson  *
84ad3d0e4dSRichard Henderson  * See tcg/README for more info about this TCG operation.
85ad3d0e4dSRichard Henderson  * See also tcg.h and the block comment above TB_EXIT_MASK.
86ad3d0e4dSRichard Henderson  *
87ad3d0e4dSRichard Henderson  * For a normal exit from the TB, back to the main loop, @tb should
88ad3d0e4dSRichard Henderson  * be NULL and @idx should be 0.  Otherwise, @tb should be valid and
89ad3d0e4dSRichard Henderson  * @idx should be one of the TB_EXIT_ values.
90ad3d0e4dSRichard Henderson  */
91ad3d0e4dSRichard Henderson void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx);
92ad3d0e4dSRichard Henderson 
93ad3d0e4dSRichard Henderson /**
94ad3d0e4dSRichard Henderson  * tcg_gen_goto_tb() - output goto_tb TCG operation
95ad3d0e4dSRichard Henderson  * @idx: Direct jump slot index (0 or 1)
96ad3d0e4dSRichard Henderson  *
97ad3d0e4dSRichard Henderson  * See tcg/README for more info about this TCG operation.
98ad3d0e4dSRichard Henderson  *
997893e42dSPhilippe Mathieu-Daudé  * NOTE: In system emulation, direct jumps with goto_tb are only safe within
100ad3d0e4dSRichard Henderson  * the pages this TB resides in because we don't take care of direct jumps when
101ad3d0e4dSRichard Henderson  * address mapping changes, e.g. in tlb_flush(). In user mode, there's only a
102ad3d0e4dSRichard Henderson  * static address translation, so the destination address is always valid, TBs
103ad3d0e4dSRichard Henderson  * are always invalidated properly, and direct jumps are reset when mapping
104ad3d0e4dSRichard Henderson  * changes.
105ad3d0e4dSRichard Henderson  */
106ad3d0e4dSRichard Henderson void tcg_gen_goto_tb(unsigned idx);
107ad3d0e4dSRichard Henderson 
108ad3d0e4dSRichard Henderson /**
109ad3d0e4dSRichard Henderson  * tcg_gen_lookup_and_goto_ptr() - look up the current TB, jump to it if valid
110ad3d0e4dSRichard Henderson  * @addr: Guest address of the target TB
111ad3d0e4dSRichard Henderson  *
112ad3d0e4dSRichard Henderson  * If the TB is not valid, jump to the epilogue.
113ad3d0e4dSRichard Henderson  *
114ad3d0e4dSRichard Henderson  * This operation is optional. If the TCG backend does not implement goto_ptr,
115ad3d0e4dSRichard Henderson  * this op is equivalent to calling tcg_gen_exit_tb() with 0 as the argument.
116ad3d0e4dSRichard Henderson  */
117ad3d0e4dSRichard Henderson void tcg_gen_lookup_and_goto_ptr(void);
118ad3d0e4dSRichard Henderson 
11901bbb6e3SRichard Henderson void tcg_gen_plugin_cb_start(unsigned from, unsigned type, unsigned wr);
12001bbb6e3SRichard Henderson void tcg_gen_plugin_cb_end(void);
121ad3d0e4dSRichard Henderson 
122ad3d0e4dSRichard Henderson /* 32 bit ops */
123ad3d0e4dSRichard Henderson 
124ad3d0e4dSRichard Henderson void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg);
125ad3d0e4dSRichard Henderson void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
126ad3d0e4dSRichard Henderson void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv_i32 arg2);
127ad3d0e4dSRichard Henderson void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
128ad3d0e4dSRichard Henderson void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
129ad3d0e4dSRichard Henderson void tcg_gen_ori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
130ad3d0e4dSRichard Henderson void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
131ad3d0e4dSRichard Henderson void tcg_gen_shli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
132ad3d0e4dSRichard Henderson void tcg_gen_shri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
133ad3d0e4dSRichard Henderson void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
134ad3d0e4dSRichard Henderson void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
135ad3d0e4dSRichard Henderson void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
136ad3d0e4dSRichard Henderson void tcg_gen_rem_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
137ad3d0e4dSRichard Henderson void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
138ad3d0e4dSRichard Henderson void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
139ad3d0e4dSRichard Henderson void tcg_gen_andc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
140ad3d0e4dSRichard Henderson void tcg_gen_eqv_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
141ad3d0e4dSRichard Henderson void tcg_gen_nand_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
142ad3d0e4dSRichard Henderson void tcg_gen_nor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
143ad3d0e4dSRichard Henderson void tcg_gen_orc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
144ad3d0e4dSRichard Henderson void tcg_gen_clz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
145ad3d0e4dSRichard Henderson void tcg_gen_ctz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
146ad3d0e4dSRichard Henderson void tcg_gen_clzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t arg2);
147ad3d0e4dSRichard Henderson void tcg_gen_ctzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t arg2);
148ad3d0e4dSRichard Henderson void tcg_gen_clrsb_i32(TCGv_i32 ret, TCGv_i32 arg);
149ad3d0e4dSRichard Henderson void tcg_gen_ctpop_i32(TCGv_i32 a1, TCGv_i32 a2);
150ad3d0e4dSRichard Henderson void tcg_gen_rotl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
151ad3d0e4dSRichard Henderson void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
152ad3d0e4dSRichard Henderson void tcg_gen_rotr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
153ad3d0e4dSRichard Henderson void tcg_gen_rotri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
154ad3d0e4dSRichard Henderson void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2,
155ad3d0e4dSRichard Henderson                          unsigned int ofs, unsigned int len);
156ad3d0e4dSRichard Henderson void tcg_gen_deposit_z_i32(TCGv_i32 ret, TCGv_i32 arg,
157ad3d0e4dSRichard Henderson                            unsigned int ofs, unsigned int len);
158ad3d0e4dSRichard Henderson void tcg_gen_extract_i32(TCGv_i32 ret, TCGv_i32 arg,
159ad3d0e4dSRichard Henderson                          unsigned int ofs, unsigned int len);
160ad3d0e4dSRichard Henderson void tcg_gen_sextract_i32(TCGv_i32 ret, TCGv_i32 arg,
161ad3d0e4dSRichard Henderson                           unsigned int ofs, unsigned int len);
162ad3d0e4dSRichard Henderson void tcg_gen_extract2_i32(TCGv_i32 ret, TCGv_i32 al, TCGv_i32 ah,
163ad3d0e4dSRichard Henderson                           unsigned int ofs);
164ad3d0e4dSRichard Henderson void tcg_gen_brcond_i32(TCGCond cond, TCGv_i32 arg1, TCGv_i32 arg2, TCGLabel *);
165ad3d0e4dSRichard Henderson void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, int32_t arg2, TCGLabel *);
166ad3d0e4dSRichard Henderson void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret,
167ad3d0e4dSRichard Henderson                          TCGv_i32 arg1, TCGv_i32 arg2);
168ad3d0e4dSRichard Henderson void tcg_gen_setcondi_i32(TCGCond cond, TCGv_i32 ret,
169ad3d0e4dSRichard Henderson                           TCGv_i32 arg1, int32_t arg2);
1703635502dSRichard Henderson void tcg_gen_negsetcond_i32(TCGCond cond, TCGv_i32 ret,
1713635502dSRichard Henderson                             TCGv_i32 arg1, TCGv_i32 arg2);
17293c86ecdSPaolo Bonzini void tcg_gen_negsetcondi_i32(TCGCond cond, TCGv_i32 ret,
17393c86ecdSPaolo Bonzini                              TCGv_i32 arg1, int32_t arg2);
174ad3d0e4dSRichard Henderson void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 c1,
175ad3d0e4dSRichard Henderson                          TCGv_i32 c2, TCGv_i32 v1, TCGv_i32 v2);
176ad3d0e4dSRichard Henderson void tcg_gen_add2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al,
177ad3d0e4dSRichard Henderson                       TCGv_i32 ah, TCGv_i32 bl, TCGv_i32 bh);
178ad3d0e4dSRichard Henderson void tcg_gen_sub2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al,
179ad3d0e4dSRichard Henderson                       TCGv_i32 ah, TCGv_i32 bl, TCGv_i32 bh);
180ad3d0e4dSRichard Henderson void tcg_gen_mulu2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2);
181ad3d0e4dSRichard Henderson void tcg_gen_muls2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2);
182ad3d0e4dSRichard Henderson void tcg_gen_mulsu2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2);
183ad3d0e4dSRichard Henderson void tcg_gen_ext8s_i32(TCGv_i32 ret, TCGv_i32 arg);
184ad3d0e4dSRichard Henderson void tcg_gen_ext16s_i32(TCGv_i32 ret, TCGv_i32 arg);
185ad3d0e4dSRichard Henderson void tcg_gen_ext8u_i32(TCGv_i32 ret, TCGv_i32 arg);
186ad3d0e4dSRichard Henderson void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg);
187f1c29532SRichard Henderson void tcg_gen_ext_i32(TCGv_i32 ret, TCGv_i32 val, MemOp opc);
188ad3d0e4dSRichard Henderson void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags);
189ad3d0e4dSRichard Henderson void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg);
190ad3d0e4dSRichard Henderson void tcg_gen_hswap_i32(TCGv_i32 ret, TCGv_i32 arg);
191ad3d0e4dSRichard Henderson void tcg_gen_smin_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2);
192ad3d0e4dSRichard Henderson void tcg_gen_smax_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2);
193ad3d0e4dSRichard Henderson void tcg_gen_umin_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2);
194ad3d0e4dSRichard Henderson void tcg_gen_umax_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2);
195ad3d0e4dSRichard Henderson void tcg_gen_abs_i32(TCGv_i32, TCGv_i32);
196ad3d0e4dSRichard Henderson 
197ad3d0e4dSRichard Henderson /* Replicate a value of size @vece from @in to all the lanes in @out */
198ad3d0e4dSRichard Henderson void tcg_gen_dup_i32(unsigned vece, TCGv_i32 out, TCGv_i32 in);
199ad3d0e4dSRichard Henderson 
20009607d35SRichard Henderson void tcg_gen_discard_i32(TCGv_i32 arg);
20109607d35SRichard Henderson void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg);
202ad3d0e4dSRichard Henderson 
20309607d35SRichard Henderson void tcg_gen_ld8u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset);
20409607d35SRichard Henderson void tcg_gen_ld8s_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset);
20509607d35SRichard Henderson void tcg_gen_ld16u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset);
20609607d35SRichard Henderson void tcg_gen_ld16s_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset);
20709607d35SRichard Henderson void tcg_gen_ld_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset);
208ad3d0e4dSRichard Henderson 
20909607d35SRichard Henderson void tcg_gen_st8_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset);
21009607d35SRichard Henderson void tcg_gen_st16_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset);
21109607d35SRichard Henderson void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset);
212ad3d0e4dSRichard Henderson 
21309607d35SRichard Henderson void tcg_gen_add_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
21409607d35SRichard Henderson void tcg_gen_sub_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
21509607d35SRichard Henderson void tcg_gen_and_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
21609607d35SRichard Henderson void tcg_gen_or_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
21709607d35SRichard Henderson void tcg_gen_xor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
21809607d35SRichard Henderson void tcg_gen_shl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
21909607d35SRichard Henderson void tcg_gen_shr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
22009607d35SRichard Henderson void tcg_gen_sar_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
22109607d35SRichard Henderson void tcg_gen_mul_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
22209607d35SRichard Henderson void tcg_gen_neg_i32(TCGv_i32 ret, TCGv_i32 arg);
22309607d35SRichard Henderson void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg);
224ad3d0e4dSRichard Henderson 
225ad3d0e4dSRichard Henderson /* 64 bit ops */
226ad3d0e4dSRichard Henderson 
227ad3d0e4dSRichard Henderson void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg);
228ad3d0e4dSRichard Henderson void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
229ad3d0e4dSRichard Henderson void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2);
230ad3d0e4dSRichard Henderson void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
231ad3d0e4dSRichard Henderson void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
232ad3d0e4dSRichard Henderson void tcg_gen_ori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
233ad3d0e4dSRichard Henderson void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
234ad3d0e4dSRichard Henderson void tcg_gen_shli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
235ad3d0e4dSRichard Henderson void tcg_gen_shri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
236ad3d0e4dSRichard Henderson void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
237ad3d0e4dSRichard Henderson void tcg_gen_muli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
238ad3d0e4dSRichard Henderson void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
239ad3d0e4dSRichard Henderson void tcg_gen_rem_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
240ad3d0e4dSRichard Henderson void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
241ad3d0e4dSRichard Henderson void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
242ad3d0e4dSRichard Henderson void tcg_gen_andc_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
243ad3d0e4dSRichard Henderson void tcg_gen_eqv_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
244ad3d0e4dSRichard Henderson void tcg_gen_nand_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
245ad3d0e4dSRichard Henderson void tcg_gen_nor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
246ad3d0e4dSRichard Henderson void tcg_gen_orc_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
247ad3d0e4dSRichard Henderson void tcg_gen_clz_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
248ad3d0e4dSRichard Henderson void tcg_gen_ctz_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
249ad3d0e4dSRichard Henderson void tcg_gen_clzi_i64(TCGv_i64 ret, TCGv_i64 arg1, uint64_t arg2);
250ad3d0e4dSRichard Henderson void tcg_gen_ctzi_i64(TCGv_i64 ret, TCGv_i64 arg1, uint64_t arg2);
251ad3d0e4dSRichard Henderson void tcg_gen_clrsb_i64(TCGv_i64 ret, TCGv_i64 arg);
252ad3d0e4dSRichard Henderson void tcg_gen_ctpop_i64(TCGv_i64 a1, TCGv_i64 a2);
253ad3d0e4dSRichard Henderson void tcg_gen_rotl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
254ad3d0e4dSRichard Henderson void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
255ad3d0e4dSRichard Henderson void tcg_gen_rotr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
256ad3d0e4dSRichard Henderson void tcg_gen_rotri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
257ad3d0e4dSRichard Henderson void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2,
258ad3d0e4dSRichard Henderson                          unsigned int ofs, unsigned int len);
259ad3d0e4dSRichard Henderson void tcg_gen_deposit_z_i64(TCGv_i64 ret, TCGv_i64 arg,
260ad3d0e4dSRichard Henderson                            unsigned int ofs, unsigned int len);
261ad3d0e4dSRichard Henderson void tcg_gen_extract_i64(TCGv_i64 ret, TCGv_i64 arg,
262ad3d0e4dSRichard Henderson                          unsigned int ofs, unsigned int len);
263ad3d0e4dSRichard Henderson void tcg_gen_sextract_i64(TCGv_i64 ret, TCGv_i64 arg,
264ad3d0e4dSRichard Henderson                           unsigned int ofs, unsigned int len);
265ad3d0e4dSRichard Henderson void tcg_gen_extract2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah,
266ad3d0e4dSRichard Henderson                           unsigned int ofs);
267ad3d0e4dSRichard Henderson void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1, TCGv_i64 arg2, TCGLabel *);
268ad3d0e4dSRichard Henderson void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, TCGLabel *);
269ad3d0e4dSRichard Henderson void tcg_gen_setcond_i64(TCGCond cond, TCGv_i64 ret,
270ad3d0e4dSRichard Henderson                          TCGv_i64 arg1, TCGv_i64 arg2);
271ad3d0e4dSRichard Henderson void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret,
272ad3d0e4dSRichard Henderson                           TCGv_i64 arg1, int64_t arg2);
2733635502dSRichard Henderson void tcg_gen_negsetcond_i64(TCGCond cond, TCGv_i64 ret,
2743635502dSRichard Henderson                             TCGv_i64 arg1, TCGv_i64 arg2);
27593c86ecdSPaolo Bonzini void tcg_gen_negsetcondi_i64(TCGCond cond, TCGv_i64 ret,
27693c86ecdSPaolo Bonzini                              TCGv_i64 arg1, int64_t arg2);
277ad3d0e4dSRichard Henderson void tcg_gen_movcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 c1,
278ad3d0e4dSRichard Henderson                          TCGv_i64 c2, TCGv_i64 v1, TCGv_i64 v2);
279ad3d0e4dSRichard Henderson void tcg_gen_add2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al,
280ad3d0e4dSRichard Henderson                       TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh);
281ad3d0e4dSRichard Henderson void tcg_gen_sub2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al,
282ad3d0e4dSRichard Henderson                       TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh);
283ad3d0e4dSRichard Henderson void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2);
284ad3d0e4dSRichard Henderson void tcg_gen_muls2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2);
285ad3d0e4dSRichard Henderson void tcg_gen_mulsu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2);
286ad3d0e4dSRichard Henderson void tcg_gen_not_i64(TCGv_i64 ret, TCGv_i64 arg);
287ad3d0e4dSRichard Henderson void tcg_gen_ext8s_i64(TCGv_i64 ret, TCGv_i64 arg);
288ad3d0e4dSRichard Henderson void tcg_gen_ext16s_i64(TCGv_i64 ret, TCGv_i64 arg);
289ad3d0e4dSRichard Henderson void tcg_gen_ext32s_i64(TCGv_i64 ret, TCGv_i64 arg);
290ad3d0e4dSRichard Henderson void tcg_gen_ext8u_i64(TCGv_i64 ret, TCGv_i64 arg);
291ad3d0e4dSRichard Henderson void tcg_gen_ext16u_i64(TCGv_i64 ret, TCGv_i64 arg);
292ad3d0e4dSRichard Henderson void tcg_gen_ext32u_i64(TCGv_i64 ret, TCGv_i64 arg);
293f1c29532SRichard Henderson void tcg_gen_ext_i64(TCGv_i64 ret, TCGv_i64 val, MemOp opc);
294ad3d0e4dSRichard Henderson void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg, int flags);
295ad3d0e4dSRichard Henderson void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags);
296ad3d0e4dSRichard Henderson void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg);
297ad3d0e4dSRichard Henderson void tcg_gen_hswap_i64(TCGv_i64 ret, TCGv_i64 arg);
298ad3d0e4dSRichard Henderson void tcg_gen_wswap_i64(TCGv_i64 ret, TCGv_i64 arg);
299ad3d0e4dSRichard Henderson void tcg_gen_smin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2);
300ad3d0e4dSRichard Henderson void tcg_gen_smax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2);
301ad3d0e4dSRichard Henderson void tcg_gen_umin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2);
302ad3d0e4dSRichard Henderson void tcg_gen_umax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2);
303ad3d0e4dSRichard Henderson void tcg_gen_abs_i64(TCGv_i64, TCGv_i64);
304ad3d0e4dSRichard Henderson 
305ad3d0e4dSRichard Henderson /* Replicate a value of size @vece from @in to all the lanes in @out */
306ad3d0e4dSRichard Henderson void tcg_gen_dup_i64(unsigned vece, TCGv_i64 out, TCGv_i64 in);
307ad3d0e4dSRichard Henderson 
308ad3d0e4dSRichard Henderson void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset);
309ad3d0e4dSRichard Henderson void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset);
310ad3d0e4dSRichard Henderson void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset);
311ad3d0e4dSRichard Henderson 
312ad3d0e4dSRichard Henderson void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
313ad3d0e4dSRichard Henderson void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
314ad3d0e4dSRichard Henderson 
315ad3d0e4dSRichard Henderson void tcg_gen_discard_i64(TCGv_i64 arg);
316ad3d0e4dSRichard Henderson void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg);
317ad3d0e4dSRichard Henderson void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset);
318ad3d0e4dSRichard Henderson void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset);
319ad3d0e4dSRichard Henderson void tcg_gen_ld16u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset);
320ad3d0e4dSRichard Henderson void tcg_gen_ld16s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset);
321ad3d0e4dSRichard Henderson void tcg_gen_ld32u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset);
322ad3d0e4dSRichard Henderson void tcg_gen_ld32s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset);
323ad3d0e4dSRichard Henderson void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset);
324ad3d0e4dSRichard Henderson void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset);
325ad3d0e4dSRichard Henderson void tcg_gen_and_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
326ad3d0e4dSRichard Henderson void tcg_gen_or_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
327ad3d0e4dSRichard Henderson void tcg_gen_xor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
328ad3d0e4dSRichard Henderson void tcg_gen_shl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
329ad3d0e4dSRichard Henderson void tcg_gen_shr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
330ad3d0e4dSRichard Henderson void tcg_gen_sar_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
331ad3d0e4dSRichard Henderson void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
332e0de2f55SRichard Henderson void tcg_gen_neg_i64(TCGv_i64 ret, TCGv_i64 arg);
333ad3d0e4dSRichard Henderson 
334ad3d0e4dSRichard Henderson 
335ad3d0e4dSRichard Henderson /* Size changing operations.  */
336ad3d0e4dSRichard Henderson 
337ad3d0e4dSRichard Henderson void tcg_gen_extu_i32_i64(TCGv_i64 ret, TCGv_i32 arg);
338ad3d0e4dSRichard Henderson void tcg_gen_ext_i32_i64(TCGv_i64 ret, TCGv_i32 arg);
339ad3d0e4dSRichard Henderson void tcg_gen_concat_i32_i64(TCGv_i64 dest, TCGv_i32 low, TCGv_i32 high);
340ad3d0e4dSRichard Henderson void tcg_gen_extrl_i64_i32(TCGv_i32 ret, TCGv_i64 arg);
341ad3d0e4dSRichard Henderson void tcg_gen_extrh_i64_i32(TCGv_i32 ret, TCGv_i64 arg);
342ad3d0e4dSRichard Henderson void tcg_gen_extr_i64_i32(TCGv_i32 lo, TCGv_i32 hi, TCGv_i64 arg);
343ad3d0e4dSRichard Henderson void tcg_gen_extr32_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i64 arg);
344e0de2f55SRichard Henderson void tcg_gen_concat32_i64(TCGv_i64 ret, TCGv_i64 lo, TCGv_i64 hi);
345ad3d0e4dSRichard Henderson 
346ad3d0e4dSRichard Henderson void tcg_gen_extr_i128_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i128 arg);
347ad3d0e4dSRichard Henderson void tcg_gen_concat_i64_i128(TCGv_i128 ret, TCGv_i64 lo, TCGv_i64 hi);
348ad3d0e4dSRichard Henderson 
349e0de2f55SRichard Henderson /* 128 bit ops */
350e0de2f55SRichard Henderson 
351e0de2f55SRichard Henderson void tcg_gen_mov_i128(TCGv_i128 dst, TCGv_i128 src);
352a01d9792SRichard Henderson void tcg_gen_ld_i128(TCGv_i128 ret, TCGv_ptr base, tcg_target_long offset);
353a01d9792SRichard Henderson void tcg_gen_st_i128(TCGv_i128 val, TCGv_ptr base, tcg_target_long offset);
354a01d9792SRichard Henderson 
355ad3d0e4dSRichard Henderson /* Local load/store bit ops */
356ad3d0e4dSRichard Henderson 
357ad3d0e4dSRichard Henderson void tcg_gen_qemu_ld_i32_chk(TCGv_i32, TCGTemp *, TCGArg, MemOp, TCGType);
358ad3d0e4dSRichard Henderson void tcg_gen_qemu_st_i32_chk(TCGv_i32, TCGTemp *, TCGArg, MemOp, TCGType);
359ad3d0e4dSRichard Henderson void tcg_gen_qemu_ld_i64_chk(TCGv_i64, TCGTemp *, TCGArg, MemOp, TCGType);
360ad3d0e4dSRichard Henderson void tcg_gen_qemu_st_i64_chk(TCGv_i64, TCGTemp *, TCGArg, MemOp, TCGType);
361ad3d0e4dSRichard Henderson void tcg_gen_qemu_ld_i128_chk(TCGv_i128, TCGTemp *, TCGArg, MemOp, TCGType);
362ad3d0e4dSRichard Henderson void tcg_gen_qemu_st_i128_chk(TCGv_i128, TCGTemp *, TCGArg, MemOp, TCGType);
363ad3d0e4dSRichard Henderson 
364ad3d0e4dSRichard Henderson /* Atomic ops */
365ad3d0e4dSRichard Henderson 
366ad3d0e4dSRichard Henderson void tcg_gen_atomic_cmpxchg_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, TCGv_i32,
367ad3d0e4dSRichard Henderson                                     TCGArg, MemOp, TCGType);
368ad3d0e4dSRichard Henderson void tcg_gen_atomic_cmpxchg_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, TCGv_i64,
369ad3d0e4dSRichard Henderson                                     TCGArg, MemOp, TCGType);
370ad3d0e4dSRichard Henderson void tcg_gen_atomic_cmpxchg_i128_chk(TCGv_i128, TCGTemp *, TCGv_i128,
371ad3d0e4dSRichard Henderson                                      TCGv_i128, TCGArg, MemOp, TCGType);
372ad3d0e4dSRichard Henderson 
373ad3d0e4dSRichard Henderson void tcg_gen_nonatomic_cmpxchg_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, TCGv_i32,
374ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
375ad3d0e4dSRichard Henderson void tcg_gen_nonatomic_cmpxchg_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, TCGv_i64,
376ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
377ad3d0e4dSRichard Henderson void tcg_gen_nonatomic_cmpxchg_i128_chk(TCGv_i128, TCGTemp *, TCGv_i128,
378ad3d0e4dSRichard Henderson                                         TCGv_i128, TCGArg, MemOp, TCGType);
379ad3d0e4dSRichard Henderson 
380ad3d0e4dSRichard Henderson void tcg_gen_atomic_xchg_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
381ad3d0e4dSRichard Henderson                                  TCGArg, MemOp, TCGType);
382ad3d0e4dSRichard Henderson void tcg_gen_atomic_xchg_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
383ad3d0e4dSRichard Henderson                                  TCGArg, MemOp, TCGType);
384ad3d0e4dSRichard Henderson 
385ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_add_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
386ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
387ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_add_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
388ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
389ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_and_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
390ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
391ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_and_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
392ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
393ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_or_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
394ad3d0e4dSRichard Henderson                                      TCGArg, MemOp, TCGType);
395ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_or_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
396ad3d0e4dSRichard Henderson                                      TCGArg, MemOp, TCGType);
397ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_xor_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
398ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
399ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_xor_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
400ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
401ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_smin_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
402ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
403ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_smin_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
404ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
405ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_umin_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
406ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
407ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_umin_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
408ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
409ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_smax_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
410ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
411ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_smax_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
412ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
413ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_umax_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
414ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
415ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_umax_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
416ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
417ad3d0e4dSRichard Henderson 
418ad3d0e4dSRichard Henderson void tcg_gen_atomic_add_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
419ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
420ad3d0e4dSRichard Henderson void tcg_gen_atomic_add_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
421ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
422ad3d0e4dSRichard Henderson void tcg_gen_atomic_and_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
423ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
424ad3d0e4dSRichard Henderson void tcg_gen_atomic_and_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
425ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
426ad3d0e4dSRichard Henderson void tcg_gen_atomic_or_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
427ad3d0e4dSRichard Henderson                                      TCGArg, MemOp, TCGType);
428ad3d0e4dSRichard Henderson void tcg_gen_atomic_or_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
429ad3d0e4dSRichard Henderson                                      TCGArg, MemOp, TCGType);
430ad3d0e4dSRichard Henderson void tcg_gen_atomic_xor_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
431ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
432ad3d0e4dSRichard Henderson void tcg_gen_atomic_xor_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
433ad3d0e4dSRichard Henderson                                       TCGArg, MemOp, TCGType);
434ad3d0e4dSRichard Henderson void tcg_gen_atomic_smin_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
435ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
436ad3d0e4dSRichard Henderson void tcg_gen_atomic_smin_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
437ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
438ad3d0e4dSRichard Henderson void tcg_gen_atomic_umin_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
439ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
440ad3d0e4dSRichard Henderson void tcg_gen_atomic_umin_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
441ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
442ad3d0e4dSRichard Henderson void tcg_gen_atomic_smax_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
443ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
444ad3d0e4dSRichard Henderson void tcg_gen_atomic_smax_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
445ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
446ad3d0e4dSRichard Henderson void tcg_gen_atomic_umax_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,
447ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
448ad3d0e4dSRichard Henderson void tcg_gen_atomic_umax_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64,
449ad3d0e4dSRichard Henderson                                        TCGArg, MemOp, TCGType);
450ad3d0e4dSRichard Henderson 
451ad3d0e4dSRichard Henderson /* Vector ops */
452ad3d0e4dSRichard Henderson 
453ad3d0e4dSRichard Henderson void tcg_gen_mov_vec(TCGv_vec, TCGv_vec);
454ad3d0e4dSRichard Henderson void tcg_gen_dup_i32_vec(unsigned vece, TCGv_vec, TCGv_i32);
455ad3d0e4dSRichard Henderson void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec, TCGv_i64);
456ad3d0e4dSRichard Henderson void tcg_gen_dup_mem_vec(unsigned vece, TCGv_vec, TCGv_ptr, tcg_target_long);
457ad3d0e4dSRichard Henderson void tcg_gen_dupi_vec(unsigned vece, TCGv_vec, uint64_t);
458ad3d0e4dSRichard Henderson void tcg_gen_add_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
459ad3d0e4dSRichard Henderson void tcg_gen_sub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
460ad3d0e4dSRichard Henderson void tcg_gen_mul_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
461ad3d0e4dSRichard Henderson void tcg_gen_and_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
462ad3d0e4dSRichard Henderson void tcg_gen_or_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
463ad3d0e4dSRichard Henderson void tcg_gen_xor_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
464ad3d0e4dSRichard Henderson void tcg_gen_andc_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
465ad3d0e4dSRichard Henderson void tcg_gen_orc_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
466ad3d0e4dSRichard Henderson void tcg_gen_nand_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
467ad3d0e4dSRichard Henderson void tcg_gen_nor_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
468ad3d0e4dSRichard Henderson void tcg_gen_eqv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
469ad3d0e4dSRichard Henderson void tcg_gen_not_vec(unsigned vece, TCGv_vec r, TCGv_vec a);
470ad3d0e4dSRichard Henderson void tcg_gen_neg_vec(unsigned vece, TCGv_vec r, TCGv_vec a);
471ad3d0e4dSRichard Henderson void tcg_gen_abs_vec(unsigned vece, TCGv_vec r, TCGv_vec a);
472ad3d0e4dSRichard Henderson void tcg_gen_ssadd_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
473ad3d0e4dSRichard Henderson void tcg_gen_usadd_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
474ad3d0e4dSRichard Henderson void tcg_gen_sssub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
475ad3d0e4dSRichard Henderson void tcg_gen_ussub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
476ad3d0e4dSRichard Henderson void tcg_gen_smin_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
477ad3d0e4dSRichard Henderson void tcg_gen_umin_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
478ad3d0e4dSRichard Henderson void tcg_gen_smax_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
479ad3d0e4dSRichard Henderson void tcg_gen_umax_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b);
480ad3d0e4dSRichard Henderson 
481ad3d0e4dSRichard Henderson void tcg_gen_shli_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i);
482ad3d0e4dSRichard Henderson void tcg_gen_shri_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i);
483ad3d0e4dSRichard Henderson void tcg_gen_sari_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i);
484ad3d0e4dSRichard Henderson void tcg_gen_rotli_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i);
485ad3d0e4dSRichard Henderson void tcg_gen_rotri_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i);
486ad3d0e4dSRichard Henderson 
487ad3d0e4dSRichard Henderson void tcg_gen_shls_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s);
488ad3d0e4dSRichard Henderson void tcg_gen_shrs_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s);
489ad3d0e4dSRichard Henderson void tcg_gen_sars_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s);
490ad3d0e4dSRichard Henderson void tcg_gen_rotls_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s);
491ad3d0e4dSRichard Henderson 
492ad3d0e4dSRichard Henderson void tcg_gen_shlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s);
493ad3d0e4dSRichard Henderson void tcg_gen_shrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s);
494ad3d0e4dSRichard Henderson void tcg_gen_sarv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s);
495ad3d0e4dSRichard Henderson void tcg_gen_rotlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s);
496ad3d0e4dSRichard Henderson void tcg_gen_rotrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s);
497ad3d0e4dSRichard Henderson 
498ad3d0e4dSRichard Henderson void tcg_gen_cmp_vec(TCGCond cond, unsigned vece, TCGv_vec r,
499ad3d0e4dSRichard Henderson                      TCGv_vec a, TCGv_vec b);
500ad3d0e4dSRichard Henderson 
501ad3d0e4dSRichard Henderson void tcg_gen_bitsel_vec(unsigned vece, TCGv_vec r, TCGv_vec a,
502ad3d0e4dSRichard Henderson                         TCGv_vec b, TCGv_vec c);
503ad3d0e4dSRichard Henderson void tcg_gen_cmpsel_vec(TCGCond cond, unsigned vece, TCGv_vec r,
504ad3d0e4dSRichard Henderson                         TCGv_vec a, TCGv_vec b, TCGv_vec c, TCGv_vec d);
505ad3d0e4dSRichard Henderson 
506ad3d0e4dSRichard Henderson void tcg_gen_ld_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset);
507ad3d0e4dSRichard Henderson void tcg_gen_st_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset);
508ad3d0e4dSRichard Henderson void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t);
509ad3d0e4dSRichard Henderson 
510ad3d0e4dSRichard Henderson /* Host pointer ops */
511ad3d0e4dSRichard Henderson 
512ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX
513ad3d0e4dSRichard Henderson # define PTR  i32
514ad3d0e4dSRichard Henderson # define NAT  TCGv_i32
515ad3d0e4dSRichard Henderson #else
516ad3d0e4dSRichard Henderson # define PTR  i64
517ad3d0e4dSRichard Henderson # define NAT  TCGv_i64
518ad3d0e4dSRichard Henderson #endif
519ad3d0e4dSRichard Henderson 
520ad3d0e4dSRichard Henderson static inline void tcg_gen_ld_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t o)
521ad3d0e4dSRichard Henderson {
522ad3d0e4dSRichard Henderson     glue(tcg_gen_ld_,PTR)((NAT)r, a, o);
523ad3d0e4dSRichard Henderson }
524ad3d0e4dSRichard Henderson 
525ad3d0e4dSRichard Henderson static inline void tcg_gen_st_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t o)
526ad3d0e4dSRichard Henderson {
527ad3d0e4dSRichard Henderson     glue(tcg_gen_st_, PTR)((NAT)r, a, o);
528ad3d0e4dSRichard Henderson }
529ad3d0e4dSRichard Henderson 
530ad3d0e4dSRichard Henderson static inline void tcg_gen_discard_ptr(TCGv_ptr a)
531ad3d0e4dSRichard Henderson {
532ad3d0e4dSRichard Henderson     glue(tcg_gen_discard_,PTR)((NAT)a);
533ad3d0e4dSRichard Henderson }
534ad3d0e4dSRichard Henderson 
535ad3d0e4dSRichard Henderson static inline void tcg_gen_add_ptr(TCGv_ptr r, TCGv_ptr a, TCGv_ptr b)
536ad3d0e4dSRichard Henderson {
537ad3d0e4dSRichard Henderson     glue(tcg_gen_add_,PTR)((NAT)r, (NAT)a, (NAT)b);
538ad3d0e4dSRichard Henderson }
539ad3d0e4dSRichard Henderson 
540ad3d0e4dSRichard Henderson static inline void tcg_gen_addi_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t b)
541ad3d0e4dSRichard Henderson {
542ad3d0e4dSRichard Henderson     glue(tcg_gen_addi_,PTR)((NAT)r, (NAT)a, b);
543ad3d0e4dSRichard Henderson }
544ad3d0e4dSRichard Henderson 
545ad3d0e4dSRichard Henderson static inline void tcg_gen_mov_ptr(TCGv_ptr d, TCGv_ptr s)
546ad3d0e4dSRichard Henderson {
547ad3d0e4dSRichard Henderson     glue(tcg_gen_mov_,PTR)((NAT)d, (NAT)s);
548ad3d0e4dSRichard Henderson }
549ad3d0e4dSRichard Henderson 
550ad3d0e4dSRichard Henderson static inline void tcg_gen_movi_ptr(TCGv_ptr d, intptr_t s)
551ad3d0e4dSRichard Henderson {
552ad3d0e4dSRichard Henderson     glue(tcg_gen_movi_,PTR)((NAT)d, s);
553ad3d0e4dSRichard Henderson }
554ad3d0e4dSRichard Henderson 
555ad3d0e4dSRichard Henderson static inline void tcg_gen_brcondi_ptr(TCGCond cond, TCGv_ptr a,
556ad3d0e4dSRichard Henderson                                        intptr_t b, TCGLabel *label)
557ad3d0e4dSRichard Henderson {
558ad3d0e4dSRichard Henderson     glue(tcg_gen_brcondi_,PTR)(cond, (NAT)a, b, label);
559ad3d0e4dSRichard Henderson }
560ad3d0e4dSRichard Henderson 
561ad3d0e4dSRichard Henderson static inline void tcg_gen_ext_i32_ptr(TCGv_ptr r, TCGv_i32 a)
562ad3d0e4dSRichard Henderson {
563ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX
564ad3d0e4dSRichard Henderson     tcg_gen_mov_i32((NAT)r, a);
565ad3d0e4dSRichard Henderson #else
566ad3d0e4dSRichard Henderson     tcg_gen_ext_i32_i64((NAT)r, a);
567ad3d0e4dSRichard Henderson #endif
568ad3d0e4dSRichard Henderson }
569ad3d0e4dSRichard Henderson 
570ad3d0e4dSRichard Henderson static inline void tcg_gen_trunc_i64_ptr(TCGv_ptr r, TCGv_i64 a)
571ad3d0e4dSRichard Henderson {
572ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX
573ad3d0e4dSRichard Henderson     tcg_gen_extrl_i64_i32((NAT)r, a);
574ad3d0e4dSRichard Henderson #else
575ad3d0e4dSRichard Henderson     tcg_gen_mov_i64((NAT)r, a);
576ad3d0e4dSRichard Henderson #endif
577ad3d0e4dSRichard Henderson }
578ad3d0e4dSRichard Henderson 
579ad3d0e4dSRichard Henderson static inline void tcg_gen_extu_ptr_i64(TCGv_i64 r, TCGv_ptr a)
580ad3d0e4dSRichard Henderson {
581ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX
582ad3d0e4dSRichard Henderson     tcg_gen_extu_i32_i64(r, (NAT)a);
583ad3d0e4dSRichard Henderson #else
584ad3d0e4dSRichard Henderson     tcg_gen_mov_i64(r, (NAT)a);
585ad3d0e4dSRichard Henderson #endif
586ad3d0e4dSRichard Henderson }
587ad3d0e4dSRichard Henderson 
588ad3d0e4dSRichard Henderson static inline void tcg_gen_trunc_ptr_i32(TCGv_i32 r, TCGv_ptr a)
589ad3d0e4dSRichard Henderson {
590ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX
591ad3d0e4dSRichard Henderson     tcg_gen_mov_i32(r, (NAT)a);
592ad3d0e4dSRichard Henderson #else
593ad3d0e4dSRichard Henderson     tcg_gen_extrl_i64_i32(r, (NAT)a);
594ad3d0e4dSRichard Henderson #endif
595ad3d0e4dSRichard Henderson }
596ad3d0e4dSRichard Henderson 
597ad3d0e4dSRichard Henderson #undef PTR
598ad3d0e4dSRichard Henderson #undef NAT
599ad3d0e4dSRichard Henderson 
600ad3d0e4dSRichard Henderson #endif /* TCG_TCG_OP_COMMON_H */
601