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 28ad3d0e4dSRichard Henderson static inline void tcg_gen_op1_i32(TCGOpcode opc, TCGv_i32 a1) 29ad3d0e4dSRichard Henderson { 30ad3d0e4dSRichard Henderson tcg_gen_op1(opc, tcgv_i32_arg(a1)); 31ad3d0e4dSRichard Henderson } 32ad3d0e4dSRichard Henderson 33ad3d0e4dSRichard Henderson static inline void tcg_gen_op1_i64(TCGOpcode opc, TCGv_i64 a1) 34ad3d0e4dSRichard Henderson { 35ad3d0e4dSRichard Henderson tcg_gen_op1(opc, tcgv_i64_arg(a1)); 36ad3d0e4dSRichard Henderson } 37ad3d0e4dSRichard Henderson 38ad3d0e4dSRichard Henderson static inline void tcg_gen_op1i(TCGOpcode opc, TCGArg a1) 39ad3d0e4dSRichard Henderson { 40ad3d0e4dSRichard Henderson tcg_gen_op1(opc, a1); 41ad3d0e4dSRichard Henderson } 42ad3d0e4dSRichard Henderson 43ad3d0e4dSRichard Henderson static inline void tcg_gen_op2_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2) 44ad3d0e4dSRichard Henderson { 45ad3d0e4dSRichard Henderson tcg_gen_op2(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2)); 46ad3d0e4dSRichard Henderson } 47ad3d0e4dSRichard Henderson 48ad3d0e4dSRichard Henderson static inline void tcg_gen_op2_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2) 49ad3d0e4dSRichard Henderson { 50ad3d0e4dSRichard Henderson tcg_gen_op2(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2)); 51ad3d0e4dSRichard Henderson } 52ad3d0e4dSRichard Henderson 53ad3d0e4dSRichard Henderson static inline void tcg_gen_op2i_i32(TCGOpcode opc, TCGv_i32 a1, TCGArg a2) 54ad3d0e4dSRichard Henderson { 55ad3d0e4dSRichard Henderson tcg_gen_op2(opc, tcgv_i32_arg(a1), a2); 56ad3d0e4dSRichard Henderson } 57ad3d0e4dSRichard Henderson 58ad3d0e4dSRichard Henderson static inline void tcg_gen_op2i_i64(TCGOpcode opc, TCGv_i64 a1, TCGArg a2) 59ad3d0e4dSRichard Henderson { 60ad3d0e4dSRichard Henderson tcg_gen_op2(opc, tcgv_i64_arg(a1), a2); 61ad3d0e4dSRichard Henderson } 62ad3d0e4dSRichard Henderson 63ad3d0e4dSRichard Henderson static inline void tcg_gen_op2ii(TCGOpcode opc, TCGArg a1, TCGArg a2) 64ad3d0e4dSRichard Henderson { 65ad3d0e4dSRichard Henderson tcg_gen_op2(opc, a1, a2); 66ad3d0e4dSRichard Henderson } 67ad3d0e4dSRichard Henderson 68ad3d0e4dSRichard Henderson static inline void tcg_gen_op3_i32(TCGOpcode opc, TCGv_i32 a1, 69ad3d0e4dSRichard Henderson TCGv_i32 a2, TCGv_i32 a3) 70ad3d0e4dSRichard Henderson { 71ad3d0e4dSRichard Henderson tcg_gen_op3(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), tcgv_i32_arg(a3)); 72ad3d0e4dSRichard Henderson } 73ad3d0e4dSRichard Henderson 74ad3d0e4dSRichard Henderson static inline void tcg_gen_op3_i64(TCGOpcode opc, TCGv_i64 a1, 75ad3d0e4dSRichard Henderson TCGv_i64 a2, TCGv_i64 a3) 76ad3d0e4dSRichard Henderson { 77ad3d0e4dSRichard Henderson tcg_gen_op3(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), tcgv_i64_arg(a3)); 78ad3d0e4dSRichard Henderson } 79ad3d0e4dSRichard Henderson 80ad3d0e4dSRichard Henderson static inline void tcg_gen_op3i_i32(TCGOpcode opc, TCGv_i32 a1, 81ad3d0e4dSRichard Henderson TCGv_i32 a2, TCGArg a3) 82ad3d0e4dSRichard Henderson { 83ad3d0e4dSRichard Henderson tcg_gen_op3(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3); 84ad3d0e4dSRichard Henderson } 85ad3d0e4dSRichard Henderson 86ad3d0e4dSRichard Henderson static inline void tcg_gen_op3i_i64(TCGOpcode opc, TCGv_i64 a1, 87ad3d0e4dSRichard Henderson TCGv_i64 a2, TCGArg a3) 88ad3d0e4dSRichard Henderson { 89ad3d0e4dSRichard Henderson tcg_gen_op3(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3); 90ad3d0e4dSRichard Henderson } 91ad3d0e4dSRichard Henderson 92ad3d0e4dSRichard Henderson static inline void tcg_gen_ldst_op_i32(TCGOpcode opc, TCGv_i32 val, 93ad3d0e4dSRichard Henderson TCGv_ptr base, TCGArg offset) 94ad3d0e4dSRichard Henderson { 95ad3d0e4dSRichard Henderson tcg_gen_op3(opc, tcgv_i32_arg(val), tcgv_ptr_arg(base), offset); 96ad3d0e4dSRichard Henderson } 97ad3d0e4dSRichard Henderson 98ad3d0e4dSRichard Henderson static inline void tcg_gen_ldst_op_i64(TCGOpcode opc, TCGv_i64 val, 99ad3d0e4dSRichard Henderson TCGv_ptr base, TCGArg offset) 100ad3d0e4dSRichard Henderson { 101ad3d0e4dSRichard Henderson tcg_gen_op3(opc, tcgv_i64_arg(val), tcgv_ptr_arg(base), offset); 102ad3d0e4dSRichard Henderson } 103ad3d0e4dSRichard Henderson 104ad3d0e4dSRichard Henderson static inline void tcg_gen_op4_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, 105ad3d0e4dSRichard Henderson TCGv_i32 a3, TCGv_i32 a4) 106ad3d0e4dSRichard Henderson { 107ad3d0e4dSRichard Henderson tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), 108ad3d0e4dSRichard Henderson tcgv_i32_arg(a3), tcgv_i32_arg(a4)); 109ad3d0e4dSRichard Henderson } 110ad3d0e4dSRichard Henderson 111ad3d0e4dSRichard Henderson static inline void tcg_gen_op4_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, 112ad3d0e4dSRichard Henderson TCGv_i64 a3, TCGv_i64 a4) 113ad3d0e4dSRichard Henderson { 114ad3d0e4dSRichard Henderson tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), 115ad3d0e4dSRichard Henderson tcgv_i64_arg(a3), tcgv_i64_arg(a4)); 116ad3d0e4dSRichard Henderson } 117ad3d0e4dSRichard Henderson 118ad3d0e4dSRichard Henderson static inline void tcg_gen_op4i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, 119ad3d0e4dSRichard Henderson TCGv_i32 a3, TCGArg a4) 120ad3d0e4dSRichard Henderson { 121ad3d0e4dSRichard Henderson tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), 122ad3d0e4dSRichard Henderson tcgv_i32_arg(a3), a4); 123ad3d0e4dSRichard Henderson } 124ad3d0e4dSRichard Henderson 125ad3d0e4dSRichard Henderson static inline void tcg_gen_op4i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, 126ad3d0e4dSRichard Henderson TCGv_i64 a3, TCGArg a4) 127ad3d0e4dSRichard Henderson { 128ad3d0e4dSRichard Henderson tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), 129ad3d0e4dSRichard Henderson tcgv_i64_arg(a3), a4); 130ad3d0e4dSRichard Henderson } 131ad3d0e4dSRichard Henderson 132ad3d0e4dSRichard Henderson static inline void tcg_gen_op4ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, 133ad3d0e4dSRichard Henderson TCGArg a3, TCGArg a4) 134ad3d0e4dSRichard Henderson { 135ad3d0e4dSRichard Henderson tcg_gen_op4(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), a3, a4); 136ad3d0e4dSRichard Henderson } 137ad3d0e4dSRichard Henderson 138ad3d0e4dSRichard Henderson static inline void tcg_gen_op4ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, 139ad3d0e4dSRichard Henderson TCGArg a3, TCGArg a4) 140ad3d0e4dSRichard Henderson { 141ad3d0e4dSRichard Henderson tcg_gen_op4(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3, a4); 142ad3d0e4dSRichard Henderson } 143ad3d0e4dSRichard Henderson 144ad3d0e4dSRichard Henderson static inline void tcg_gen_op5_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, 145ad3d0e4dSRichard Henderson TCGv_i32 a3, TCGv_i32 a4, TCGv_i32 a5) 146ad3d0e4dSRichard Henderson { 147ad3d0e4dSRichard Henderson tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), 148ad3d0e4dSRichard Henderson tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5)); 149ad3d0e4dSRichard Henderson } 150ad3d0e4dSRichard Henderson 151ad3d0e4dSRichard Henderson static inline void tcg_gen_op5_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, 152ad3d0e4dSRichard Henderson TCGv_i64 a3, TCGv_i64 a4, TCGv_i64 a5) 153ad3d0e4dSRichard Henderson { 154ad3d0e4dSRichard Henderson tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), 155ad3d0e4dSRichard Henderson tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5)); 156ad3d0e4dSRichard Henderson } 157ad3d0e4dSRichard Henderson 158ad3d0e4dSRichard Henderson static inline void tcg_gen_op5i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, 159ad3d0e4dSRichard Henderson TCGv_i32 a3, TCGv_i32 a4, TCGArg a5) 160ad3d0e4dSRichard Henderson { 161ad3d0e4dSRichard Henderson tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), 162ad3d0e4dSRichard Henderson tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5); 163ad3d0e4dSRichard Henderson } 164ad3d0e4dSRichard Henderson 165ad3d0e4dSRichard Henderson static inline void tcg_gen_op5i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, 166ad3d0e4dSRichard Henderson TCGv_i64 a3, TCGv_i64 a4, TCGArg a5) 167ad3d0e4dSRichard Henderson { 168ad3d0e4dSRichard Henderson tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), 169ad3d0e4dSRichard Henderson tcgv_i64_arg(a3), tcgv_i64_arg(a4), a5); 170ad3d0e4dSRichard Henderson } 171ad3d0e4dSRichard Henderson 172ad3d0e4dSRichard Henderson static inline void tcg_gen_op5ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, 173ad3d0e4dSRichard Henderson TCGv_i32 a3, TCGArg a4, TCGArg a5) 174ad3d0e4dSRichard Henderson { 175ad3d0e4dSRichard Henderson tcg_gen_op5(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), 176ad3d0e4dSRichard Henderson tcgv_i32_arg(a3), a4, a5); 177ad3d0e4dSRichard Henderson } 178ad3d0e4dSRichard Henderson 179ad3d0e4dSRichard Henderson static inline void tcg_gen_op5ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, 180ad3d0e4dSRichard Henderson TCGv_i64 a3, TCGArg a4, TCGArg a5) 181ad3d0e4dSRichard Henderson { 182ad3d0e4dSRichard Henderson tcg_gen_op5(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), 183ad3d0e4dSRichard Henderson tcgv_i64_arg(a3), a4, a5); 184ad3d0e4dSRichard Henderson } 185ad3d0e4dSRichard Henderson 186ad3d0e4dSRichard Henderson static inline void tcg_gen_op6_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, 187ad3d0e4dSRichard Henderson TCGv_i32 a3, TCGv_i32 a4, 188ad3d0e4dSRichard Henderson TCGv_i32 a5, TCGv_i32 a6) 189ad3d0e4dSRichard Henderson { 190ad3d0e4dSRichard Henderson tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), 191ad3d0e4dSRichard Henderson tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5), 192ad3d0e4dSRichard Henderson tcgv_i32_arg(a6)); 193ad3d0e4dSRichard Henderson } 194ad3d0e4dSRichard Henderson 195ad3d0e4dSRichard Henderson static inline void tcg_gen_op6_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, 196ad3d0e4dSRichard Henderson TCGv_i64 a3, TCGv_i64 a4, 197ad3d0e4dSRichard Henderson TCGv_i64 a5, TCGv_i64 a6) 198ad3d0e4dSRichard Henderson { 199ad3d0e4dSRichard Henderson tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), 200ad3d0e4dSRichard Henderson tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5), 201ad3d0e4dSRichard Henderson tcgv_i64_arg(a6)); 202ad3d0e4dSRichard Henderson } 203ad3d0e4dSRichard Henderson 204ad3d0e4dSRichard Henderson static inline void tcg_gen_op6i_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, 205ad3d0e4dSRichard Henderson TCGv_i32 a3, TCGv_i32 a4, 206ad3d0e4dSRichard Henderson TCGv_i32 a5, TCGArg a6) 207ad3d0e4dSRichard Henderson { 208ad3d0e4dSRichard Henderson tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), 209ad3d0e4dSRichard Henderson tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5), a6); 210ad3d0e4dSRichard Henderson } 211ad3d0e4dSRichard Henderson 212ad3d0e4dSRichard Henderson static inline void tcg_gen_op6i_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, 213ad3d0e4dSRichard Henderson TCGv_i64 a3, TCGv_i64 a4, 214ad3d0e4dSRichard Henderson TCGv_i64 a5, TCGArg a6) 215ad3d0e4dSRichard Henderson { 216ad3d0e4dSRichard Henderson tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), 217ad3d0e4dSRichard Henderson tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5), a6); 218ad3d0e4dSRichard Henderson } 219ad3d0e4dSRichard Henderson 220ad3d0e4dSRichard Henderson static inline void tcg_gen_op6ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2, 221ad3d0e4dSRichard Henderson TCGv_i32 a3, TCGv_i32 a4, 222ad3d0e4dSRichard Henderson TCGArg a5, TCGArg a6) 223ad3d0e4dSRichard Henderson { 224ad3d0e4dSRichard Henderson tcg_gen_op6(opc, tcgv_i32_arg(a1), tcgv_i32_arg(a2), 225ad3d0e4dSRichard Henderson tcgv_i32_arg(a3), tcgv_i32_arg(a4), a5, a6); 226ad3d0e4dSRichard Henderson } 227ad3d0e4dSRichard Henderson 228ad3d0e4dSRichard Henderson static inline void tcg_gen_op6ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2, 229ad3d0e4dSRichard Henderson TCGv_i64 a3, TCGv_i64 a4, 230ad3d0e4dSRichard Henderson TCGArg a5, TCGArg a6) 231ad3d0e4dSRichard Henderson { 232ad3d0e4dSRichard Henderson tcg_gen_op6(opc, tcgv_i64_arg(a1), tcgv_i64_arg(a2), 233ad3d0e4dSRichard Henderson tcgv_i64_arg(a3), tcgv_i64_arg(a4), a5, a6); 234ad3d0e4dSRichard Henderson } 235ad3d0e4dSRichard Henderson 236ad3d0e4dSRichard Henderson 237ad3d0e4dSRichard Henderson /* Generic ops. */ 238ad3d0e4dSRichard Henderson 239ad3d0e4dSRichard Henderson static inline void gen_set_label(TCGLabel *l) 240ad3d0e4dSRichard Henderson { 241ad3d0e4dSRichard Henderson l->present = 1; 242ad3d0e4dSRichard Henderson tcg_gen_op1(INDEX_op_set_label, label_arg(l)); 243ad3d0e4dSRichard Henderson } 244ad3d0e4dSRichard Henderson 245ad3d0e4dSRichard Henderson void tcg_gen_br(TCGLabel *l); 246ad3d0e4dSRichard Henderson void tcg_gen_mb(TCGBar); 247ad3d0e4dSRichard Henderson 248ad3d0e4dSRichard Henderson /** 249ad3d0e4dSRichard Henderson * tcg_gen_exit_tb() - output exit_tb TCG operation 250ad3d0e4dSRichard Henderson * @tb: The TranslationBlock from which we are exiting 251ad3d0e4dSRichard Henderson * @idx: Direct jump slot index, or exit request 252ad3d0e4dSRichard Henderson * 253ad3d0e4dSRichard Henderson * See tcg/README for more info about this TCG operation. 254ad3d0e4dSRichard Henderson * See also tcg.h and the block comment above TB_EXIT_MASK. 255ad3d0e4dSRichard Henderson * 256ad3d0e4dSRichard Henderson * For a normal exit from the TB, back to the main loop, @tb should 257ad3d0e4dSRichard Henderson * be NULL and @idx should be 0. Otherwise, @tb should be valid and 258ad3d0e4dSRichard Henderson * @idx should be one of the TB_EXIT_ values. 259ad3d0e4dSRichard Henderson */ 260ad3d0e4dSRichard Henderson void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx); 261ad3d0e4dSRichard Henderson 262ad3d0e4dSRichard Henderson /** 263ad3d0e4dSRichard Henderson * tcg_gen_goto_tb() - output goto_tb TCG operation 264ad3d0e4dSRichard Henderson * @idx: Direct jump slot index (0 or 1) 265ad3d0e4dSRichard Henderson * 266ad3d0e4dSRichard Henderson * See tcg/README for more info about this TCG operation. 267ad3d0e4dSRichard Henderson * 2687893e42dSPhilippe Mathieu-Daudé * NOTE: In system emulation, direct jumps with goto_tb are only safe within 269ad3d0e4dSRichard Henderson * the pages this TB resides in because we don't take care of direct jumps when 270ad3d0e4dSRichard Henderson * address mapping changes, e.g. in tlb_flush(). In user mode, there's only a 271ad3d0e4dSRichard Henderson * static address translation, so the destination address is always valid, TBs 272ad3d0e4dSRichard Henderson * are always invalidated properly, and direct jumps are reset when mapping 273ad3d0e4dSRichard Henderson * changes. 274ad3d0e4dSRichard Henderson */ 275ad3d0e4dSRichard Henderson void tcg_gen_goto_tb(unsigned idx); 276ad3d0e4dSRichard Henderson 277ad3d0e4dSRichard Henderson /** 278ad3d0e4dSRichard Henderson * tcg_gen_lookup_and_goto_ptr() - look up the current TB, jump to it if valid 279ad3d0e4dSRichard Henderson * @addr: Guest address of the target TB 280ad3d0e4dSRichard Henderson * 281ad3d0e4dSRichard Henderson * If the TB is not valid, jump to the epilogue. 282ad3d0e4dSRichard Henderson * 283ad3d0e4dSRichard Henderson * This operation is optional. If the TCG backend does not implement goto_ptr, 284ad3d0e4dSRichard Henderson * this op is equivalent to calling tcg_gen_exit_tb() with 0 as the argument. 285ad3d0e4dSRichard Henderson */ 286ad3d0e4dSRichard Henderson void tcg_gen_lookup_and_goto_ptr(void); 287ad3d0e4dSRichard Henderson 288ad3d0e4dSRichard Henderson static inline void tcg_gen_plugin_cb_start(unsigned from, unsigned type, 289ad3d0e4dSRichard Henderson unsigned wr) 290ad3d0e4dSRichard Henderson { 291ad3d0e4dSRichard Henderson tcg_gen_op3(INDEX_op_plugin_cb_start, from, type, wr); 292ad3d0e4dSRichard Henderson } 293ad3d0e4dSRichard Henderson 294ad3d0e4dSRichard Henderson static inline void tcg_gen_plugin_cb_end(void) 295ad3d0e4dSRichard Henderson { 296ad3d0e4dSRichard Henderson tcg_emit_op(INDEX_op_plugin_cb_end, 0); 297ad3d0e4dSRichard Henderson } 298ad3d0e4dSRichard Henderson 299ad3d0e4dSRichard Henderson /* 32 bit ops */ 300ad3d0e4dSRichard Henderson 301ad3d0e4dSRichard Henderson void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg); 302ad3d0e4dSRichard Henderson void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 303ad3d0e4dSRichard Henderson void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv_i32 arg2); 304ad3d0e4dSRichard Henderson void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 305ad3d0e4dSRichard Henderson void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 306ad3d0e4dSRichard Henderson void tcg_gen_ori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 307ad3d0e4dSRichard Henderson void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 308ad3d0e4dSRichard Henderson void tcg_gen_shli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 309ad3d0e4dSRichard Henderson void tcg_gen_shri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 310ad3d0e4dSRichard Henderson void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 311ad3d0e4dSRichard Henderson void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 312ad3d0e4dSRichard Henderson void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 313ad3d0e4dSRichard Henderson void tcg_gen_rem_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 314ad3d0e4dSRichard Henderson void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 315ad3d0e4dSRichard Henderson void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 316ad3d0e4dSRichard Henderson void tcg_gen_andc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 317ad3d0e4dSRichard Henderson void tcg_gen_eqv_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 318ad3d0e4dSRichard Henderson void tcg_gen_nand_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 319ad3d0e4dSRichard Henderson void tcg_gen_nor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 320ad3d0e4dSRichard Henderson void tcg_gen_orc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 321ad3d0e4dSRichard Henderson void tcg_gen_clz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 322ad3d0e4dSRichard Henderson void tcg_gen_ctz_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 323ad3d0e4dSRichard Henderson void tcg_gen_clzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t arg2); 324ad3d0e4dSRichard Henderson void tcg_gen_ctzi_i32(TCGv_i32 ret, TCGv_i32 arg1, uint32_t arg2); 325ad3d0e4dSRichard Henderson void tcg_gen_clrsb_i32(TCGv_i32 ret, TCGv_i32 arg); 326ad3d0e4dSRichard Henderson void tcg_gen_ctpop_i32(TCGv_i32 a1, TCGv_i32 a2); 327ad3d0e4dSRichard Henderson void tcg_gen_rotl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 328ad3d0e4dSRichard Henderson void tcg_gen_rotli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 329ad3d0e4dSRichard Henderson void tcg_gen_rotr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2); 330ad3d0e4dSRichard Henderson void tcg_gen_rotri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2); 331ad3d0e4dSRichard Henderson void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2, 332ad3d0e4dSRichard Henderson unsigned int ofs, unsigned int len); 333ad3d0e4dSRichard Henderson void tcg_gen_deposit_z_i32(TCGv_i32 ret, TCGv_i32 arg, 334ad3d0e4dSRichard Henderson unsigned int ofs, unsigned int len); 335ad3d0e4dSRichard Henderson void tcg_gen_extract_i32(TCGv_i32 ret, TCGv_i32 arg, 336ad3d0e4dSRichard Henderson unsigned int ofs, unsigned int len); 337ad3d0e4dSRichard Henderson void tcg_gen_sextract_i32(TCGv_i32 ret, TCGv_i32 arg, 338ad3d0e4dSRichard Henderson unsigned int ofs, unsigned int len); 339ad3d0e4dSRichard Henderson void tcg_gen_extract2_i32(TCGv_i32 ret, TCGv_i32 al, TCGv_i32 ah, 340ad3d0e4dSRichard Henderson unsigned int ofs); 341ad3d0e4dSRichard Henderson void tcg_gen_brcond_i32(TCGCond cond, TCGv_i32 arg1, TCGv_i32 arg2, TCGLabel *); 342ad3d0e4dSRichard Henderson void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, int32_t arg2, TCGLabel *); 343ad3d0e4dSRichard Henderson void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret, 344ad3d0e4dSRichard Henderson TCGv_i32 arg1, TCGv_i32 arg2); 345ad3d0e4dSRichard Henderson void tcg_gen_setcondi_i32(TCGCond cond, TCGv_i32 ret, 346ad3d0e4dSRichard Henderson TCGv_i32 arg1, int32_t arg2); 3473635502dSRichard Henderson void tcg_gen_negsetcond_i32(TCGCond cond, TCGv_i32 ret, 3483635502dSRichard Henderson TCGv_i32 arg1, TCGv_i32 arg2); 34993c86ecdSPaolo Bonzini void tcg_gen_negsetcondi_i32(TCGCond cond, TCGv_i32 ret, 35093c86ecdSPaolo Bonzini TCGv_i32 arg1, int32_t arg2); 351ad3d0e4dSRichard Henderson void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 c1, 352ad3d0e4dSRichard Henderson TCGv_i32 c2, TCGv_i32 v1, TCGv_i32 v2); 353ad3d0e4dSRichard Henderson void tcg_gen_add2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al, 354ad3d0e4dSRichard Henderson TCGv_i32 ah, TCGv_i32 bl, TCGv_i32 bh); 355ad3d0e4dSRichard Henderson void tcg_gen_sub2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al, 356ad3d0e4dSRichard Henderson TCGv_i32 ah, TCGv_i32 bl, TCGv_i32 bh); 357ad3d0e4dSRichard Henderson void tcg_gen_mulu2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2); 358ad3d0e4dSRichard Henderson void tcg_gen_muls2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2); 359ad3d0e4dSRichard Henderson void tcg_gen_mulsu2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2); 360ad3d0e4dSRichard Henderson void tcg_gen_ext8s_i32(TCGv_i32 ret, TCGv_i32 arg); 361ad3d0e4dSRichard Henderson void tcg_gen_ext16s_i32(TCGv_i32 ret, TCGv_i32 arg); 362ad3d0e4dSRichard Henderson void tcg_gen_ext8u_i32(TCGv_i32 ret, TCGv_i32 arg); 363ad3d0e4dSRichard Henderson void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg); 364*f1c29532SRichard Henderson void tcg_gen_ext_i32(TCGv_i32 ret, TCGv_i32 val, MemOp opc); 365ad3d0e4dSRichard Henderson void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags); 366ad3d0e4dSRichard Henderson void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg); 367ad3d0e4dSRichard Henderson void tcg_gen_hswap_i32(TCGv_i32 ret, TCGv_i32 arg); 368ad3d0e4dSRichard Henderson void tcg_gen_smin_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); 369ad3d0e4dSRichard Henderson void tcg_gen_smax_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); 370ad3d0e4dSRichard Henderson void tcg_gen_umin_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); 371ad3d0e4dSRichard Henderson void tcg_gen_umax_i32(TCGv_i32, TCGv_i32 arg1, TCGv_i32 arg2); 372ad3d0e4dSRichard Henderson void tcg_gen_abs_i32(TCGv_i32, TCGv_i32); 373ad3d0e4dSRichard Henderson 374ad3d0e4dSRichard Henderson /* Replicate a value of size @vece from @in to all the lanes in @out */ 375ad3d0e4dSRichard Henderson void tcg_gen_dup_i32(unsigned vece, TCGv_i32 out, TCGv_i32 in); 376ad3d0e4dSRichard Henderson 377ad3d0e4dSRichard Henderson static inline void tcg_gen_discard_i32(TCGv_i32 arg) 378ad3d0e4dSRichard Henderson { 379ad3d0e4dSRichard Henderson tcg_gen_op1_i32(INDEX_op_discard, arg); 380ad3d0e4dSRichard Henderson } 381ad3d0e4dSRichard Henderson 382ad3d0e4dSRichard Henderson static inline void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg) 383ad3d0e4dSRichard Henderson { 384ad3d0e4dSRichard Henderson if (ret != arg) { 385ad3d0e4dSRichard Henderson tcg_gen_op2_i32(INDEX_op_mov_i32, ret, arg); 386ad3d0e4dSRichard Henderson } 387ad3d0e4dSRichard Henderson } 388ad3d0e4dSRichard Henderson 389ad3d0e4dSRichard Henderson static inline void tcg_gen_ld8u_i32(TCGv_i32 ret, TCGv_ptr arg2, 390ad3d0e4dSRichard Henderson tcg_target_long offset) 391ad3d0e4dSRichard Henderson { 392ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i32(INDEX_op_ld8u_i32, ret, arg2, offset); 393ad3d0e4dSRichard Henderson } 394ad3d0e4dSRichard Henderson 395ad3d0e4dSRichard Henderson static inline void tcg_gen_ld8s_i32(TCGv_i32 ret, TCGv_ptr arg2, 396ad3d0e4dSRichard Henderson tcg_target_long offset) 397ad3d0e4dSRichard Henderson { 398ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i32(INDEX_op_ld8s_i32, ret, arg2, offset); 399ad3d0e4dSRichard Henderson } 400ad3d0e4dSRichard Henderson 401ad3d0e4dSRichard Henderson static inline void tcg_gen_ld16u_i32(TCGv_i32 ret, TCGv_ptr arg2, 402ad3d0e4dSRichard Henderson tcg_target_long offset) 403ad3d0e4dSRichard Henderson { 404ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i32(INDEX_op_ld16u_i32, ret, arg2, offset); 405ad3d0e4dSRichard Henderson } 406ad3d0e4dSRichard Henderson 407ad3d0e4dSRichard Henderson static inline void tcg_gen_ld16s_i32(TCGv_i32 ret, TCGv_ptr arg2, 408ad3d0e4dSRichard Henderson tcg_target_long offset) 409ad3d0e4dSRichard Henderson { 410ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i32(INDEX_op_ld16s_i32, ret, arg2, offset); 411ad3d0e4dSRichard Henderson } 412ad3d0e4dSRichard Henderson 413ad3d0e4dSRichard Henderson static inline void tcg_gen_ld_i32(TCGv_i32 ret, TCGv_ptr arg2, 414ad3d0e4dSRichard Henderson tcg_target_long offset) 415ad3d0e4dSRichard Henderson { 416ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i32(INDEX_op_ld_i32, ret, arg2, offset); 417ad3d0e4dSRichard Henderson } 418ad3d0e4dSRichard Henderson 419ad3d0e4dSRichard Henderson static inline void tcg_gen_st8_i32(TCGv_i32 arg1, TCGv_ptr arg2, 420ad3d0e4dSRichard Henderson tcg_target_long offset) 421ad3d0e4dSRichard Henderson { 422ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i32(INDEX_op_st8_i32, arg1, arg2, offset); 423ad3d0e4dSRichard Henderson } 424ad3d0e4dSRichard Henderson 425ad3d0e4dSRichard Henderson static inline void tcg_gen_st16_i32(TCGv_i32 arg1, TCGv_ptr arg2, 426ad3d0e4dSRichard Henderson tcg_target_long offset) 427ad3d0e4dSRichard Henderson { 428ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i32(INDEX_op_st16_i32, arg1, arg2, offset); 429ad3d0e4dSRichard Henderson } 430ad3d0e4dSRichard Henderson 431ad3d0e4dSRichard Henderson static inline void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2, 432ad3d0e4dSRichard Henderson tcg_target_long offset) 433ad3d0e4dSRichard Henderson { 434ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i32(INDEX_op_st_i32, arg1, arg2, offset); 435ad3d0e4dSRichard Henderson } 436ad3d0e4dSRichard Henderson 437ad3d0e4dSRichard Henderson static inline void tcg_gen_add_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 438ad3d0e4dSRichard Henderson { 439ad3d0e4dSRichard Henderson tcg_gen_op3_i32(INDEX_op_add_i32, ret, arg1, arg2); 440ad3d0e4dSRichard Henderson } 441ad3d0e4dSRichard Henderson 442ad3d0e4dSRichard Henderson static inline void tcg_gen_sub_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 443ad3d0e4dSRichard Henderson { 444ad3d0e4dSRichard Henderson tcg_gen_op3_i32(INDEX_op_sub_i32, ret, arg1, arg2); 445ad3d0e4dSRichard Henderson } 446ad3d0e4dSRichard Henderson 447ad3d0e4dSRichard Henderson static inline void tcg_gen_and_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 448ad3d0e4dSRichard Henderson { 449ad3d0e4dSRichard Henderson tcg_gen_op3_i32(INDEX_op_and_i32, ret, arg1, arg2); 450ad3d0e4dSRichard Henderson } 451ad3d0e4dSRichard Henderson 452ad3d0e4dSRichard Henderson static inline void tcg_gen_or_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 453ad3d0e4dSRichard Henderson { 454ad3d0e4dSRichard Henderson tcg_gen_op3_i32(INDEX_op_or_i32, ret, arg1, arg2); 455ad3d0e4dSRichard Henderson } 456ad3d0e4dSRichard Henderson 457ad3d0e4dSRichard Henderson static inline void tcg_gen_xor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 458ad3d0e4dSRichard Henderson { 459ad3d0e4dSRichard Henderson tcg_gen_op3_i32(INDEX_op_xor_i32, ret, arg1, arg2); 460ad3d0e4dSRichard Henderson } 461ad3d0e4dSRichard Henderson 462ad3d0e4dSRichard Henderson static inline void tcg_gen_shl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 463ad3d0e4dSRichard Henderson { 464ad3d0e4dSRichard Henderson tcg_gen_op3_i32(INDEX_op_shl_i32, ret, arg1, arg2); 465ad3d0e4dSRichard Henderson } 466ad3d0e4dSRichard Henderson 467ad3d0e4dSRichard Henderson static inline void tcg_gen_shr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 468ad3d0e4dSRichard Henderson { 469ad3d0e4dSRichard Henderson tcg_gen_op3_i32(INDEX_op_shr_i32, ret, arg1, arg2); 470ad3d0e4dSRichard Henderson } 471ad3d0e4dSRichard Henderson 472ad3d0e4dSRichard Henderson static inline void tcg_gen_sar_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 473ad3d0e4dSRichard Henderson { 474ad3d0e4dSRichard Henderson tcg_gen_op3_i32(INDEX_op_sar_i32, ret, arg1, arg2); 475ad3d0e4dSRichard Henderson } 476ad3d0e4dSRichard Henderson 477ad3d0e4dSRichard Henderson static inline void tcg_gen_mul_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 478ad3d0e4dSRichard Henderson { 479ad3d0e4dSRichard Henderson tcg_gen_op3_i32(INDEX_op_mul_i32, ret, arg1, arg2); 480ad3d0e4dSRichard Henderson } 481ad3d0e4dSRichard Henderson 482ad3d0e4dSRichard Henderson static inline void tcg_gen_neg_i32(TCGv_i32 ret, TCGv_i32 arg) 483ad3d0e4dSRichard Henderson { 484ad3d0e4dSRichard Henderson if (TCG_TARGET_HAS_neg_i32) { 485ad3d0e4dSRichard Henderson tcg_gen_op2_i32(INDEX_op_neg_i32, ret, arg); 486ad3d0e4dSRichard Henderson } else { 487ad3d0e4dSRichard Henderson tcg_gen_subfi_i32(ret, 0, arg); 488ad3d0e4dSRichard Henderson } 489ad3d0e4dSRichard Henderson } 490ad3d0e4dSRichard Henderson 491ad3d0e4dSRichard Henderson static inline void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg) 492ad3d0e4dSRichard Henderson { 493ad3d0e4dSRichard Henderson if (TCG_TARGET_HAS_not_i32) { 494ad3d0e4dSRichard Henderson tcg_gen_op2_i32(INDEX_op_not_i32, ret, arg); 495ad3d0e4dSRichard Henderson } else { 496ad3d0e4dSRichard Henderson tcg_gen_xori_i32(ret, arg, -1); 497ad3d0e4dSRichard Henderson } 498ad3d0e4dSRichard Henderson } 499ad3d0e4dSRichard Henderson 500ad3d0e4dSRichard Henderson /* 64 bit ops */ 501ad3d0e4dSRichard Henderson 502ad3d0e4dSRichard Henderson void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg); 503ad3d0e4dSRichard Henderson void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 504ad3d0e4dSRichard Henderson void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2); 505ad3d0e4dSRichard Henderson void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 506ad3d0e4dSRichard Henderson void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 507ad3d0e4dSRichard Henderson void tcg_gen_ori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 508ad3d0e4dSRichard Henderson void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 509ad3d0e4dSRichard Henderson void tcg_gen_shli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 510ad3d0e4dSRichard Henderson void tcg_gen_shri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 511ad3d0e4dSRichard Henderson void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 512ad3d0e4dSRichard Henderson void tcg_gen_muli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 513ad3d0e4dSRichard Henderson void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 514ad3d0e4dSRichard Henderson void tcg_gen_rem_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 515ad3d0e4dSRichard Henderson void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 516ad3d0e4dSRichard Henderson void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 517ad3d0e4dSRichard Henderson void tcg_gen_andc_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 518ad3d0e4dSRichard Henderson void tcg_gen_eqv_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 519ad3d0e4dSRichard Henderson void tcg_gen_nand_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 520ad3d0e4dSRichard Henderson void tcg_gen_nor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 521ad3d0e4dSRichard Henderson void tcg_gen_orc_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 522ad3d0e4dSRichard Henderson void tcg_gen_clz_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 523ad3d0e4dSRichard Henderson void tcg_gen_ctz_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 524ad3d0e4dSRichard Henderson void tcg_gen_clzi_i64(TCGv_i64 ret, TCGv_i64 arg1, uint64_t arg2); 525ad3d0e4dSRichard Henderson void tcg_gen_ctzi_i64(TCGv_i64 ret, TCGv_i64 arg1, uint64_t arg2); 526ad3d0e4dSRichard Henderson void tcg_gen_clrsb_i64(TCGv_i64 ret, TCGv_i64 arg); 527ad3d0e4dSRichard Henderson void tcg_gen_ctpop_i64(TCGv_i64 a1, TCGv_i64 a2); 528ad3d0e4dSRichard Henderson void tcg_gen_rotl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 529ad3d0e4dSRichard Henderson void tcg_gen_rotli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 530ad3d0e4dSRichard Henderson void tcg_gen_rotr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 531ad3d0e4dSRichard Henderson void tcg_gen_rotri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2); 532ad3d0e4dSRichard Henderson void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2, 533ad3d0e4dSRichard Henderson unsigned int ofs, unsigned int len); 534ad3d0e4dSRichard Henderson void tcg_gen_deposit_z_i64(TCGv_i64 ret, TCGv_i64 arg, 535ad3d0e4dSRichard Henderson unsigned int ofs, unsigned int len); 536ad3d0e4dSRichard Henderson void tcg_gen_extract_i64(TCGv_i64 ret, TCGv_i64 arg, 537ad3d0e4dSRichard Henderson unsigned int ofs, unsigned int len); 538ad3d0e4dSRichard Henderson void tcg_gen_sextract_i64(TCGv_i64 ret, TCGv_i64 arg, 539ad3d0e4dSRichard Henderson unsigned int ofs, unsigned int len); 540ad3d0e4dSRichard Henderson void tcg_gen_extract2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah, 541ad3d0e4dSRichard Henderson unsigned int ofs); 542ad3d0e4dSRichard Henderson void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1, TCGv_i64 arg2, TCGLabel *); 543ad3d0e4dSRichard Henderson void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, TCGLabel *); 544ad3d0e4dSRichard Henderson void tcg_gen_setcond_i64(TCGCond cond, TCGv_i64 ret, 545ad3d0e4dSRichard Henderson TCGv_i64 arg1, TCGv_i64 arg2); 546ad3d0e4dSRichard Henderson void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret, 547ad3d0e4dSRichard Henderson TCGv_i64 arg1, int64_t arg2); 5483635502dSRichard Henderson void tcg_gen_negsetcond_i64(TCGCond cond, TCGv_i64 ret, 5493635502dSRichard Henderson TCGv_i64 arg1, TCGv_i64 arg2); 55093c86ecdSPaolo Bonzini void tcg_gen_negsetcondi_i64(TCGCond cond, TCGv_i64 ret, 55193c86ecdSPaolo Bonzini TCGv_i64 arg1, int64_t arg2); 552ad3d0e4dSRichard Henderson void tcg_gen_movcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 c1, 553ad3d0e4dSRichard Henderson TCGv_i64 c2, TCGv_i64 v1, TCGv_i64 v2); 554ad3d0e4dSRichard Henderson void tcg_gen_add2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al, 555ad3d0e4dSRichard Henderson TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh); 556ad3d0e4dSRichard Henderson void tcg_gen_sub2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al, 557ad3d0e4dSRichard Henderson TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh); 558ad3d0e4dSRichard Henderson void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2); 559ad3d0e4dSRichard Henderson void tcg_gen_muls2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2); 560ad3d0e4dSRichard Henderson void tcg_gen_mulsu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2); 561ad3d0e4dSRichard Henderson void tcg_gen_not_i64(TCGv_i64 ret, TCGv_i64 arg); 562ad3d0e4dSRichard Henderson void tcg_gen_ext8s_i64(TCGv_i64 ret, TCGv_i64 arg); 563ad3d0e4dSRichard Henderson void tcg_gen_ext16s_i64(TCGv_i64 ret, TCGv_i64 arg); 564ad3d0e4dSRichard Henderson void tcg_gen_ext32s_i64(TCGv_i64 ret, TCGv_i64 arg); 565ad3d0e4dSRichard Henderson void tcg_gen_ext8u_i64(TCGv_i64 ret, TCGv_i64 arg); 566ad3d0e4dSRichard Henderson void tcg_gen_ext16u_i64(TCGv_i64 ret, TCGv_i64 arg); 567ad3d0e4dSRichard Henderson void tcg_gen_ext32u_i64(TCGv_i64 ret, TCGv_i64 arg); 568*f1c29532SRichard Henderson void tcg_gen_ext_i64(TCGv_i64 ret, TCGv_i64 val, MemOp opc); 569ad3d0e4dSRichard Henderson void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg, int flags); 570ad3d0e4dSRichard Henderson void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags); 571ad3d0e4dSRichard Henderson void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg); 572ad3d0e4dSRichard Henderson void tcg_gen_hswap_i64(TCGv_i64 ret, TCGv_i64 arg); 573ad3d0e4dSRichard Henderson void tcg_gen_wswap_i64(TCGv_i64 ret, TCGv_i64 arg); 574ad3d0e4dSRichard Henderson void tcg_gen_smin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); 575ad3d0e4dSRichard Henderson void tcg_gen_smax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); 576ad3d0e4dSRichard Henderson void tcg_gen_umin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); 577ad3d0e4dSRichard Henderson void tcg_gen_umax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); 578ad3d0e4dSRichard Henderson void tcg_gen_abs_i64(TCGv_i64, TCGv_i64); 579ad3d0e4dSRichard Henderson 580ad3d0e4dSRichard Henderson /* Replicate a value of size @vece from @in to all the lanes in @out */ 581ad3d0e4dSRichard Henderson void tcg_gen_dup_i64(unsigned vece, TCGv_i64 out, TCGv_i64 in); 582ad3d0e4dSRichard Henderson 583ad3d0e4dSRichard Henderson #if TCG_TARGET_REG_BITS == 64 584ad3d0e4dSRichard Henderson static inline void tcg_gen_discard_i64(TCGv_i64 arg) 585ad3d0e4dSRichard Henderson { 586ad3d0e4dSRichard Henderson tcg_gen_op1_i64(INDEX_op_discard, arg); 587ad3d0e4dSRichard Henderson } 588ad3d0e4dSRichard Henderson 589ad3d0e4dSRichard Henderson static inline void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg) 590ad3d0e4dSRichard Henderson { 591ad3d0e4dSRichard Henderson if (ret != arg) { 592ad3d0e4dSRichard Henderson tcg_gen_op2_i64(INDEX_op_mov_i64, ret, arg); 593ad3d0e4dSRichard Henderson } 594ad3d0e4dSRichard Henderson } 595ad3d0e4dSRichard Henderson 596ad3d0e4dSRichard Henderson static inline void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, 597ad3d0e4dSRichard Henderson tcg_target_long offset) 598ad3d0e4dSRichard Henderson { 599ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_ld8u_i64, ret, arg2, offset); 600ad3d0e4dSRichard Henderson } 601ad3d0e4dSRichard Henderson 602ad3d0e4dSRichard Henderson static inline void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2, 603ad3d0e4dSRichard Henderson tcg_target_long offset) 604ad3d0e4dSRichard Henderson { 605ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_ld8s_i64, ret, arg2, offset); 606ad3d0e4dSRichard Henderson } 607ad3d0e4dSRichard Henderson 608ad3d0e4dSRichard Henderson static inline void tcg_gen_ld16u_i64(TCGv_i64 ret, TCGv_ptr arg2, 609ad3d0e4dSRichard Henderson tcg_target_long offset) 610ad3d0e4dSRichard Henderson { 611ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_ld16u_i64, ret, arg2, offset); 612ad3d0e4dSRichard Henderson } 613ad3d0e4dSRichard Henderson 614ad3d0e4dSRichard Henderson static inline void tcg_gen_ld16s_i64(TCGv_i64 ret, TCGv_ptr arg2, 615ad3d0e4dSRichard Henderson tcg_target_long offset) 616ad3d0e4dSRichard Henderson { 617ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_ld16s_i64, ret, arg2, offset); 618ad3d0e4dSRichard Henderson } 619ad3d0e4dSRichard Henderson 620ad3d0e4dSRichard Henderson static inline void tcg_gen_ld32u_i64(TCGv_i64 ret, TCGv_ptr arg2, 621ad3d0e4dSRichard Henderson tcg_target_long offset) 622ad3d0e4dSRichard Henderson { 623ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_ld32u_i64, ret, arg2, offset); 624ad3d0e4dSRichard Henderson } 625ad3d0e4dSRichard Henderson 626ad3d0e4dSRichard Henderson static inline void tcg_gen_ld32s_i64(TCGv_i64 ret, TCGv_ptr arg2, 627ad3d0e4dSRichard Henderson tcg_target_long offset) 628ad3d0e4dSRichard Henderson { 629ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_ld32s_i64, ret, arg2, offset); 630ad3d0e4dSRichard Henderson } 631ad3d0e4dSRichard Henderson 632ad3d0e4dSRichard Henderson static inline void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, 633ad3d0e4dSRichard Henderson tcg_target_long offset) 634ad3d0e4dSRichard Henderson { 635ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_ld_i64, ret, arg2, offset); 636ad3d0e4dSRichard Henderson } 637ad3d0e4dSRichard Henderson 638ad3d0e4dSRichard Henderson static inline void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2, 639ad3d0e4dSRichard Henderson tcg_target_long offset) 640ad3d0e4dSRichard Henderson { 641ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_st8_i64, arg1, arg2, offset); 642ad3d0e4dSRichard Henderson } 643ad3d0e4dSRichard Henderson 644ad3d0e4dSRichard Henderson static inline void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, 645ad3d0e4dSRichard Henderson tcg_target_long offset) 646ad3d0e4dSRichard Henderson { 647ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_st16_i64, arg1, arg2, offset); 648ad3d0e4dSRichard Henderson } 649ad3d0e4dSRichard Henderson 650ad3d0e4dSRichard Henderson static inline void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, 651ad3d0e4dSRichard Henderson tcg_target_long offset) 652ad3d0e4dSRichard Henderson { 653ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_st32_i64, arg1, arg2, offset); 654ad3d0e4dSRichard Henderson } 655ad3d0e4dSRichard Henderson 656ad3d0e4dSRichard Henderson static inline void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, 657ad3d0e4dSRichard Henderson tcg_target_long offset) 658ad3d0e4dSRichard Henderson { 659ad3d0e4dSRichard Henderson tcg_gen_ldst_op_i64(INDEX_op_st_i64, arg1, arg2, offset); 660ad3d0e4dSRichard Henderson } 661ad3d0e4dSRichard Henderson 662ad3d0e4dSRichard Henderson static inline void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 663ad3d0e4dSRichard Henderson { 664ad3d0e4dSRichard Henderson tcg_gen_op3_i64(INDEX_op_add_i64, ret, arg1, arg2); 665ad3d0e4dSRichard Henderson } 666ad3d0e4dSRichard Henderson 667ad3d0e4dSRichard Henderson static inline void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 668ad3d0e4dSRichard Henderson { 669ad3d0e4dSRichard Henderson tcg_gen_op3_i64(INDEX_op_sub_i64, ret, arg1, arg2); 670ad3d0e4dSRichard Henderson } 671ad3d0e4dSRichard Henderson 672ad3d0e4dSRichard Henderson static inline void tcg_gen_and_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 673ad3d0e4dSRichard Henderson { 674ad3d0e4dSRichard Henderson tcg_gen_op3_i64(INDEX_op_and_i64, ret, arg1, arg2); 675ad3d0e4dSRichard Henderson } 676ad3d0e4dSRichard Henderson 677ad3d0e4dSRichard Henderson static inline void tcg_gen_or_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 678ad3d0e4dSRichard Henderson { 679ad3d0e4dSRichard Henderson tcg_gen_op3_i64(INDEX_op_or_i64, ret, arg1, arg2); 680ad3d0e4dSRichard Henderson } 681ad3d0e4dSRichard Henderson 682ad3d0e4dSRichard Henderson static inline void tcg_gen_xor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 683ad3d0e4dSRichard Henderson { 684ad3d0e4dSRichard Henderson tcg_gen_op3_i64(INDEX_op_xor_i64, ret, arg1, arg2); 685ad3d0e4dSRichard Henderson } 686ad3d0e4dSRichard Henderson 687ad3d0e4dSRichard Henderson static inline void tcg_gen_shl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 688ad3d0e4dSRichard Henderson { 689ad3d0e4dSRichard Henderson tcg_gen_op3_i64(INDEX_op_shl_i64, ret, arg1, arg2); 690ad3d0e4dSRichard Henderson } 691ad3d0e4dSRichard Henderson 692ad3d0e4dSRichard Henderson static inline void tcg_gen_shr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 693ad3d0e4dSRichard Henderson { 694ad3d0e4dSRichard Henderson tcg_gen_op3_i64(INDEX_op_shr_i64, ret, arg1, arg2); 695ad3d0e4dSRichard Henderson } 696ad3d0e4dSRichard Henderson 697ad3d0e4dSRichard Henderson static inline void tcg_gen_sar_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 698ad3d0e4dSRichard Henderson { 699ad3d0e4dSRichard Henderson tcg_gen_op3_i64(INDEX_op_sar_i64, ret, arg1, arg2); 700ad3d0e4dSRichard Henderson } 701ad3d0e4dSRichard Henderson 702ad3d0e4dSRichard Henderson static inline void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 703ad3d0e4dSRichard Henderson { 704ad3d0e4dSRichard Henderson tcg_gen_op3_i64(INDEX_op_mul_i64, ret, arg1, arg2); 705ad3d0e4dSRichard Henderson } 706ad3d0e4dSRichard Henderson #else /* TCG_TARGET_REG_BITS == 32 */ 707ad3d0e4dSRichard Henderson void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset); 708ad3d0e4dSRichard Henderson void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset); 709ad3d0e4dSRichard Henderson void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset); 710ad3d0e4dSRichard Henderson 711ad3d0e4dSRichard Henderson void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 712ad3d0e4dSRichard Henderson void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 713ad3d0e4dSRichard Henderson 714ad3d0e4dSRichard Henderson void tcg_gen_discard_i64(TCGv_i64 arg); 715ad3d0e4dSRichard Henderson void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg); 716ad3d0e4dSRichard Henderson void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); 717ad3d0e4dSRichard Henderson void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); 718ad3d0e4dSRichard Henderson void tcg_gen_ld16u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); 719ad3d0e4dSRichard Henderson void tcg_gen_ld16s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); 720ad3d0e4dSRichard Henderson void tcg_gen_ld32u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); 721ad3d0e4dSRichard Henderson void tcg_gen_ld32s_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); 722ad3d0e4dSRichard Henderson void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset); 723ad3d0e4dSRichard Henderson void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset); 724ad3d0e4dSRichard Henderson void tcg_gen_and_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 725ad3d0e4dSRichard Henderson void tcg_gen_or_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 726ad3d0e4dSRichard Henderson void tcg_gen_xor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 727ad3d0e4dSRichard Henderson void tcg_gen_shl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 728ad3d0e4dSRichard Henderson void tcg_gen_shr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 729ad3d0e4dSRichard Henderson void tcg_gen_sar_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 730ad3d0e4dSRichard Henderson void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2); 731ad3d0e4dSRichard Henderson #endif /* TCG_TARGET_REG_BITS */ 732ad3d0e4dSRichard Henderson 733ad3d0e4dSRichard Henderson static inline void tcg_gen_neg_i64(TCGv_i64 ret, TCGv_i64 arg) 734ad3d0e4dSRichard Henderson { 735ad3d0e4dSRichard Henderson if (TCG_TARGET_HAS_neg_i64) { 736ad3d0e4dSRichard Henderson tcg_gen_op2_i64(INDEX_op_neg_i64, ret, arg); 737ad3d0e4dSRichard Henderson } else { 738ad3d0e4dSRichard Henderson tcg_gen_subfi_i64(ret, 0, arg); 739ad3d0e4dSRichard Henderson } 740ad3d0e4dSRichard Henderson } 741ad3d0e4dSRichard Henderson 742ad3d0e4dSRichard Henderson /* Size changing operations. */ 743ad3d0e4dSRichard Henderson 744ad3d0e4dSRichard Henderson void tcg_gen_extu_i32_i64(TCGv_i64 ret, TCGv_i32 arg); 745ad3d0e4dSRichard Henderson void tcg_gen_ext_i32_i64(TCGv_i64 ret, TCGv_i32 arg); 746ad3d0e4dSRichard Henderson void tcg_gen_concat_i32_i64(TCGv_i64 dest, TCGv_i32 low, TCGv_i32 high); 747ad3d0e4dSRichard Henderson void tcg_gen_extrl_i64_i32(TCGv_i32 ret, TCGv_i64 arg); 748ad3d0e4dSRichard Henderson void tcg_gen_extrh_i64_i32(TCGv_i32 ret, TCGv_i64 arg); 749ad3d0e4dSRichard Henderson void tcg_gen_extr_i64_i32(TCGv_i32 lo, TCGv_i32 hi, TCGv_i64 arg); 750ad3d0e4dSRichard Henderson void tcg_gen_extr32_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i64 arg); 751ad3d0e4dSRichard Henderson 752ad3d0e4dSRichard Henderson void tcg_gen_mov_i128(TCGv_i128 dst, TCGv_i128 src); 753ad3d0e4dSRichard Henderson void tcg_gen_extr_i128_i64(TCGv_i64 lo, TCGv_i64 hi, TCGv_i128 arg); 754ad3d0e4dSRichard Henderson void tcg_gen_concat_i64_i128(TCGv_i128 ret, TCGv_i64 lo, TCGv_i64 hi); 755ad3d0e4dSRichard Henderson 756a01d9792SRichard Henderson void tcg_gen_ld_i128(TCGv_i128 ret, TCGv_ptr base, tcg_target_long offset); 757a01d9792SRichard Henderson void tcg_gen_st_i128(TCGv_i128 val, TCGv_ptr base, tcg_target_long offset); 758a01d9792SRichard Henderson 759ad3d0e4dSRichard Henderson static inline void tcg_gen_concat32_i64(TCGv_i64 ret, TCGv_i64 lo, TCGv_i64 hi) 760ad3d0e4dSRichard Henderson { 761ad3d0e4dSRichard Henderson tcg_gen_deposit_i64(ret, lo, hi, 32, 32); 762ad3d0e4dSRichard Henderson } 763ad3d0e4dSRichard Henderson 764ad3d0e4dSRichard Henderson /* Local load/store bit ops */ 765ad3d0e4dSRichard Henderson 766ad3d0e4dSRichard Henderson void tcg_gen_qemu_ld_i32_chk(TCGv_i32, TCGTemp *, TCGArg, MemOp, TCGType); 767ad3d0e4dSRichard Henderson void tcg_gen_qemu_st_i32_chk(TCGv_i32, TCGTemp *, TCGArg, MemOp, TCGType); 768ad3d0e4dSRichard Henderson void tcg_gen_qemu_ld_i64_chk(TCGv_i64, TCGTemp *, TCGArg, MemOp, TCGType); 769ad3d0e4dSRichard Henderson void tcg_gen_qemu_st_i64_chk(TCGv_i64, TCGTemp *, TCGArg, MemOp, TCGType); 770ad3d0e4dSRichard Henderson void tcg_gen_qemu_ld_i128_chk(TCGv_i128, TCGTemp *, TCGArg, MemOp, TCGType); 771ad3d0e4dSRichard Henderson void tcg_gen_qemu_st_i128_chk(TCGv_i128, TCGTemp *, TCGArg, MemOp, TCGType); 772ad3d0e4dSRichard Henderson 773ad3d0e4dSRichard Henderson /* Atomic ops */ 774ad3d0e4dSRichard Henderson 775ad3d0e4dSRichard Henderson void tcg_gen_atomic_cmpxchg_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, TCGv_i32, 776ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 777ad3d0e4dSRichard Henderson void tcg_gen_atomic_cmpxchg_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, TCGv_i64, 778ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 779ad3d0e4dSRichard Henderson void tcg_gen_atomic_cmpxchg_i128_chk(TCGv_i128, TCGTemp *, TCGv_i128, 780ad3d0e4dSRichard Henderson TCGv_i128, TCGArg, MemOp, TCGType); 781ad3d0e4dSRichard Henderson 782ad3d0e4dSRichard Henderson void tcg_gen_nonatomic_cmpxchg_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, TCGv_i32, 783ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 784ad3d0e4dSRichard Henderson void tcg_gen_nonatomic_cmpxchg_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, TCGv_i64, 785ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 786ad3d0e4dSRichard Henderson void tcg_gen_nonatomic_cmpxchg_i128_chk(TCGv_i128, TCGTemp *, TCGv_i128, 787ad3d0e4dSRichard Henderson TCGv_i128, TCGArg, MemOp, TCGType); 788ad3d0e4dSRichard Henderson 789ad3d0e4dSRichard Henderson void tcg_gen_atomic_xchg_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 790ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 791ad3d0e4dSRichard Henderson void tcg_gen_atomic_xchg_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 792ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 793ad3d0e4dSRichard Henderson 794ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_add_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 795ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 796ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_add_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 797ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 798ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_and_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 799ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 800ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_and_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 801ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 802ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_or_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 803ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 804ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_or_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 805ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 806ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_xor_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 807ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 808ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_xor_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 809ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 810ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_smin_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 811ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 812ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_smin_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 813ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 814ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_umin_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 815ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 816ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_umin_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 817ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 818ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_smax_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 819ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 820ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_smax_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 821ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 822ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_umax_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 823ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 824ad3d0e4dSRichard Henderson void tcg_gen_atomic_fetch_umax_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 825ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 826ad3d0e4dSRichard Henderson 827ad3d0e4dSRichard Henderson void tcg_gen_atomic_add_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 828ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 829ad3d0e4dSRichard Henderson void tcg_gen_atomic_add_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 830ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 831ad3d0e4dSRichard Henderson void tcg_gen_atomic_and_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 832ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 833ad3d0e4dSRichard Henderson void tcg_gen_atomic_and_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 834ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 835ad3d0e4dSRichard Henderson void tcg_gen_atomic_or_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 836ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 837ad3d0e4dSRichard Henderson void tcg_gen_atomic_or_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 838ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 839ad3d0e4dSRichard Henderson void tcg_gen_atomic_xor_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 840ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 841ad3d0e4dSRichard Henderson void tcg_gen_atomic_xor_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 842ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 843ad3d0e4dSRichard Henderson void tcg_gen_atomic_smin_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 844ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 845ad3d0e4dSRichard Henderson void tcg_gen_atomic_smin_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 846ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 847ad3d0e4dSRichard Henderson void tcg_gen_atomic_umin_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 848ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 849ad3d0e4dSRichard Henderson void tcg_gen_atomic_umin_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 850ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 851ad3d0e4dSRichard Henderson void tcg_gen_atomic_smax_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 852ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 853ad3d0e4dSRichard Henderson void tcg_gen_atomic_smax_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 854ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 855ad3d0e4dSRichard Henderson void tcg_gen_atomic_umax_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, 856ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 857ad3d0e4dSRichard Henderson void tcg_gen_atomic_umax_fetch_i64_chk(TCGv_i64, TCGTemp *, TCGv_i64, 858ad3d0e4dSRichard Henderson TCGArg, MemOp, TCGType); 859ad3d0e4dSRichard Henderson 860ad3d0e4dSRichard Henderson /* Vector ops */ 861ad3d0e4dSRichard Henderson 862ad3d0e4dSRichard Henderson void tcg_gen_mov_vec(TCGv_vec, TCGv_vec); 863ad3d0e4dSRichard Henderson void tcg_gen_dup_i32_vec(unsigned vece, TCGv_vec, TCGv_i32); 864ad3d0e4dSRichard Henderson void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec, TCGv_i64); 865ad3d0e4dSRichard Henderson void tcg_gen_dup_mem_vec(unsigned vece, TCGv_vec, TCGv_ptr, tcg_target_long); 866ad3d0e4dSRichard Henderson void tcg_gen_dupi_vec(unsigned vece, TCGv_vec, uint64_t); 867ad3d0e4dSRichard Henderson void tcg_gen_add_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 868ad3d0e4dSRichard Henderson void tcg_gen_sub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 869ad3d0e4dSRichard Henderson void tcg_gen_mul_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 870ad3d0e4dSRichard Henderson void tcg_gen_and_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 871ad3d0e4dSRichard Henderson void tcg_gen_or_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 872ad3d0e4dSRichard Henderson void tcg_gen_xor_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 873ad3d0e4dSRichard Henderson void tcg_gen_andc_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 874ad3d0e4dSRichard Henderson void tcg_gen_orc_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 875ad3d0e4dSRichard Henderson void tcg_gen_nand_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 876ad3d0e4dSRichard Henderson void tcg_gen_nor_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 877ad3d0e4dSRichard Henderson void tcg_gen_eqv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 878ad3d0e4dSRichard Henderson void tcg_gen_not_vec(unsigned vece, TCGv_vec r, TCGv_vec a); 879ad3d0e4dSRichard Henderson void tcg_gen_neg_vec(unsigned vece, TCGv_vec r, TCGv_vec a); 880ad3d0e4dSRichard Henderson void tcg_gen_abs_vec(unsigned vece, TCGv_vec r, TCGv_vec a); 881ad3d0e4dSRichard Henderson void tcg_gen_ssadd_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 882ad3d0e4dSRichard Henderson void tcg_gen_usadd_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 883ad3d0e4dSRichard Henderson void tcg_gen_sssub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 884ad3d0e4dSRichard Henderson void tcg_gen_ussub_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 885ad3d0e4dSRichard Henderson void tcg_gen_smin_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 886ad3d0e4dSRichard Henderson void tcg_gen_umin_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 887ad3d0e4dSRichard Henderson void tcg_gen_smax_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 888ad3d0e4dSRichard Henderson void tcg_gen_umax_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec b); 889ad3d0e4dSRichard Henderson 890ad3d0e4dSRichard Henderson void tcg_gen_shli_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); 891ad3d0e4dSRichard Henderson void tcg_gen_shri_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); 892ad3d0e4dSRichard Henderson void tcg_gen_sari_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); 893ad3d0e4dSRichard Henderson void tcg_gen_rotli_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); 894ad3d0e4dSRichard Henderson void tcg_gen_rotri_vec(unsigned vece, TCGv_vec r, TCGv_vec a, int64_t i); 895ad3d0e4dSRichard Henderson 896ad3d0e4dSRichard Henderson void tcg_gen_shls_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); 897ad3d0e4dSRichard Henderson void tcg_gen_shrs_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); 898ad3d0e4dSRichard Henderson void tcg_gen_sars_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); 899ad3d0e4dSRichard Henderson void tcg_gen_rotls_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_i32 s); 900ad3d0e4dSRichard Henderson 901ad3d0e4dSRichard Henderson void tcg_gen_shlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); 902ad3d0e4dSRichard Henderson void tcg_gen_shrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); 903ad3d0e4dSRichard Henderson void tcg_gen_sarv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); 904ad3d0e4dSRichard Henderson void tcg_gen_rotlv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); 905ad3d0e4dSRichard Henderson void tcg_gen_rotrv_vec(unsigned vece, TCGv_vec r, TCGv_vec a, TCGv_vec s); 906ad3d0e4dSRichard Henderson 907ad3d0e4dSRichard Henderson void tcg_gen_cmp_vec(TCGCond cond, unsigned vece, TCGv_vec r, 908ad3d0e4dSRichard Henderson TCGv_vec a, TCGv_vec b); 909ad3d0e4dSRichard Henderson 910ad3d0e4dSRichard Henderson void tcg_gen_bitsel_vec(unsigned vece, TCGv_vec r, TCGv_vec a, 911ad3d0e4dSRichard Henderson TCGv_vec b, TCGv_vec c); 912ad3d0e4dSRichard Henderson void tcg_gen_cmpsel_vec(TCGCond cond, unsigned vece, TCGv_vec r, 913ad3d0e4dSRichard Henderson TCGv_vec a, TCGv_vec b, TCGv_vec c, TCGv_vec d); 914ad3d0e4dSRichard Henderson 915ad3d0e4dSRichard Henderson void tcg_gen_ld_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset); 916ad3d0e4dSRichard Henderson void tcg_gen_st_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset); 917ad3d0e4dSRichard Henderson void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t); 918ad3d0e4dSRichard Henderson 919ad3d0e4dSRichard Henderson /* Host pointer ops */ 920ad3d0e4dSRichard Henderson 921ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX 922ad3d0e4dSRichard Henderson # define PTR i32 923ad3d0e4dSRichard Henderson # define NAT TCGv_i32 924ad3d0e4dSRichard Henderson #else 925ad3d0e4dSRichard Henderson # define PTR i64 926ad3d0e4dSRichard Henderson # define NAT TCGv_i64 927ad3d0e4dSRichard Henderson #endif 928ad3d0e4dSRichard Henderson 929ad3d0e4dSRichard Henderson static inline void tcg_gen_ld_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t o) 930ad3d0e4dSRichard Henderson { 931ad3d0e4dSRichard Henderson glue(tcg_gen_ld_,PTR)((NAT)r, a, o); 932ad3d0e4dSRichard Henderson } 933ad3d0e4dSRichard Henderson 934ad3d0e4dSRichard Henderson static inline void tcg_gen_st_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t o) 935ad3d0e4dSRichard Henderson { 936ad3d0e4dSRichard Henderson glue(tcg_gen_st_, PTR)((NAT)r, a, o); 937ad3d0e4dSRichard Henderson } 938ad3d0e4dSRichard Henderson 939ad3d0e4dSRichard Henderson static inline void tcg_gen_discard_ptr(TCGv_ptr a) 940ad3d0e4dSRichard Henderson { 941ad3d0e4dSRichard Henderson glue(tcg_gen_discard_,PTR)((NAT)a); 942ad3d0e4dSRichard Henderson } 943ad3d0e4dSRichard Henderson 944ad3d0e4dSRichard Henderson static inline void tcg_gen_add_ptr(TCGv_ptr r, TCGv_ptr a, TCGv_ptr b) 945ad3d0e4dSRichard Henderson { 946ad3d0e4dSRichard Henderson glue(tcg_gen_add_,PTR)((NAT)r, (NAT)a, (NAT)b); 947ad3d0e4dSRichard Henderson } 948ad3d0e4dSRichard Henderson 949ad3d0e4dSRichard Henderson static inline void tcg_gen_addi_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t b) 950ad3d0e4dSRichard Henderson { 951ad3d0e4dSRichard Henderson glue(tcg_gen_addi_,PTR)((NAT)r, (NAT)a, b); 952ad3d0e4dSRichard Henderson } 953ad3d0e4dSRichard Henderson 954ad3d0e4dSRichard Henderson static inline void tcg_gen_mov_ptr(TCGv_ptr d, TCGv_ptr s) 955ad3d0e4dSRichard Henderson { 956ad3d0e4dSRichard Henderson glue(tcg_gen_mov_,PTR)((NAT)d, (NAT)s); 957ad3d0e4dSRichard Henderson } 958ad3d0e4dSRichard Henderson 959ad3d0e4dSRichard Henderson static inline void tcg_gen_movi_ptr(TCGv_ptr d, intptr_t s) 960ad3d0e4dSRichard Henderson { 961ad3d0e4dSRichard Henderson glue(tcg_gen_movi_,PTR)((NAT)d, s); 962ad3d0e4dSRichard Henderson } 963ad3d0e4dSRichard Henderson 964ad3d0e4dSRichard Henderson static inline void tcg_gen_brcondi_ptr(TCGCond cond, TCGv_ptr a, 965ad3d0e4dSRichard Henderson intptr_t b, TCGLabel *label) 966ad3d0e4dSRichard Henderson { 967ad3d0e4dSRichard Henderson glue(tcg_gen_brcondi_,PTR)(cond, (NAT)a, b, label); 968ad3d0e4dSRichard Henderson } 969ad3d0e4dSRichard Henderson 970ad3d0e4dSRichard Henderson static inline void tcg_gen_ext_i32_ptr(TCGv_ptr r, TCGv_i32 a) 971ad3d0e4dSRichard Henderson { 972ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX 973ad3d0e4dSRichard Henderson tcg_gen_mov_i32((NAT)r, a); 974ad3d0e4dSRichard Henderson #else 975ad3d0e4dSRichard Henderson tcg_gen_ext_i32_i64((NAT)r, a); 976ad3d0e4dSRichard Henderson #endif 977ad3d0e4dSRichard Henderson } 978ad3d0e4dSRichard Henderson 979ad3d0e4dSRichard Henderson static inline void tcg_gen_trunc_i64_ptr(TCGv_ptr r, TCGv_i64 a) 980ad3d0e4dSRichard Henderson { 981ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX 982ad3d0e4dSRichard Henderson tcg_gen_extrl_i64_i32((NAT)r, a); 983ad3d0e4dSRichard Henderson #else 984ad3d0e4dSRichard Henderson tcg_gen_mov_i64((NAT)r, a); 985ad3d0e4dSRichard Henderson #endif 986ad3d0e4dSRichard Henderson } 987ad3d0e4dSRichard Henderson 988ad3d0e4dSRichard Henderson static inline void tcg_gen_extu_ptr_i64(TCGv_i64 r, TCGv_ptr a) 989ad3d0e4dSRichard Henderson { 990ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX 991ad3d0e4dSRichard Henderson tcg_gen_extu_i32_i64(r, (NAT)a); 992ad3d0e4dSRichard Henderson #else 993ad3d0e4dSRichard Henderson tcg_gen_mov_i64(r, (NAT)a); 994ad3d0e4dSRichard Henderson #endif 995ad3d0e4dSRichard Henderson } 996ad3d0e4dSRichard Henderson 997ad3d0e4dSRichard Henderson static inline void tcg_gen_trunc_ptr_i32(TCGv_i32 r, TCGv_ptr a) 998ad3d0e4dSRichard Henderson { 999ad3d0e4dSRichard Henderson #if UINTPTR_MAX == UINT32_MAX 1000ad3d0e4dSRichard Henderson tcg_gen_mov_i32(r, (NAT)a); 1001ad3d0e4dSRichard Henderson #else 1002ad3d0e4dSRichard Henderson tcg_gen_extrl_i64_i32(r, (NAT)a); 1003ad3d0e4dSRichard Henderson #endif 1004ad3d0e4dSRichard Henderson } 1005ad3d0e4dSRichard Henderson 1006ad3d0e4dSRichard Henderson #undef PTR 1007ad3d0e4dSRichard Henderson #undef NAT 1008ad3d0e4dSRichard Henderson 1009ad3d0e4dSRichard Henderson #endif /* TCG_TCG_OP_COMMON_H */ 1010