1 /* 2 * compiler/compemu_midfunc_x86.h - Native MIDFUNCS for IA-32 and AMD64 3 * 4 * Copyright (c) 2014 Jens Heitmann of ARAnyM dev team (see AUTHORS) 5 * 6 * Inspired by Christian Bauer's Basilisk II 7 * 8 * Original 68040 JIT compiler for UAE, copyright 2000-2002 Bernd Meyer 9 * 10 * Adaptation for Basilisk II and improvements, copyright 2000-2002 11 * Gwenole Beauchesne 12 * 13 * Basilisk II (C) 1997-2002 Christian Bauer 14 * 15 * This program is free software; you can redistribute it and/or modify 16 * it under the terms of the GNU General Public License as published by 17 * the Free Software Foundation; either version 2 of the License, or 18 * (at your option) any later version. 19 * 20 * This program is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details. 24 * 25 * You should have received a copy of the GNU General Public License 26 * along with this program; if not, write to the Free Software 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 * 29 * Note: 30 * File is included by compemu.h 31 * 32 */ 33 34 DECLARE_MIDFUNC(bt_l_ri(RR4 r, IMM i)); 35 DECLARE_MIDFUNC(bt_l_rr(RR4 r, RR4 b)); 36 DECLARE_MIDFUNC(btc_l_ri(RW4 r, IMM i)); 37 DECLARE_MIDFUNC(btc_l_rr(RW4 r, RR4 b)); 38 DECLARE_MIDFUNC(bts_l_ri(RW4 r, IMM i)); 39 DECLARE_MIDFUNC(bts_l_rr(RW4 r, RR4 b)); 40 DECLARE_MIDFUNC(btr_l_ri(RW4 r, IMM i)); 41 DECLARE_MIDFUNC(btr_l_rr(RW4 r, RR4 b)); 42 DECLARE_MIDFUNC(mov_l_rm(W4 d, IMM s)); 43 DECLARE_MIDFUNC(call_r(RR4 r)); 44 DECLARE_MIDFUNC(sub_l_mi(IMM d, IMM s)); 45 DECLARE_MIDFUNC(mov_l_mi(IMM d, IMM s)); 46 DECLARE_MIDFUNC(mov_w_mi(IMM d, IMM s)); 47 DECLARE_MIDFUNC(mov_b_mi(IMM d, IMM s)); 48 DECLARE_MIDFUNC(rol_b_ri(RW1 r, IMM i)); 49 DECLARE_MIDFUNC(rol_w_ri(RW2 r, IMM i)); 50 DECLARE_MIDFUNC(rol_l_ri(RW4 r, IMM i)); 51 DECLARE_MIDFUNC(rol_l_rr(RW4 d, RR1 r)); 52 DECLARE_MIDFUNC(rol_w_rr(RW2 d, RR1 r)); 53 DECLARE_MIDFUNC(rol_b_rr(RW1 d, RR1 r)); 54 DECLARE_MIDFUNC(shll_l_rr(RW4 d, RR1 r)); 55 DECLARE_MIDFUNC(shll_w_rr(RW2 d, RR1 r)); 56 DECLARE_MIDFUNC(shll_b_rr(RW1 d, RR1 r)); 57 DECLARE_MIDFUNC(ror_b_ri(RR1 r, IMM i)); 58 DECLARE_MIDFUNC(ror_w_ri(RR2 r, IMM i)); 59 DECLARE_MIDFUNC(ror_l_ri(RR4 r, IMM i)); 60 DECLARE_MIDFUNC(ror_l_rr(RR4 d, RR1 r)); 61 DECLARE_MIDFUNC(ror_w_rr(RR2 d, RR1 r)); 62 DECLARE_MIDFUNC(ror_b_rr(RR1 d, RR1 r)); 63 DECLARE_MIDFUNC(shrl_l_rr(RW4 d, RR1 r)); 64 DECLARE_MIDFUNC(shrl_w_rr(RW2 d, RR1 r)); 65 DECLARE_MIDFUNC(shrl_b_rr(RW1 d, RR1 r)); 66 DECLARE_MIDFUNC(shra_l_rr(RW4 d, RR1 r)); 67 DECLARE_MIDFUNC(shra_w_rr(RW2 d, RR1 r)); 68 DECLARE_MIDFUNC(shra_b_rr(RW1 d, RR1 r)); 69 DECLARE_MIDFUNC(shll_l_ri(RW4 r, IMM i)); 70 DECLARE_MIDFUNC(shll_w_ri(RW2 r, IMM i)); 71 DECLARE_MIDFUNC(shll_b_ri(RW1 r, IMM i)); 72 DECLARE_MIDFUNC(shrl_l_ri(RW4 r, IMM i)); 73 DECLARE_MIDFUNC(shrl_w_ri(RW2 r, IMM i)); 74 DECLARE_MIDFUNC(shrl_b_ri(RW1 r, IMM i)); 75 DECLARE_MIDFUNC(shra_l_ri(RW4 r, IMM i)); 76 DECLARE_MIDFUNC(shra_w_ri(RW2 r, IMM i)); 77 DECLARE_MIDFUNC(shra_b_ri(RW1 r, IMM i)); 78 DECLARE_MIDFUNC(setcc(W1 d, IMM cc)); 79 DECLARE_MIDFUNC(setcc_m(IMM d, IMM cc)); 80 DECLARE_MIDFUNC(cmov_l_rr(RW4 d, RR4 s, IMM cc)); 81 DECLARE_MIDFUNC(cmov_l_rm(RW4 d, IMM s, IMM cc)); 82 DECLARE_MIDFUNC(bsf_l_rr(W4 d, RR4 s)); 83 DECLARE_MIDFUNC(pop_m(IMM d)); 84 DECLARE_MIDFUNC(push_m(IMM d)); 85 DECLARE_MIDFUNC(pop_l(W4 d)); 86 DECLARE_MIDFUNC(push_l_i(IMM i)); 87 DECLARE_MIDFUNC(push_l(RR4 s)); 88 DECLARE_MIDFUNC(clear_16(RW4 r)); 89 DECLARE_MIDFUNC(clear_8(RW4 r)); 90 DECLARE_MIDFUNC(sign_extend_32_rr(W4 d, RR2 s)); 91 DECLARE_MIDFUNC(sign_extend_16_rr(W4 d, RR2 s)); 92 DECLARE_MIDFUNC(sign_extend_8_rr(W4 d, RR1 s)); 93 DECLARE_MIDFUNC(zero_extend_16_rr(W4 d, RR2 s)); 94 DECLARE_MIDFUNC(zero_extend_8_rr(W4 d, RR1 s)); 95 DECLARE_MIDFUNC(imul_64_32(RW4 d, RW4 s)); 96 DECLARE_MIDFUNC(mul_64_32(RW4 d, RW4 s)); 97 DECLARE_MIDFUNC(simulate_bsf(W4 tmp, RW4 s)); 98 DECLARE_MIDFUNC(imul_32_32(RW4 d, RR4 s)); 99 DECLARE_MIDFUNC(mul_32_32(RW4 d, RR4 s)); 100 DECLARE_MIDFUNC(mov_b_rr(W1 d, RR1 s)); 101 DECLARE_MIDFUNC(mov_w_rr(W2 d, RR2 s)); 102 DECLARE_MIDFUNC(mov_l_rrm_indexed(W4 d,RR4 baser, RR4 index, IMM factor)); 103 DECLARE_MIDFUNC(mov_w_rrm_indexed(W2 d, RR4 baser, RR4 index, IMM factor)); 104 DECLARE_MIDFUNC(mov_b_rrm_indexed(W1 d, RR4 baser, RR4 index, IMM factor)); 105 DECLARE_MIDFUNC(mov_l_mrr_indexed(RR4 baser, RR4 index, IMM factor, RR4 s)); 106 DECLARE_MIDFUNC(mov_w_mrr_indexed(RR4 baser, RR4 index, IMM factor, RR2 s)); 107 DECLARE_MIDFUNC(mov_b_mrr_indexed(RR4 baser, RR4 index, IMM factor, RR1 s)); 108 DECLARE_MIDFUNC(mov_l_bmrr_indexed(IMM base, RR4 baser, RR4 index, IMM factor, RR4 s)); 109 DECLARE_MIDFUNC(mov_w_bmrr_indexed(IMM base, RR4 baser, RR4 index, IMM factor, RR2 s)); 110 DECLARE_MIDFUNC(mov_b_bmrr_indexed(IMM base, RR4 baser, RR4 index, IMM factor, RR1 s)); 111 DECLARE_MIDFUNC(mov_l_brrm_indexed(W4 d, IMM base, RR4 baser, RR4 index, IMM factor)); 112 DECLARE_MIDFUNC(mov_w_brrm_indexed(W2 d, IMM base, RR4 baser, RR4 index, IMM factor)); 113 DECLARE_MIDFUNC(mov_b_brrm_indexed(W1 d, IMM base, RR4 baser, RR4 index, IMM factor)); 114 DECLARE_MIDFUNC(mov_l_rm_indexed(W4 d, IMM base, RR4 index, IMM factor)); 115 DECLARE_MIDFUNC(mov_l_rR(W4 d, RR4 s, IMM offset)); 116 DECLARE_MIDFUNC(mov_w_rR(W2 d, RR4 s, IMM offset)); 117 DECLARE_MIDFUNC(mov_b_rR(W1 d, RR4 s, IMM offset)); 118 DECLARE_MIDFUNC(mov_l_brR(W4 d, RR4 s, IMM offset)); 119 DECLARE_MIDFUNC(mov_w_brR(W2 d, RR4 s, IMM offset)); 120 DECLARE_MIDFUNC(mov_b_brR(W1 d, RR4 s, IMM offset)); 121 DECLARE_MIDFUNC(mov_l_Ri(RR4 d, IMM i, IMM offset)); 122 DECLARE_MIDFUNC(mov_w_Ri(RR4 d, IMM i, IMM offset)); 123 DECLARE_MIDFUNC(mov_b_Ri(RR4 d, IMM i, IMM offset)); 124 DECLARE_MIDFUNC(mov_l_Rr(RR4 d, RR4 s, IMM offset)); 125 DECLARE_MIDFUNC(mov_w_Rr(RR4 d, RR2 s, IMM offset)); 126 DECLARE_MIDFUNC(mov_b_Rr(RR4 d, RR1 s, IMM offset)); 127 DECLARE_MIDFUNC(lea_l_brr(W4 d, RR4 s, IMM offset)); 128 DECLARE_MIDFUNC(lea_l_brr_indexed(W4 d, RR4 s, RR4 index, IMM factor, IMM offset)); 129 DECLARE_MIDFUNC(lea_l_rr_indexed(W4 d, RR4 s, RR4 index, IMM factor)); 130 DECLARE_MIDFUNC(mov_l_bRr(RR4 d, RR4 s, IMM offset)); 131 DECLARE_MIDFUNC(mov_w_bRr(RR4 d, RR2 s, IMM offset)); 132 DECLARE_MIDFUNC(mov_b_bRr(RR4 d, RR1 s, IMM offset)); 133 DECLARE_MIDFUNC(mid_bswap_32(RW4 r)); 134 DECLARE_MIDFUNC(mid_bswap_16(RW2 r)); 135 DECLARE_MIDFUNC(mov_l_rr(W4 d, RR4 s)); 136 DECLARE_MIDFUNC(mov_l_mr(IMM d, RR4 s)); 137 DECLARE_MIDFUNC(mov_w_mr(IMM d, RR2 s)); 138 DECLARE_MIDFUNC(mov_w_rm(W2 d, IMM s)); 139 DECLARE_MIDFUNC(mov_b_mr(IMM d, RR1 s)); 140 DECLARE_MIDFUNC(mov_b_rm(W1 d, IMM s)); 141 DECLARE_MIDFUNC(mov_l_ri(W4 d, IMM s)); 142 DECLARE_MIDFUNC(mov_w_ri(W2 d, IMM s)); 143 DECLARE_MIDFUNC(mov_b_ri(W1 d, IMM s)); 144 DECLARE_MIDFUNC(add_l_mi(IMM d, IMM s) ); 145 DECLARE_MIDFUNC(add_w_mi(IMM d, IMM s) ); 146 DECLARE_MIDFUNC(add_b_mi(IMM d, IMM s) ); 147 DECLARE_MIDFUNC(test_l_ri(RR4 d, IMM i)); 148 DECLARE_MIDFUNC(test_l_rr(RR4 d, RR4 s)); 149 DECLARE_MIDFUNC(test_w_rr(RR2 d, RR2 s)); 150 DECLARE_MIDFUNC(test_b_rr(RR1 d, RR1 s)); 151 DECLARE_MIDFUNC(and_l_ri(RW4 d, IMM i)); 152 DECLARE_MIDFUNC(and_l(RW4 d, RR4 s)); 153 DECLARE_MIDFUNC(and_w(RW2 d, RR2 s)); 154 DECLARE_MIDFUNC(and_b(RW1 d, RR1 s)); 155 DECLARE_MIDFUNC(or_l_rm(RW4 d, IMM s)); 156 DECLARE_MIDFUNC(or_l_ri(RW4 d, IMM i)); 157 DECLARE_MIDFUNC(or_l(RW4 d, RR4 s)); 158 DECLARE_MIDFUNC(or_w(RW2 d, RR2 s)); 159 DECLARE_MIDFUNC(or_b(RW1 d, RR1 s)); 160 DECLARE_MIDFUNC(adc_l(RW4 d, RR4 s)); 161 DECLARE_MIDFUNC(adc_w(RW2 d, RR2 s)); 162 DECLARE_MIDFUNC(adc_b(RW1 d, RR1 s)); 163 DECLARE_MIDFUNC(add_l(RW4 d, RR4 s)); 164 DECLARE_MIDFUNC(add_w(RW2 d, RR2 s)); 165 DECLARE_MIDFUNC(add_b(RW1 d, RR1 s)); 166 DECLARE_MIDFUNC(sub_l_ri(RW4 d, IMM i)); 167 DECLARE_MIDFUNC(sub_w_ri(RW2 d, IMM i)); 168 DECLARE_MIDFUNC(sub_b_ri(RW1 d, IMM i)); 169 DECLARE_MIDFUNC(add_l_ri(RW4 d, IMM i)); 170 DECLARE_MIDFUNC(add_w_ri(RW2 d, IMM i)); 171 DECLARE_MIDFUNC(add_b_ri(RW1 d, IMM i)); 172 DECLARE_MIDFUNC(sbb_l(RW4 d, RR4 s)); 173 DECLARE_MIDFUNC(sbb_w(RW2 d, RR2 s)); 174 DECLARE_MIDFUNC(sbb_b(RW1 d, RR1 s)); 175 DECLARE_MIDFUNC(sub_l(RW4 d, RR4 s)); 176 DECLARE_MIDFUNC(sub_w(RW2 d, RR2 s)); 177 DECLARE_MIDFUNC(sub_b(RW1 d, RR1 s)); 178 DECLARE_MIDFUNC(cmp_l(RR4 d, RR4 s)); 179 DECLARE_MIDFUNC(cmp_l_ri(RR4 r, IMM i)); 180 DECLARE_MIDFUNC(cmp_w(RR2 d, RR2 s)); 181 DECLARE_MIDFUNC(cmp_b(RR1 d, RR1 s)); 182 DECLARE_MIDFUNC(xor_l(RW4 d, RR4 s)); 183 DECLARE_MIDFUNC(xor_w(RW2 d, RR2 s)); 184 DECLARE_MIDFUNC(xor_b(RW1 d, RR1 s)); 185 DECLARE_MIDFUNC(live_flags(void)); 186 DECLARE_MIDFUNC(dont_care_flags(void)); 187 DECLARE_MIDFUNC(duplicate_carry(void)); 188 DECLARE_MIDFUNC(setcc_for_cntzero(RR4 d, RR4 data, int size)); 189 DECLARE_MIDFUNC(restore_carry(void)); 190 DECLARE_MIDFUNC(start_needflags(void)); 191 DECLARE_MIDFUNC(end_needflags(void)); 192 DECLARE_MIDFUNC(make_flags_live(void)); 193 DECLARE_MIDFUNC(call_r_11(RR4 r, W4 out1, RR4 in1, IMM osize, IMM isize)); 194 DECLARE_MIDFUNC(call_r_02(RR4 r, RR4 in1, RR4 in2, IMM isize1, IMM isize2)); 195 DECLARE_MIDFUNC(forget_about(W4 r)); 196 DECLARE_MIDFUNC(nop(void)); 197 198 DECLARE_MIDFUNC(f_forget_about(FW r)); 199 DECLARE_MIDFUNC(fmov_pi(FW r)); 200 DECLARE_MIDFUNC(fmov_log10_2(FW r)); 201 DECLARE_MIDFUNC(fmov_log2_e(FW r)); 202 DECLARE_MIDFUNC(fmov_loge_2(FW r)); 203 DECLARE_MIDFUNC(fmov_1(FW r)); 204 DECLARE_MIDFUNC(fmov_0(FW r)); 205 DECLARE_MIDFUNC(fmov_rm(FW r, MEMR m)); 206 DECLARE_MIDFUNC(fmov_mr(MEMW m, FR r)); 207 DECLARE_MIDFUNC(fmovi_rm(FW r, MEMR m)); 208 DECLARE_MIDFUNC(fmovi_mr(MEMW m, FR r)); 209 DECLARE_MIDFUNC(fmovi_mrb(MEMW m, FR r, double *bounds)); 210 DECLARE_MIDFUNC(fmovs_rm(FW r, MEMR m)); 211 DECLARE_MIDFUNC(fmovs_mr(MEMW m, FR r)); 212 DECLARE_MIDFUNC(fcuts_r(FRW r)); 213 DECLARE_MIDFUNC(fcut_r(FRW r)); 214 DECLARE_MIDFUNC(fmov_ext_mr(MEMW m, FR r)); 215 DECLARE_MIDFUNC(fmov_ext_rm(FW r, MEMR m)); 216 DECLARE_MIDFUNC(fmov_rr(FW d, FR s)); 217 DECLARE_MIDFUNC(fldcw_m_indexed(RR4 index, IMM base)); 218 DECLARE_MIDFUNC(ftst_r(FR r)); 219 DECLARE_MIDFUNC(dont_care_fflags(void)); 220 DECLARE_MIDFUNC(fsqrt_rr(FW d, FR s)); 221 DECLARE_MIDFUNC(fabs_rr(FW d, FR s)); 222 DECLARE_MIDFUNC(frndint_rr(FW d, FR s)); 223 DECLARE_MIDFUNC(fgetexp_rr(FW d, FR s)); 224 DECLARE_MIDFUNC(fgetman_rr(FW d, FR s)); 225 DECLARE_MIDFUNC(fsin_rr(FW d, FR s)); 226 DECLARE_MIDFUNC(fcos_rr(FW d, FR s)); 227 DECLARE_MIDFUNC(ftan_rr(FW d, FR s)); 228 DECLARE_MIDFUNC(fsincos_rr(FW d, FW c, FR s)); 229 DECLARE_MIDFUNC(fscale_rr(FRW d, FR s)); 230 DECLARE_MIDFUNC(ftwotox_rr(FW d, FR s)); 231 DECLARE_MIDFUNC(fetox_rr(FW d, FR s)); 232 DECLARE_MIDFUNC(fetoxM1_rr(FW d, FR s)); 233 DECLARE_MIDFUNC(ftentox_rr(FW d, FR s)); 234 DECLARE_MIDFUNC(flog2_rr(FW d, FR s)); 235 DECLARE_MIDFUNC(flogN_rr(FW d, FR s)); 236 DECLARE_MIDFUNC(flogNP1_rr(FW d, FR s)); 237 DECLARE_MIDFUNC(flog10_rr(FW d, FR s)); 238 DECLARE_MIDFUNC(fasin_rr(FW d, FR s)); 239 DECLARE_MIDFUNC(facos_rr(FW d, FR s)); 240 DECLARE_MIDFUNC(fatan_rr(FW d, FR s)); 241 DECLARE_MIDFUNC(fatanh_rr(FW d, FR s)); 242 DECLARE_MIDFUNC(fsinh_rr(FW d, FR s)); 243 DECLARE_MIDFUNC(fcosh_rr(FW d, FR s)); 244 DECLARE_MIDFUNC(ftanh_rr(FW d, FR s)); 245 DECLARE_MIDFUNC(fneg_rr(FW d, FR s)); 246 DECLARE_MIDFUNC(fadd_rr(FRW d, FR s)); 247 DECLARE_MIDFUNC(fsub_rr(FRW d, FR s)); 248 DECLARE_MIDFUNC(fmul_rr(FRW d, FR s)); 249 DECLARE_MIDFUNC(frem_rr(FRW d, FR s)); 250 DECLARE_MIDFUNC(frem1_rr(FRW d, FR s)); 251 DECLARE_MIDFUNC(fdiv_rr(FRW d, FR s)); 252 DECLARE_MIDFUNC(fcmp_rr(FR d, FR s)); 253 DECLARE_MIDFUNC(fflags_into_flags(W2 tmp)); 254