Lines Matching full:compiler

2  *    Stack-less Just-In-Time compiler
368 #define INC_SIZE(s) (*inst++ = U8(s), compiler->size += (s))
757 static void reduce_code_size(struct sljit_compiler *compiler) in reduce_code_size() argument
771 label = compiler->labels; in reduce_code_size()
772 jump = compiler->jumps; in reduce_code_size()
865 compiler->size -= size_reduce; in reduce_code_size()
868 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler, sljit_s32 optio… in sljit_generate_code() argument
886 CHECK_PTR(check_sljit_generate_code(compiler)); in sljit_generate_code()
888 reduce_code_size(compiler); in sljit_generate_code()
891 …code = (sljit_u8*)allocate_executable_memory(compiler->size, options, exec_allocator_data, &execut… in sljit_generate_code()
894 reverse_buf(compiler); in sljit_generate_code()
895 buf = compiler->buf; in sljit_generate_code()
898 label = compiler->labels; in sljit_generate_code()
899 jump = compiler->jumps; in sljit_generate_code()
900 const_ = compiler->consts; in sljit_generate_code()
960 SLJIT_ASSERT(code_ptr <= code + compiler->size); in sljit_generate_code()
962 jump = compiler->jumps; in sljit_generate_code()
968 compiler->error = SLJIT_ERR_COMPILED; in sljit_generate_code()
969 compiler->executable_offset = executable_offset; in sljit_generate_code()
970 compiler->executable_size = (sljit_uw)(code_ptr - code); in sljit_generate_code()
1060 inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, immw, arg, argw); \
1069 if (IS_HALFWORD(immw) || compiler->mode32) { \
1073 FAIL_IF(emit_load_imm64(compiler, FAST_IS_REG(arg) ? TMP_REG2 : TMP_REG1, immw)); \
1074 inst = emit_x86_instruction(compiler, 1, FAST_IS_REG(arg) ? TMP_REG2 : TMP_REG1, 0, arg, argw); \
1081 FAIL_IF(emit_do_imm32(compiler, (!compiler->mode32) ? REX_W : 0, (op_eax_imm), immw))
1089 FAIL_IF(emit_do_imm(compiler, (op_eax_imm), immw))
1093 static sljit_s32 emit_byte(struct sljit_compiler *compiler, sljit_u8 byte) in emit_byte() argument
1095 sljit_u8 *inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in emit_byte()
1102 static sljit_s32 emit_mov(struct sljit_compiler *compiler,
1106 #define EMIT_MOV(compiler, dst, dstw, src, srcw) \ argument
1107 FAIL_IF(emit_mov(compiler, dst, dstw, src, srcw));
1109 static sljit_s32 emit_groupf(struct sljit_compiler *compiler,
1113 static sljit_s32 emit_groupf_ext(struct sljit_compiler *compiler,
1117 static SLJIT_INLINE sljit_s32 emit_sse2_store(struct sljit_compiler *compiler,
1120 static SLJIT_INLINE sljit_s32 emit_sse2_load(struct sljit_compiler *compiler,
1123 static sljit_s32 emit_cmp_binary(struct sljit_compiler *compiler,
1127 static sljit_s32 emit_cmov_generic(struct sljit_compiler *compiler, sljit_s32 type,
1131 static SLJIT_INLINE sljit_s32 emit_endbranch(struct sljit_compiler *compiler) in emit_endbranch() argument
1136 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4); in emit_endbranch()
1148 SLJIT_UNUSED_ARG(compiler); in emit_endbranch()
1155 static SLJIT_INLINE sljit_s32 emit_rdssp(struct sljit_compiler *compiler, sljit_s32 reg) in emit_rdssp() argument
1166 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in emit_rdssp()
1183 static SLJIT_INLINE sljit_s32 emit_incssp(struct sljit_compiler *compiler, sljit_s32 reg) in emit_incssp() argument
1194 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in emit_incssp()
1218 static SLJIT_INLINE sljit_s32 adjust_shadow_stack(struct sljit_compiler *compiler, in adjust_shadow_stack() argument
1225 sljit_uw size_before_rdssp_inst = compiler->size; in adjust_shadow_stack()
1228 FAIL_IF(emit_rdssp(compiler, TMP_REG1)); in adjust_shadow_stack()
1231 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(TMP_REG1), 0); in adjust_shadow_stack()
1234 FAIL_IF(emit_cmp_binary (compiler, TMP_REG1, 0, src, srcw)); in adjust_shadow_stack()
1238 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in adjust_shadow_stack()
1242 size_jz_after_cmp_inst = compiler->size; in adjust_shadow_stack()
1247 compiler->mode32 = 1; in adjust_shadow_stack()
1250 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, 1); in adjust_shadow_stack()
1253 FAIL_IF(emit_incssp(compiler, TMP_REG1)); in adjust_shadow_stack()
1256 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in adjust_shadow_stack()
1260 inst[1] = size_before_rdssp_inst - compiler->size; in adjust_shadow_stack()
1262 *jz_after_cmp_inst = compiler->size - size_jz_after_cmp_inst; in adjust_shadow_stack()
1264 SLJIT_UNUSED_ARG(compiler); in adjust_shadow_stack()
1277 static sljit_s32 emit_mov(struct sljit_compiler *compiler, in emit_mov() argument
1284 inst = emit_x86_instruction(compiler, 1, src, 0, dst, dstw); in emit_mov()
1293 return emit_do_imm(compiler, MOV_r_i32 | reg_map[dst], srcw); in emit_mov()
1295 if (!compiler->mode32) { in emit_mov()
1297 return emit_load_imm64(compiler, dst, srcw); in emit_mov()
1300 …return emit_do_imm32(compiler, (reg_map[dst] >= 8) ? REX_B : 0, U8(MOV_r_i32 | reg_lmap[dst]), src… in emit_mov()
1304 if (!compiler->mode32 && NOT_HALFWORD(srcw)) { in emit_mov()
1307 FAIL_IF(emit_load_imm64(compiler, TMP_REG1, srcw)); in emit_mov()
1308 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, dst, dstw); in emit_mov()
1314 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, srcw, dst, dstw); in emit_mov()
1320 inst = emit_x86_instruction(compiler, 1, dst, 0, src, srcw); in emit_mov()
1328 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src, srcw); in emit_mov()
1331 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, dst, dstw); in emit_mov()
1337 static sljit_s32 emit_cmov_generic(struct sljit_compiler *compiler, sljit_s32 type, in emit_cmov_generic() argument
1346 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in emit_cmov_generic()
1351 size = compiler->size; in emit_cmov_generic()
1352 EMIT_MOV(compiler, dst_reg, 0, src, srcw); in emit_cmov_generic()
1354 inst[1] = U8(compiler->size - size); in emit_cmov_generic()
1358 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op) in sljit_emit_op0() argument
1366 CHECK(check_sljit_emit_op0(compiler, op)); in sljit_emit_op0()
1370 return emit_byte(compiler, INT3); in sljit_emit_op0()
1372 return emit_byte(compiler, NOP); in sljit_emit_op0()
1391 compiler->mode32 = op & SLJIT_32; in sljit_emit_op0()
1398 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0); in sljit_emit_op0()
1399 inst = emit_x86_instruction(compiler, 1, SLJIT_R1, 0, SLJIT_R1, 0); in sljit_emit_op0()
1401 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, TMP_REG1, 0); in sljit_emit_op0()
1409 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0); in sljit_emit_op0()
1413 FAIL_IF(emit_byte(compiler, CDQ)); in sljit_emit_op0()
1415 if (!compiler->mode32) { in sljit_emit_op0()
1416 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in sljit_emit_op0()
1422 FAIL_IF(emit_byte(compiler, CDQ)); in sljit_emit_op0()
1427 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in sljit_emit_op0()
1434 size = (!compiler->mode32 || op >= SLJIT_DIVMOD_UW) ? 3 : 2; in sljit_emit_op0()
1436 size = (!compiler->mode32) ? 3 : 2; in sljit_emit_op0()
1438 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in sljit_emit_op0()
1442 if (!compiler->mode32) in sljit_emit_op0()
1449 if (!compiler->mode32) in sljit_emit_op0()
1473 EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0); in sljit_emit_op0()
1476 EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0); in sljit_emit_op0()
1480 return emit_endbranch(compiler); in sljit_emit_op0()
1482 return skip_frames_before_return(compiler); in sljit_emit_op0()
1488 static sljit_s32 emit_mov_byte(struct sljit_compiler *compiler, sljit_s32 sign, in emit_mov_byte() argument
1496 compiler->mode32 = 0; in emit_mov_byte()
1502 return emit_do_imm(compiler, MOV_r_i32 | reg_map[dst], srcw); in emit_mov_byte()
1504 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, srcw, dst, 0); in emit_mov_byte()
1510 …inst = emit_x86_instruction(compiler, 1 | EX86_BYTE_ARG | EX86_NO_REXW, SLJIT_IMM, srcw, dst, dstw… in emit_mov_byte()
1522 EMIT_MOV(compiler, TMP_REG1, 0, src, 0); in emit_mov_byte()
1535 inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, 0xff, dst, 0); in emit_mov_byte()
1541 EMIT_MOV(compiler, TMP_REG1, 0, src, 0); in emit_mov_byte()
1548 FAIL_IF(emit_groupf(compiler, sign ? MOVSX_r_rm8 : MOVZX_r_rm8, dst_r, src, srcw)); in emit_mov_byte()
1552 inst = emit_x86_instruction(compiler, 1 | EX86_REX | EX86_NO_REXW, dst_r, 0, dst, dstw); in emit_mov_byte()
1560 static sljit_s32 emit_prefetch(struct sljit_compiler *compiler, sljit_s32 op, in emit_prefetch() argument
1566 compiler->mode32 = 1; in emit_prefetch()
1569 inst = emit_x86_instruction(compiler, 2, 0, 0, src, srcw); in emit_prefetch()
1584 static sljit_s32 emit_mov_half(struct sljit_compiler *compiler, sljit_s32 sign, in emit_mov_half() argument
1592 compiler->mode32 = 0; in emit_mov_half()
1598 return emit_do_imm(compiler, MOV_r_i32 | reg_map[dst], srcw); in emit_mov_half()
1600 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, srcw, dst, 0); in emit_mov_half()
1606 …inst = emit_x86_instruction(compiler, 1 | EX86_HALF_ARG | EX86_NO_REXW | EX86_PREF_66, SLJIT_IMM, … in emit_mov_half()
1617 FAIL_IF(emit_groupf(compiler, sign ? MOVSX_r_rm16 : MOVZX_r_rm16, dst_r, src, srcw)); in emit_mov_half()
1620 inst = emit_x86_instruction(compiler, 1 | EX86_NO_REXW | EX86_PREF_66, dst_r, 0, dst, dstw); in emit_mov_half()
1628 static sljit_s32 emit_unary(struct sljit_compiler *compiler, sljit_u8 opcode, in emit_unary() argument
1636 inst = emit_x86_instruction(compiler, 1, 0, 0, dst, dstw); in emit_unary()
1644 EMIT_MOV(compiler, dst, 0, src, srcw); in emit_unary()
1645 inst = emit_x86_instruction(compiler, 1, 0, 0, dst, 0); in emit_unary()
1652 EMIT_MOV(compiler, TMP_REG1, 0, src, srcw); in emit_unary()
1653 inst = emit_x86_instruction(compiler, 1, 0, 0, TMP_REG1, 0); in emit_unary()
1657 EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0); in emit_unary()
1666 static sljit_s32 emit_clz_ctz(struct sljit_compiler *compiler, sljit_s32 is_clz, in emit_clz_ctz() argument
1679 …FAIL_IF(emit_groupf(compiler, (is_clz ? LZCNT_r_rm : TZCNT_r_rm) | EX86_PREF_F3, dst_r, src, srcw)… in emit_clz_ctz()
1682 EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0); in emit_clz_ctz()
1686 FAIL_IF(emit_groupf(compiler, is_clz ? BSR_r_rm : BSF_r_rm, dst_r, src, srcw)); in emit_clz_ctz()
1693 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, max); in emit_clz_ctz()
1694 inst = emit_x86_instruction(compiler, 2, dst_r, 0, TMP_REG1, 0); in emit_clz_ctz()
1697 …inst = emit_x86_instruction(compiler, 2, dst_r, 0, SLJIT_MEM0(), is_clz ? (sljit_sw)&emit_clz_arg … in emit_clz_ctz()
1704 FAIL_IF(emit_cmov_generic(compiler, SLJIT_EQUAL, dst_r, SLJIT_IMM, max)); in emit_clz_ctz()
1707 inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, 31, dst_r, 0); in emit_clz_ctz()
1713 max = compiler->mode32 ? (32 + 31) : (64 + 63); in emit_clz_ctz()
1715 max = compiler->mode32 ? 32 : 64; in emit_clz_ctz()
1718 EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_IMM, max); in emit_clz_ctz()
1719 FAIL_IF(emit_groupf(compiler, CMOVE_r_rm, dst_r, TMP_REG2, 0)); in emit_clz_ctz()
1721 FAIL_IF(emit_cmov_generic(compiler, SLJIT_EQUAL, dst_r, SLJIT_IMM, max)); in emit_clz_ctz()
1724 inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, max >> 1, dst_r, 0); in emit_clz_ctz()
1731 EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0); in emit_clz_ctz()
1735 static sljit_s32 emit_bswap(struct sljit_compiler *compiler, in emit_bswap() argument
1751 compiler->mode32 = 1; in emit_bswap()
1759 FAIL_IF(emit_mov_half(compiler, 0, dst_r, 0, src, srcw)); in emit_bswap()
1761 EMIT_MOV(compiler, dst_r, 0, src, srcw); in emit_bswap()
1766 if (!compiler->mode32) in emit_bswap()
1776 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in emit_bswap()
1793 size = compiler->mode32 ? 16 : 48; in emit_bswap()
1798 inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_IMM, (sljit_sw)size, dst_r, 0); in emit_bswap()
1812 return emit_mov_half(compiler, 0, dst, dstw, TMP_REG1, 0); in emit_bswap()
1814 return emit_mov(compiler, dst, dstw, TMP_REG1, 0); in emit_bswap()
1819 compiler->mode32 = 0; in emit_bswap()
1820 inst = emit_x86_instruction(compiler, 1, dst, 0, dst, 0); in emit_bswap()
1829 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op1() argument
1840 CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw)); in sljit_emit_op1()
1847 compiler->mode32 = op_flags & SLJIT_32; in sljit_emit_op1()
1854 compiler->mode32 = 0; in sljit_emit_op1()
1900 return emit_mov(compiler, dst, dstw, src, srcw); in sljit_emit_op1()
1919 EMIT_MOV(compiler, dst, dstw, src, srcw); in sljit_emit_op1()
1922 FAIL_IF(emit_mov_byte(compiler, 0, dst, dstw, src, srcw)); in sljit_emit_op1()
1925 FAIL_IF(emit_mov_byte(compiler, 1, dst, dstw, src, srcw)); in sljit_emit_op1()
1928 FAIL_IF(emit_mov_half(compiler, 0, dst, dstw, src, srcw)); in sljit_emit_op1()
1931 FAIL_IF(emit_mov_half(compiler, 1, dst, dstw, src, srcw)); in sljit_emit_op1()
1935 FAIL_IF(emit_mov_int(compiler, 0, dst, dstw, src, srcw)); in sljit_emit_op1()
1938 FAIL_IF(emit_mov_int(compiler, 1, dst, dstw, src, srcw)); in sljit_emit_op1()
1941 compiler->mode32 = 1; in sljit_emit_op1()
1942 EMIT_MOV(compiler, dst, dstw, src, srcw); in sljit_emit_op1()
1943 compiler->mode32 = 0; in sljit_emit_op1()
1950 return emit_mov(compiler, SLJIT_MEM1(SLJIT_SP), dstw, TMP_REG1, 0); in sljit_emit_op1()
1958 return emit_clz_ctz(compiler, (op == SLJIT_CLZ), dst, dstw, src, srcw); in sljit_emit_op1()
1968 return emit_bswap(compiler, op, dst, dstw, src, srcw); in sljit_emit_op1()
1974 static sljit_s32 emit_cum_binary(struct sljit_compiler *compiler, argument
1989 …if ((dst == SLJIT_R0) && (src2w > 127 || src2w < -128) && (compiler->mode32 || IS_HALFWORD(src2w))…
2000 inst = emit_x86_instruction(compiler, 1, dst, dstw, src2, src2w);
2006 inst = emit_x86_instruction(compiler, 1, src2, src2w, dst, dstw);
2011 EMIT_MOV(compiler, TMP_REG1, 0, src2, src2w);
2012 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, dst, dstw);
2023 …if ((dst == SLJIT_R0) && (src1w > 127 || src1w < -128) && (compiler->mode32 || IS_HALFWORD(src1w))…
2034 inst = emit_x86_instruction(compiler, 1, dst, dstw, src1, src1w);
2039 inst = emit_x86_instruction(compiler, 1, src1, src1w, dst, dstw);
2044 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2045 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, dst, dstw);
2054 EMIT_MOV(compiler, dst, 0, src1, src1w);
2059 inst = emit_x86_instruction(compiler, 1, dst, 0, src2, src2w);
2066 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2071 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src2, src2w);
2075 EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);
2081 static sljit_s32 emit_non_cum_binary(struct sljit_compiler *compiler, argument
2096 …if ((dst == SLJIT_R0) && (src2w > 127 || src2w < -128) && (compiler->mode32 || IS_HALFWORD(src2w))…
2107 inst = emit_x86_instruction(compiler, 1, dst, dstw, src2, src2w);
2112 inst = emit_x86_instruction(compiler, 1, src2, src2w, dst, dstw);
2117 EMIT_MOV(compiler, TMP_REG1, 0, src2, src2w);
2118 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, dst, dstw);
2127 EMIT_MOV(compiler, dst, 0, src1, src1w);
2132 inst = emit_x86_instruction(compiler, 1, dst, 0, src2, src2w);
2139 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2144 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src2, src2w);
2148 EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);
2154 static sljit_s32 emit_mul(struct sljit_compiler *compiler, argument
2164 FAIL_IF(emit_groupf(compiler, IMUL_r_rm, dst_r, src2, src2w));
2166 FAIL_IF(emit_groupf(compiler, IMUL_r_rm, dst_r, src1, src1w));
2169 EMIT_MOV(compiler, dst_r, 0, SLJIT_IMM, src2w);
2175 inst = emit_x86_instruction(compiler, 1, dst_r, 0, src2, src2w);
2179 FAIL_IF(emit_byte(compiler, U8(src1w)));
2183 inst = emit_x86_instruction(compiler, 1, dst_r, 0, src2, src2w);
2186 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
2193 inst = emit_x86_instruction(compiler, 1, dst_r, 0, src2, src2w);
2196 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
2203 EMIT_MOV(compiler, dst_r, 0, src2, src2w);
2204 FAIL_IF(emit_load_imm64(compiler, TMP_REG2, src1w));
2205 FAIL_IF(emit_groupf(compiler, IMUL_r_rm, dst_r, TMP_REG2, 0));
2213 inst = emit_x86_instruction(compiler, 1, dst_r, 0, src1, src1w);
2217 FAIL_IF(emit_byte(compiler, U8(src2w)));
2221 inst = emit_x86_instruction(compiler, 1, dst_r, 0, src1, src1w);
2225 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
2232 inst = emit_x86_instruction(compiler, 1, dst_r, 0, src1, src1w);
2236 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
2242 EMIT_MOV(compiler, dst_r, 0, src1, src1w);
2243 FAIL_IF(emit_load_imm64(compiler, TMP_REG2, src2w));
2244 FAIL_IF(emit_groupf(compiler, IMUL_r_rm, dst_r, TMP_REG2, 0));
2251 EMIT_MOV(compiler, dst_r, 0, src1, src1w);
2252 FAIL_IF(emit_groupf(compiler, IMUL_r_rm, dst_r, src2, src2w));
2256 EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);
2261 static sljit_s32 emit_lea_binary(struct sljit_compiler *compiler, argument
2279 inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM2(src1, src2), 0);
2285 if (src2 == SLJIT_IMM && (compiler->mode32 || IS_HALFWORD(src2w))) {
2286 inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src1), (sljit_s32)src2w);
2289 inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src1), src2w);
2298 if (src1 == SLJIT_IMM && (compiler->mode32 || IS_HALFWORD(src1w))) {
2299 inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src2), (sljit_s32)src1w);
2302 inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src2), src1w);
2312 return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
2318 static sljit_s32 emit_cmp_binary(struct sljit_compiler *compiler, argument
2325 …if (src1 == SLJIT_R0 && src2 == SLJIT_IMM && (src2w > 127 || src2w < -128) && (compiler->mode32 ||…
2338 inst = emit_x86_instruction(compiler, 1, src1, 0, src2, src2w);
2346 inst = emit_x86_instruction(compiler, 1, src2, 0, src1, src1w);
2354 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2361 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2362 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src2, src2w);
2369 static sljit_s32 emit_test_binary(struct sljit_compiler *compiler, argument
2376 …if (src1 == SLJIT_R0 && src2 == SLJIT_IMM && (src2w > 127 || src2w < -128) && (compiler->mode32 ||…
2385 …if (src2 == SLJIT_R0 && src1 == SLJIT_IMM && (src1w > 127 || src1w < -128) && (compiler->mode32 ||…
2396 if (IS_HALFWORD(src2w) || compiler->mode32) {
2397 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src2w, src1, src1w);
2401 FAIL_IF(emit_load_imm64(compiler, FAST_IS_REG(src1) ? TMP_REG2 : TMP_REG1, src2w));
2402 … inst = emit_x86_instruction(compiler, 1, FAST_IS_REG(src1) ? TMP_REG2 : TMP_REG1, 0, src1, src1w);
2407 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src2w, src1, src1w);
2414 inst = emit_x86_instruction(compiler, 1, src1, 0, src2, src2w);
2424 if (IS_HALFWORD(src1w) || compiler->mode32) {
2425 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src1w, src2, src2w);
2430 FAIL_IF(emit_load_imm64(compiler, TMP_REG1, src1w));
2431 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src2, src2w);
2436 inst = emit_x86_instruction(compiler, 1, src1, src1w, src2, src2w);
2443 inst = emit_x86_instruction(compiler, 1, src2, 0, src1, src1w);
2450 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2453 if (IS_HALFWORD(src2w) || compiler->mode32) {
2454 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src2w, TMP_REG1, 0);
2459 FAIL_IF(emit_load_imm64(compiler, TMP_REG2, src2w));
2460 inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, TMP_REG1, 0);
2465 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src2w, TMP_REG1, 0);
2471 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src2, src2w);
2478 static sljit_s32 emit_shift(struct sljit_compiler *compiler, argument
2491 inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, src2, src2w, dst, dstw);
2497 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2498 inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
2501 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
2505 EMIT_MOV(compiler, dst, 0, src1, src1w);
2506 inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, src2, src2w, dst, 0);
2512 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2513 inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, src2, src2w, TMP_REG1, 0);
2516 EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);
2521 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2522 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src2, src2w);
2523 inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
2526 return emit_mov(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
2531 EMIT_MOV(compiler, dst, 0, src1, src1w);
2533 mode32 = compiler->mode32;
2534 compiler->mode32 = 0;
2536 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
2538 compiler->mode32 = mode32;
2540 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src2, src2w);
2541 inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, dst, 0);
2545 compiler->mode32 = 0;
2547 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
2549 compiler->mode32 = mode32;
2556 EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
2558 EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), 0, SLJIT_PREF_SHIFT_REG, 0);
2560 mode32 = compiler->mode32;
2561 compiler->mode32 = 0;
2562 EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_PREF_SHIFT_REG, 0);
2563 compiler->mode32 = mode32;
2566 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src2, src2w);
2567 inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
2572 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, SLJIT_MEM1(SLJIT_SP), 0);
2574 compiler->mode32 = 0;
2575 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG2, 0);
2576 compiler->mode32 = mode32;
2580 return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
2585 static sljit_s32 emit_shift_with_flags(struct sljit_compiler *compiler, argument
2594 src2w &= compiler->mode32 ? 0x1f : 0x3f;
2599 return emit_shift(compiler, mode, dst, dstw, src1, src1w, src2, src2w);
2602 return emit_mov(compiler, dst, dstw, src1, src1w);
2604 return emit_cum_binary(compiler, BINARY_OPCODE(OR),
2609 return emit_shift(compiler, mode, dst, dstw, src1, src1w, src2, src2w);
2612 FAIL_IF(emit_cmp_binary(compiler, src1, src1w, SLJIT_IMM, 0));
2614 FAIL_IF(emit_shift(compiler, mode, dst, dstw, src1, src1w, src2, src2w));
2617 return emit_cmp_binary(compiler, dst, dstw, SLJIT_IMM, 0);
2621 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op, argument
2627 CHECK(check_sljit_emit_op2(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w));
2636 compiler->mode32 = op & SLJIT_32;
2642 if (emit_lea_binary(compiler, dst, dstw, src1, src1w, src2, src2w) != SLJIT_ERR_UNSUPPORTED)
2643 return compiler->error;
2645 return emit_cum_binary(compiler, BINARY_OPCODE(ADD),
2648 return emit_cum_binary(compiler, BINARY_OPCODE(ADC),
2652 return emit_unary(compiler, NEG_rm, dst, dstw, src2, src2w);
2655 …if (src2 == SLJIT_IMM && emit_lea_binary(compiler, dst, dstw, src1, src1w, SLJIT_IMM, -src2w) != S…
2656 return compiler->error;
2658 FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB), dst, 0, dst, 0, src1, src1w));
2659 return emit_unary(compiler, NEG_rm, dst, 0, dst, 0);
2663 return emit_non_cum_binary(compiler, BINARY_OPCODE(SUB),
2666 return emit_non_cum_binary(compiler, BINARY_OPCODE(SBB),
2669 return emit_mul(compiler, dst, dstw, src1, src1w, src2, src2w);
2671 return emit_cum_binary(compiler, BINARY_OPCODE(AND),
2674 return emit_cum_binary(compiler, BINARY_OPCODE(OR),
2679 return emit_unary(compiler, NOT_rm, dst, dstw, src1, src1w);
2681 return emit_unary(compiler, NOT_rm, dst, dstw, src2, src2w);
2684 return emit_cum_binary(compiler, BINARY_OPCODE(XOR),
2688 return emit_shift_with_flags(compiler, SHL, HAS_FLAGS(op),
2692 return emit_shift_with_flags(compiler, SHR, HAS_FLAGS(op),
2696 return emit_shift_with_flags(compiler, SAR, HAS_FLAGS(op),
2699 return emit_shift_with_flags(compiler, ROL, 0,
2702 return emit_shift_with_flags(compiler, ROR, 0,
2709 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2u(struct sljit_compiler *compiler, sljit_s32 op, argument
2716 CHECK(check_sljit_emit_op2(compiler, op, 1, 0, 0, src1, src1w, src2, src2w));
2719 SLJIT_SKIP_CHECKS(compiler);
2720 return sljit_emit_op2(compiler, op, TMP_REG1, 0, src1, src1w, src2, src2w);
2729 compiler->mode32 = op & SLJIT_32;
2733 return emit_cmp_binary(compiler, src1, src1w, src2, src2w);
2735 return emit_test_binary(compiler, src1, src1w, src2, src2w);
2738 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2r(struct sljit_compiler *compiler, sljit_s32 op, argument
2747 CHECK(check_sljit_emit_op2r(compiler, op, dst_reg, src1, src1w, src2, src2w));
2755 compiler->mode32 = op & SLJIT_32;
2760 FAIL_IF(emit_mul(compiler, TMP_REG1, 0, src1, src1w, src2, src2w));
2761 inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, dst_reg, dstw);
2770 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_shift_into(struct sljit_compiler *compiler, sljit_s32… argument
2788 CHECK(check_sljit_emit_shift_into(compiler, op, dst_reg, src1_reg, src2_reg, src3, src3w));
2795 compiler->mode32 = op & SLJIT_32;
2816 return emit_shift(compiler, is_left ? ROL : ROR, dst_reg, dstw, src1_reg, src1w, src3, src3w);
2820 EMIT_MOV(compiler, TMP_REG1, 0, src2_reg, src2w);
2827 EMIT_MOV(compiler, TMP_REG1, 0, src1_reg, src1w);
2832 EMIT_MOV(compiler, TMP_REG1, 0, src1_reg, src1w);
2837 EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), sizeof(sljit_s32), restore_sp4, 0);
2838 EMIT_MOV(compiler, restore_sp4, 0, src1_reg, src1w);
2842 EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), sizeof(sljit_s32), src1_reg, 0);
2848 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src3, src3w);
2852 compiler->mode32 = 0;
2854 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
2856 compiler->mode32 = op & SLJIT_32;
2866 EMIT_MOV(compiler, dst_reg, 0, src1_reg, src1w);
2875 EMIT_MOV(compiler, TMP_REG1, 0, src1_reg, src1w);
2880 EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), sizeof(sljit_s32), restore_sp4, 0);
2881 EMIT_MOV(compiler, restore_sp4, 0, src1_reg, src1w);
2885 EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), sizeof(sljit_s32), src1_reg, 0);
2890 EMIT_MOV(compiler, dst_reg, 0, src1_reg, src1w);
2901 compiler->mode32 = 0;
2902 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
2903 compiler->mode32 = op & SLJIT_32;
2907 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
2910 EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), 0, SLJIT_PREF_SHIFT_REG, 0);
2915 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src3, src3w);
2919 EMIT_MOV(compiler, dst_reg, 0, src1_reg, src1w);
2925 inst = emit_x86_instruction(compiler, 2, src2_reg, 0, src1_reg, src1w);
2933 FAIL_IF(emit_byte(compiler, U8(src3w)));
2939 compiler->mode32 = 0;
2940 EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
2944 compiler->mode32 = op & SLJIT_32;
2945 return emit_mov(compiler, dst_reg, dstw, src1_reg, 0);
2949 …EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, restore_ecx == 1 ? TMP_REG1 : SLJIT_MEM1(SLJIT_SP), 0);
2952 EMIT_MOV(compiler, dst_reg, dstw, src1_reg, 0);
2955 return emit_mov(compiler, restore_sp4, 0, SLJIT_MEM1(SLJIT_SP), sizeof(sljit_s32));
2961 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op, argument
2965 CHECK(check_sljit_emit_op_src(compiler, op, src, srcw));
2972 return emit_fast_return(compiler, src, srcw);
2977 return adjust_shadow_stack(compiler, src, srcw);
2982 return emit_prefetch(compiler, op, src, srcw);
2988 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_dst(struct sljit_compiler *compiler, sljit_s32 op, argument
2992 CHECK(check_sljit_emit_op_dst(compiler, op, dst, dstw));
2999 return emit_fast_enter(compiler, dst, dstw);
3001 return sljit_emit_get_return_address(compiler, dst, dstw);
3025 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler, argument
3031 CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
3033 inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
3065 static sljit_s32 emit_groupf(struct sljit_compiler *compiler, argument
3069 sljit_u8 *inst = emit_x86_instruction(compiler, 2 | (op & ~(sljit_uw)0xff), dst, 0, src, srcw);
3076 static sljit_s32 emit_groupf_ext(struct sljit_compiler *compiler, argument
3084 …inst = emit_x86_instruction(compiler, 3 | (op & ~((sljit_uw)0xff | VEX_OP_0F38 | VEX_OP_0F3A)), ds…
3092 static SLJIT_INLINE sljit_s32 emit_sse2_load(struct sljit_compiler *compiler, argument
3095 …return emit_groupf(compiler, MOVSD_x_xm | (single ? EX86_PREF_F3 : EX86_PREF_F2) | EX86_SSE2, dst,…
3098 static SLJIT_INLINE sljit_s32 emit_sse2_store(struct sljit_compiler *compiler, argument
3101 …return emit_groupf(compiler, MOVSD_xm_x | (single ? EX86_PREF_F3 : EX86_PREF_F2) | EX86_SSE2, src,…
3104 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, slj… argument
3115 compiler->mode32 = 0;
3118 …FAIL_IF(emit_groupf(compiler, CVTTSD2SI_r_xm | EX86_SELECT_F2_F3(op) | EX86_SSE2_OP2, dst_r, src, …
3121 return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
3125 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, slj… argument
3135 compiler->mode32 = 0;
3143 EMIT_MOV(compiler, TMP_REG1, 0, src, srcw);
3148 …FAIL_IF(emit_groupf(compiler, CVTSI2SD_x_rm | EX86_SELECT_F2_F3(op) | EX86_SSE2_OP1, dst_r, src, s…
3151 compiler->mode32 = 1;
3154 return emit_sse2_store(compiler, op & SLJIT_32, dst, dstw, TMP_FREG);
3158 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op, argument
3165 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src1, src1w));
3166 …FAIL_IF(emit_groupf(compiler, CMPS_x_xm | EX86_SELECT_F2_F3(op) | EX86_SSE2, TMP_FREG, src2, src2w…
3169 FAIL_IF(emit_byte(compiler, 0));
3180 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src2, src2w));
3184 return emit_groupf(compiler, UCOMISD_x_xm | EX86_SELECT_66(op) | EX86_SSE2, src2, src1, src1w);
3188 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src1, src1w));
3192 return emit_groupf(compiler, UCOMISD_x_xm | EX86_SELECT_66(op) | EX86_SSE2, src1, src2, src2w);
3195 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, argument
3203 compiler->mode32 = 1;
3207 SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
3211 return emit_sse2_load(compiler, op & SLJIT_32, dst, src, srcw);
3213 return emit_sse2_store(compiler, op & SLJIT_32, dst, dstw, src);
3214 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src, srcw));
3215 return emit_sse2_store(compiler, op & SLJIT_32, dst, dstw, TMP_FREG);
3224 …FAIL_IF(emit_groupf(compiler, UNPCKLPD_x_xm | ((op & SLJIT_32) ? EX86_PREF_66 : 0) | EX86_SSE2, sr…
3226 FAIL_IF(emit_sse2_load(compiler, !(op & SLJIT_32), TMP_FREG, src, srcw));
3230 …FAIL_IF(emit_groupf(compiler, CVTPD2PS_x_xm | ((op & SLJIT_32) ? EX86_PREF_66 : 0) | EX86_SSE2, ds…
3232 return emit_sse2_store(compiler, op & SLJIT_32, dst, dstw, TMP_FREG);
3240 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src, srcw));
3242 FAIL_IF(emit_groupf(compiler, PCMPEQD_x_xm | EX86_PREF_66 | EX86_SSE2, dst_r, dst_r, 0));
3244 inst = emit_x86_instruction(compiler, 2 | EX86_PREF_66 | EX86_SSE2_OP2, 0, 0, dst_r, 0);
3251 FAIL_IF(emit_byte(compiler, 1));
3254 FAIL_IF(emit_byte(compiler, ((op & SLJIT_32) ? 31 : 63)));
3259 …return emit_groupf(compiler, (GET_OPCODE(op) == SLJIT_NEG_F64 ? XORPD_x_xm : ANDPD_x_xm) | EX86_SS…
3262 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src, srcw));
3266 …FAIL_IF(emit_groupf(compiler, XORPD_x_xm | EX86_SELECT_66(op) | EX86_SSE2, TMP_FREG, SLJIT_MEM0(),…
3270 …FAIL_IF(emit_groupf(compiler, ANDPD_x_xm | EX86_SELECT_66(op) | EX86_SSE2, TMP_FREG, SLJIT_MEM0(),…
3274 return emit_sse2_store(compiler, op & SLJIT_32, dst, dstw, TMP_FREG);
3277 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, argument
3285 CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
3291 compiler->mode32 = 1;
3303 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, dst_r, src1, src1w));
3306 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src1, src1w));
3310 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src1, src1w));
3315 …FAIL_IF(emit_groupf(compiler, ADDSD_x_xm | EX86_SELECT_F2_F3(op) | EX86_SSE2, dst_r, src2, src2w));
3319 …FAIL_IF(emit_groupf(compiler, SUBSD_x_xm | EX86_SELECT_F2_F3(op) | EX86_SSE2, dst_r, src2, src2w));
3323 …FAIL_IF(emit_groupf(compiler, MULSD_x_xm | EX86_SELECT_F2_F3(op) | EX86_SSE2, dst_r, src2, src2w));
3327 …FAIL_IF(emit_groupf(compiler, DIVSD_x_xm | EX86_SELECT_F2_F3(op) | EX86_SSE2, dst_r, src2, src2w));
3332 return emit_sse2_store(compiler, op & SLJIT_32, dst, dstw, TMP_FREG);
3336 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2r(struct sljit_compiler *compiler, sljit_s32 op, argument
3344 CHECK(check_sljit_emit_fop2r(compiler, op, dst_freg, src1, src1w, src2, src2w));
3349 compiler->mode32 = 1;
3353 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src2, src2w));
3355 FAIL_IF(emit_groupf(compiler, XORPD_x_xm | pref, TMP_FREG, src1, src1w));
3356 …FAIL_IF(emit_groupf(compiler, ANDPD_x_xm | pref, TMP_FREG, SLJIT_MEM0(), (sljit_sw)((op & SLJIT_32…
3357 return emit_groupf(compiler, XORPD_x_xm | pref, dst_freg, TMP_FREG, 0);
3361 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, TMP_FREG, src1, src1w));
3367 FAIL_IF(emit_sse2_load(compiler, op & SLJIT_32, dst_freg, src2, src2w));
3370 FAIL_IF(emit_groupf(compiler, XORPD_x_xm | pref, dst_freg, src1, src1w));
3371 …FAIL_IF(emit_groupf(compiler, ANDPD_x_xm | pref, dst_freg, SLJIT_MEM0(), (sljit_sw)((op & SLJIT_32…
3372 return emit_groupf(compiler, XORPD_x_xm | pref, dst_freg, src1, src1w);
3379 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler) argument
3385 CHECK_PTR(check_sljit_emit_label(compiler));
3387 if (compiler->last_label && compiler->last_label->size == compiler->size)
3388 return compiler->last_label;
3390 label = (struct sljit_label*)ensure_abuf(compiler, sizeof(struct sljit_label));
3392 set_label(label, compiler);
3394 inst = (sljit_u8*)ensure_buf(compiler, 1);
3401 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_… argument
3407 CHECK_PTR(check_sljit_emit_jump(compiler, type));
3409 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
3411 …set_jump(jump, compiler, (sljit_u32)((type & SLJIT_REWRITABLE_JUMP) | ((type & 0xff) << TYPE_SHIFT…
3414 jump->addr = compiler->size;
3416 compiler->size += (type >= SLJIT_JUMP) ? JUMP_MAX_SIZE : CJUMP_MAX_SIZE;
3417 inst = (sljit_u8*)ensure_buf(compiler, 1);
3424 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type… argument
3430 CHECK(check_sljit_emit_ijump(compiler, type, src, srcw));
3436 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
3438 set_jump(jump, compiler, (sljit_u32)(JUMP_ADDR | (type << TYPE_SHIFT)));
3441 jump->addr = compiler->size;
3443 compiler->size += JUMP_MAX_SIZE;
3444 inst = (sljit_u8*)ensure_buf(compiler, 1);
3451 compiler->mode32 = 1;
3453 inst = emit_x86_instruction(compiler, 1, 0, 0, src, srcw);
3461 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 o… argument
3475 CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
3485 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + 3);
3501 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + 4);
3519 compiler->mode32 = GET_OPCODE(op) != SLJIT_MOV;
3520 return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
3523 SLJIT_SKIP_CHECKS(compiler);
3524 return sljit_emit_op2(compiler, op, dst_save, dstw_save, dst_save, dstw_save, TMP_REG1, 0);
3532 inst = (sljit_u8*)ensure_buf(compiler, 1 + 3 + 3);
3547 inst = (sljit_u8*)ensure_buf(compiler, 1 + 3 + 2);
3561 inst = (sljit_u8*)ensure_buf(compiler, 1 + 3 + 3);
3574 return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
3576 SLJIT_SKIP_CHECKS(compiler);
3577 return sljit_emit_op2(compiler, op, dst_save, dstw_save, dst_save, dstw_save, TMP_REG1, 0);
3581 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fselect(struct sljit_compiler *compiler, sljit_s32 ty… argument
3590 CHECK(check_sljit_emit_fselect(compiler, type, dst_freg, src1, src1w, src2_freg));
3595 compiler->mode32 = 1;
3604 FAIL_IF(emit_sse2_load(compiler, type & SLJIT_32, dst_freg, src2_freg, 0));
3607 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2);
3612 size = compiler->size;
3613 FAIL_IF(emit_sse2_load(compiler, type & SLJIT_32, dst_freg, src1, src1w));
3615 inst[1] = U8(compiler->size - size);
3619 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_mov(struct sljit_compiler *compiler, sljit_s32 t… argument
3629 CHECK(check_sljit_emit_simd_mov(compiler, type, freg, srcdst, srcdstw));
3634 compiler->mode32 = 1;
3672 …if ((op & VEX_256) || ((cpu_feature_list & CPU_FEATURE_AVX) && (compiler->options & SLJIT_ENTER_US…
3673 return emit_vex_instruction(compiler, op, freg, 0, srcdst, srcdstw);
3675 return emit_groupf(compiler, op, freg, srcdst, srcdstw);
3678 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_replicate(struct sljit_compiler *compiler, sljit… argument
3684 …sljit_s32 use_vex = (cpu_feature_list & CPU_FEATURE_AVX) && (compiler->options & SLJIT_ENTER_USE_V…
3690 CHECK(check_sljit_emit_simd_replicate(compiler, type, freg, src, srcw));
3702 compiler->mode32 = 1;
3754 compiler->mode32 = 0;
3756 …FAIL_IF(emit_vex_instruction(compiler, MOVD_x_rm | VEX_AUTO_W | EX86_PREF_66 | EX86_SSE2_OP1, freg…
3758 compiler->mode32 = 1;
3767 return emit_vex_instruction(compiler, op, freg, 0, src, srcw);
3774 …return emit_vex_instruction(compiler, XORPD_x_xm | (reg_size == 5 ? VEX_256 : 0) | (elem_size == 3…
3776 …return emit_groupf(compiler, XORPD_x_xm | (elem_size == 3 ? EX86_PREF_66 : 0) | EX86_SSE2, freg, f…
3783 …return emit_vex_instruction(compiler, MOVDDUP_x_xm | EX86_PREF_F2 | EX86_SSE2, freg, 0, src, srcw);
3786 …FAIL_IF(emit_vex_instruction(compiler, SHUFPS_x_xm | EX86_SSE2 | VEX_SSE2_OPV, freg, src, src, 0));
3787 return emit_byte(compiler, 0);
3791 FAIL_IF(emit_sse2_load(compiler, 1, freg, src, srcw));
3797 FAIL_IF(emit_groupf(compiler, op, freg, src, srcw));
3800 return emit_byte(compiler, 0);
3823 …return emit_vex_instruction(compiler, (srcw == 0 ? PXOR_x_xm : PCMPEQD_x_xm) | (reg_size == 5 ? VE…
3825 …return emit_groupf(compiler, (srcw == 0 ? PXOR_x_xm : PCMPEQD_x_xm) | EX86_PREF_66 | EX86_SSE2, fr…
3830 FAIL_IF(emit_load_imm64(compiler, TMP_REG1, srcw));
3833 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, srcw);
3859 compiler->mode32 = 0;
3867 …FAIL_IF(emit_vex_instruction(compiler, op | EX86_PREF_66 | EX86_SSE2_OP1 | VEX_SSE2_OPV, freg, fre…
3869 …FAIL_IF(emit_vex_instruction(compiler, MOVD_x_rm | VEX_AUTO_W | EX86_PREF_66 | EX86_SSE2_OP1, freg…
3871 inst = emit_x86_instruction(compiler, op | EX86_PREF_66 | EX86_SSE2_OP1, freg, 0, src, srcw);
3888 …return emit_vex_instruction(compiler, op | ((reg_size == 5) ? VEX_256 : 0) | EX86_PREF_66 | VEX_OP…
3894 FAIL_IF(emit_byte(compiler, 0));
3899 …FAIL_IF(emit_vex_instruction(compiler, PXOR_x_xm | EX86_PREF_66 | EX86_SSE2 | VEX_SSE2_OPV, TMP_FR…
3900 …return emit_vex_instruction(compiler, PSHUFB_x_xm | EX86_PREF_66 | VEX_OP_0F38 | EX86_SSE2 | VEX_S…
3902 FAIL_IF(emit_groupf(compiler, PXOR_x_xm | EX86_PREF_66 | EX86_SSE2, TMP_FREG, TMP_FREG, 0));
3903 …return emit_groupf_ext(compiler, PSHUFB_x_xm | EX86_PREF_66 | VEX_OP_0F38 | EX86_SSE2, freg, TMP_F…
3906 …FAIL_IF(emit_vex_instruction(compiler, PSHUFLW_x_xm | EX86_PREF_F2 | EX86_SSE2, freg, 0, freg, 0));
3908 FAIL_IF(emit_groupf(compiler, PSHUFLW_x_xm | EX86_PREF_F2 | EX86_SSE2, freg, freg, 0));
3909 FAIL_IF(emit_byte(compiler, 0));
3913 … FAIL_IF(emit_vex_instruction(compiler, PSHUFD_x_xm | EX86_PREF_66 | EX86_SSE2, freg, 0, freg, 0));
3915 FAIL_IF(emit_groupf(compiler, PSHUFD_x_xm | EX86_PREF_66 | EX86_SSE2, freg, freg, 0));
3916 return emit_byte(compiler, 0);
3919 compiler->mode32 = 1;
3921 … FAIL_IF(emit_vex_instruction(compiler, PSHUFD_x_xm | EX86_PREF_66 | EX86_SSE2, freg, 0, freg, 0));
3923 FAIL_IF(emit_groupf(compiler, PSHUFD_x_xm | EX86_PREF_66 | EX86_SSE2, freg, freg, 0));
3924 return emit_byte(compiler, 0x44);
3929 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_lane_mov(struct sljit_compiler *compiler, sljit_… argument
3935 …sljit_s32 use_vex = (cpu_feature_list & CPU_FEATURE_AVX) && (compiler->options & SLJIT_ENTER_USE_V…
3947 CHECK(check_sljit_emit_simd_lane_mov(compiler, type, freg, lane_index, srcdst, srcdstw));
3970 compiler->mode32 = 1;
3989 compiler->mode32 = 0;
3999 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, srcdstw);
4007 …return emit_vex_instruction(compiler, MOVD_x_rm | VEX_AUTO_W | EX86_PREF_66 | EX86_SSE2_OP1, freg,…
4008 return emit_groupf(compiler, MOVD_x_rm | EX86_PREF_66 | EX86_SSE2_OP1, freg, srcdst, srcdstw);
4014 …return emit_vex_instruction(compiler, MOVSD_x_xm | (elem_size == 2 ? EX86_PREF_F3 : EX86_PREF_F2) …
4015 …return emit_groupf(compiler, MOVSD_x_xm | (elem_size == 2 ? EX86_PREF_F3 : EX86_PREF_F2) | EX86_SS…
4018 … return emit_vex_instruction(compiler, MOVQ_x_xm | EX86_PREF_F3 | EX86_SSE2, freg, 0, srcdst, 0);
4019 return emit_groupf(compiler, MOVQ_x_xm | EX86_PREF_F3 | EX86_SSE2, freg, srcdst, 0);
4021 …FAIL_IF(emit_vex_instruction(compiler, XORPD_x_xm | EX86_SSE2 | VEX_SSE2_OPV, TMP_FREG, TMP_FREG, …
4022 …return emit_vex_instruction(compiler, MOVSD_x_xm | EX86_PREF_F3 | EX86_SSE2 | VEX_SSE2_OPV, freg, …
4031 …FAIL_IF(emit_vex_instruction(compiler, MOVSD_x_xm | (elem_size == 2 ? EX86_PREF_F3 : EX86_PREF_F2)…
4033 FAIL_IF(emit_sse2_load(compiler, elem_size == 2, TMP_FREG, srcdst, srcdstw));
4042 …FAIL_IF(emit_vex_instruction(compiler, op | (reg_size == 5 ? VEX_256 : 0) | VEX_SSE2_OPV, freg, fr…
4044 FAIL_IF(emit_groupf(compiler, op, freg, freg, 0));
4046 …FAIL_IF(emit_vex_instruction(compiler, ((type & SLJIT_SIMD_FLOAT) ? VEXTRACTF128_x_ym : VEXTRACTI1…
4047 FAIL_IF(emit_byte(compiler, 1));
4063 FAIL_IF(emit_vex_instruction(compiler, op | EX86_PREF_66 | EX86_SSE2
4066 FAIL_IF(emit_groupf(compiler, op | EX86_PREF_66 | EX86_SSE2, freg, srcdst, srcdstw));
4072 …return emit_vex_instruction(compiler, MOVHLPS_x_x | EX86_SSE2 | VEX_SSE2_OPV, srcdst, srcdst, freg…
4073 return emit_groupf(compiler, MOVHLPS_x_x | EX86_SSE2, srcdst, freg, 0);
4076 …return emit_vex_instruction(compiler, MOVSD_x_xm | EX86_PREF_F2 | EX86_SSE2 | VEX_SSE2_OPV, srcdst…
4077 return emit_sse2_load(compiler, 0, srcdst, freg, 0);
4080 …FAIL_IF(emit_vex_instruction(compiler, MOVLHPS_x_x | EX86_SSE2 | VEX_SSE2_OPV, freg, freg, srcdst,…
4082 …FAIL_IF(emit_vex_instruction(compiler, MOVSD_x_xm | EX86_PREF_F2 | EX86_SSE2 | VEX_SSE2_OPV, freg,…
4085 FAIL_IF(emit_groupf(compiler, MOVLHPS_x_x | EX86_SSE2, freg, srcdst, 0));
4087 FAIL_IF(emit_sse2_load(compiler, 0, freg, srcdst, 0));
4092 …return emit_vex_instruction(compiler, ((srcdst & SLJIT_MEM) ? MOVSD_xm_x : MOVSD_x_xm) | EX86_PREF…
4094 return emit_sse2_store(compiler, 1, srcdst, srcdstw, freg);
4099 …FAIL_IF(emit_vex_instruction(compiler, EXTRACTPS_x_xm | EX86_PREF_66 | VEX_OP_0F3A | EX86_SSE2, fr…
4101 …FAIL_IF(emit_groupf_ext(compiler, EXTRACTPS_x_xm | EX86_PREF_66 | VEX_OP_0F3A | EX86_SSE2, freg, s…
4102 return emit_byte(compiler, U8(lane_index));
4106 …FAIL_IF(emit_vex_instruction(compiler, SHUFPS_x_xm | EX86_SSE2 | VEX_SSE2_OPV, srcdst, freg, freg,…
4107 return emit_byte(compiler, U8(lane_index));
4127 FAIL_IF(emit_groupf(compiler, op, srcdst, freg, 0));
4131 return emit_byte(compiler, U8(lane_index));
4136 …FAIL_IF(emit_groupf_ext(compiler, INSERTPS_x_xm | EX86_PREF_66 | VEX_OP_0F3A | EX86_SSE2, freg, sr…
4137 FAIL_IF(emit_byte(compiler, U8(lane_index << 4)));
4139 FAIL_IF(emit_sse2_store(compiler, 1, freg, 0, srcdst));
4148 …FAIL_IF(emit_vex_instruction(compiler, VPERMPD_y_ym | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A | VEX_W…
4149 return emit_byte(compiler, 0x4e);
4152 …FAIL_IF(emit_vex_instruction(compiler, VINSERTF128_y_y_xm | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A |…
4153 return emit_byte(compiler, 1);
4157 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, srcdstw);
4182 compiler->mode32 = 0;
4189 …FAIL_IF(emit_vex_instruction(compiler, op | EX86_PREF_66 | VEX_AUTO_W | EX86_SSE2_OP1 | VEX_SSE2_O…
4191 …inst = emit_x86_instruction(compiler, op | EX86_PREF_66 | EX86_SSE2_OP1, freg, 0, srcdst, srcdstw);
4202 FAIL_IF(emit_byte(compiler, U8(lane_index)));
4209 …FAIL_IF(emit_vex_instruction(compiler, VPERMQ_y_ym | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A | VEX_W …
4210 return emit_byte(compiler, 0x4e);
4213 …FAIL_IF(emit_vex_instruction(compiler, VINSERTI128_y_y_xm | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A |…
4214 return emit_byte(compiler, 1);
4219 return emit_mov(compiler, srcdst_orig, srcdstw_orig, TMP_REG1, 0);
4228 compiler->mode32 = (type & SLJIT_32);
4239 SLJIT_ASSERT(!(compiler->mode32));
4243 inst = emit_x86_instruction(compiler, op, srcdst, 0, srcdst, 0);
4255 FAIL_IF(emit_groupf(compiler, (elem_size == 0) ? MOVSX_r_rm8 : MOVSX_r_rm16,
4259 return emit_mov(compiler, srcdst_orig, srcdstw_orig, TMP_REG1, 0);
4264 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_lane_replicate(struct sljit_compiler *compiler, … argument
4270 …sljit_s32 use_vex = (cpu_feature_list & CPU_FEATURE_AVX) && (compiler->options & SLJIT_ENTER_USE_V…
4280 CHECK(check_sljit_emit_simd_lane_replicate(compiler, type, freg, src, src_lane_index));
4283 compiler->mode32 = 1;
4304 …return emit_vex_instruction(compiler, VBROADCASTSD_x_xm | VEX_256 | EX86_PREF_66 | VEX_OP_0F38 | E…
4306 …FAIL_IF(emit_vex_instruction(compiler, VPERMPD_y_ym | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A | VEX_W…
4309 return emit_byte(compiler, U8(byte | (byte << 4)));
4314 … return emit_vex_instruction(compiler, MOVDDUP_x_xm | EX86_PREF_F2 | EX86_SSE2, freg, 0, src, 0);
4315 return emit_groupf(compiler, MOVDDUP_x_xm | EX86_PREF_F2 | EX86_SSE2, freg, src, 0);
4329 …return emit_vex_instruction(compiler, VBROADCASTSS_x_xm | VEX_256 | EX86_PREF_66 | VEX_OP_0F38 | E…
4331 …FAIL_IF(emit_vex_instruction(compiler, VPERMPD_y_ym | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A | VEX_W…
4339 FAIL_IF(emit_byte(compiler, byte));
4340 …FAIL_IF(emit_vex_instruction(compiler, SHUFPS_x_xm | VEX_256 | pref | EX86_SSE2 | VEX_SSE2_OPV, fr…
4343 …FAIL_IF(emit_vex_instruction(compiler, SHUFPS_x_xm | pref | EX86_SSE2 | VEX_SSE2_OPV, freg, src, s…
4346 FAIL_IF(emit_groupf(compiler, MOVAPS_x_xm | pref | EX86_SSE2, freg, src, 0));
4348 FAIL_IF(emit_groupf(compiler, SHUFPS_x_xm | pref | EX86_SSE2, freg, freg, 0));
4357 return emit_byte(compiler, U8(byte));
4365 …FAIL_IF(emit_vex_instruction(compiler, VPERMQ_y_ym | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A | VEX_W …
4366 FAIL_IF(emit_byte(compiler, src_lane_index >= 24 ? 0xff : 0xaa));
4383 FAIL_IF(emit_groupf(compiler, MOVDQA_x_xm | EX86_PREF_66 | EX86_SSE2, freg, src, 0));
4385 FAIL_IF(emit_groupf(compiler, PSRLDQ_x | EX86_PREF_66 | EX86_SSE2_OP2, opcode3, freg, 0));
4387 …FAIL_IF(emit_vex_instruction(compiler, PSRLDQ_x | EX86_PREF_66 | EX86_SSE2_OP2 | VEX_SSE2_OPV, opc…
4389 FAIL_IF(emit_byte(compiler, U8(src_lane_index)));
4394 FAIL_IF(emit_vex_instruction(compiler, PSHUFLW_x_xm | pref | EX86_SSE2, freg, 0, src, 0));
4396 FAIL_IF(emit_groupf(compiler, PSHUFLW_x_xm | pref | EX86_SSE2, freg, src, 0));
4397 FAIL_IF(emit_byte(compiler, byte));
4404 …return emit_vex_instruction(compiler, VPBROADCASTB_x_xm | (reg_size == 5 ? VEX_256 : 0) | EX86_PRE…
4407 FAIL_IF(emit_groupf(compiler, PXOR_x_xm | EX86_PREF_66 | EX86_SSE2, TMP_FREG, TMP_FREG, 0));
4408 …return emit_groupf_ext(compiler, PSHUFB_x_xm | EX86_PREF_66 | VEX_OP_0F38 | EX86_SSE2, freg, TMP_F…
4427 return emit_vex_instruction(compiler, pref, freg, 0, src, 0);
4446 …FAIL_IF(emit_vex_instruction(compiler, VPERMQ_y_ym | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A | VEX_W …
4447 return emit_byte(compiler, U8(src_lane_index == 0 ? 0x44 : 0xee));
4451 FAIL_IF(emit_vex_instruction(compiler, pref, freg, 0, src, 0));
4453 FAIL_IF(emit_byte(compiler, U8(byte | (byte << 4))));
4456 …return emit_vex_instruction(compiler, VPBROADCASTQ_x_xm | VEX_256 | EX86_PREF_66 | VEX_OP_0F38 | E…
4461 …FAIL_IF(emit_vex_instruction(compiler, VPERMQ_y_ym | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A | VEX_W …
4464 return emit_byte(compiler, U8(byte | (byte << 4)));
4474 FAIL_IF(emit_vex_instruction(compiler, PSHUFLW_x_xm | pref | EX86_SSE2, freg, 0, src, 0));
4476 FAIL_IF(emit_groupf(compiler, PSHUFLW_x_xm | pref | EX86_SSE2, freg, src, 0));
4478 FAIL_IF(emit_byte(compiler, U8(byte | (byte << 4))));
4481 …return emit_vex_instruction(compiler, VPBROADCASTD_x_xm | EX86_PREF_66 | VEX_OP_0F38 | EX86_SSE2, …
4496 FAIL_IF(emit_vex_instruction(compiler, PSHUFD_x_xm | EX86_PREF_66 | EX86_SSE2, freg, 0, src, 0));
4498 FAIL_IF(emit_groupf(compiler, PSHUFD_x_xm | EX86_PREF_66 | EX86_SSE2, freg, src, 0));
4499 return emit_byte(compiler, U8(byte | (byte << 4)));
4502 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_extend(struct sljit_compiler *compiler, sljit_s3… argument
4509 …sljit_s32 use_vex = (cpu_feature_list & CPU_FEATURE_AVX) && (compiler->options & SLJIT_ENTER_USE_V…
4513 CHECK(check_sljit_emit_simd_extend(compiler, type, freg, src, srcw));
4518 compiler->mode32 = 1;
4536 …return emit_vex_instruction(compiler, CVTPS2PD_x_xm | ((reg_size == 5) ? VEX_256 : 0) | EX86_SSE2,…
4537 return emit_groupf(compiler, CVTPS2PD_x_xm | EX86_SSE2, freg, src, srcw);
4573 …return emit_vex_instruction(compiler, opcode | ((reg_size == 5) ? VEX_256 : 0) | EX86_PREF_66 | VE…
4574 return emit_groupf_ext(compiler, opcode | EX86_PREF_66 | VEX_OP_0F38 | EX86_SSE2, freg, src, srcw);
4577 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_sign(struct sljit_compiler *compiler, sljit_s32 … argument
4583 …sljit_s32 use_vex = (cpu_feature_list & CPU_FEATURE_AVX) && (compiler->options & SLJIT_ENTER_USE_V…
4589 CHECK(check_sljit_emit_simd_sign(compiler, type, freg, dst, dstw));
4595 compiler->mode32 = 1;
4610 …FAIL_IF(emit_vex_instruction(compiler, PACKSSWB_x_xm | EX86_PREF_66 | EX86_SSE2 | VEX_SSE2_OPV, TM…
4612 FAIL_IF(emit_groupf(compiler, PACKSSWB_x_xm | EX86_PREF_66 | EX86_SSE2, TMP_FREG, freg, 0));
4624 FAIL_IF(emit_vex_instruction(compiler, op, dst_r, 0, freg, 0));
4626 FAIL_IF(emit_groupf(compiler, op, dst_r, freg, 0));
4629 compiler->mode32 = type & SLJIT_32;
4633 inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_IMM, 8, dst_r, 0);
4639 return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
4653 …FAIL_IF(emit_vex_instruction(compiler, VEXTRACTI128_x_ym | VEX_256 | EX86_PREF_66 | VEX_OP_0F3A | …
4654 FAIL_IF(emit_byte(compiler, 1));
4655 …FAIL_IF(emit_vex_instruction(compiler, PACKSSWB_x_xm | VEX_256 | EX86_PREF_66 | EX86_SSE2 | VEX_SS…
4656 FAIL_IF(emit_groupf(compiler, PMOVMSKB_r_x | EX86_PREF_66 | EX86_SSE2_OP2, dst_r, TMP_FREG, 0));
4665 FAIL_IF(emit_vex_instruction(compiler, op, dst_r, 0, freg, 0));
4670 compiler->mode32 = type & SLJIT_32;
4672 return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
4678 static sljit_s32 emit_simd_mov(struct sljit_compiler *compiler, sljit_s32 type, argument
4688 return emit_groupf(compiler, op, dst_freg, src_freg, 0);
4691 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_op2(struct sljit_compiler *compiler, sljit_s32 t… argument
4699 CHECK(check_sljit_emit_simd_op2(compiler, type, dst_freg, src1_freg, src2_freg));
4702 compiler->mode32 = 1;
4738 …if (reg_size == 5 || ((cpu_feature_list & CPU_FEATURE_AVX) && (compiler->options & SLJIT_ENTER_USE…
4742 …return emit_vex_instruction(compiler, op | EX86_SSE2 | VEX_SSE2_OPV, dst_freg, src1_freg, src2_fre…
4749 FAIL_IF(emit_simd_mov(compiler, type, dst_freg, src1_freg));
4752 FAIL_IF(emit_groupf(compiler, op | EX86_SSE2, dst_freg, src2_freg, 0));
4756 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_atomic_load(struct sljit_compiler *compiler, sljit_s3… argument
4761 CHECK(check_sljit_emit_atomic_load(compiler, op, dst_reg, mem_reg));
4763 SLJIT_SKIP_CHECKS(compiler);
4764 return sljit_emit_op1(compiler, op, dst_reg, 0, SLJIT_MEM1(mem_reg), 0);
4767 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_atomic_store(struct sljit_compiler *compiler, sljit_s… argument
4780 CHECK(check_sljit_emit_atomic_store(compiler, op, src_reg, mem_reg, temp_reg));
4794 EMIT_MOV(compiler, TMP_REG1, 0, src_reg, srcw);
4804 compiler->mode32 = 0;
4806 EMIT_MOV(compiler, free_reg, 0, SLJIT_R0, 0);
4807 EMIT_MOV(compiler, SLJIT_R0, 0, temp_reg, 0);
4815 EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), 0, SLJIT_R1, 0);
4816 EMIT_MOV(compiler, SLJIT_R1, 0, SLJIT_R0, 0);
4817 EMIT_MOV(compiler, SLJIT_R0, 0, temp_reg, tempw);
4822 EMIT_MOV(compiler, free_reg, 0, SLJIT_R0, 0);
4823 EMIT_MOV(compiler, SLJIT_R0, 0, temp_reg, tempw);
4834 compiler->mode32 = op != SLJIT_MOV && op != SLJIT_MOV_P;
4838 FAIL_IF(emit_byte(compiler, GROUP_LOCK));
4848 …FAIL_IF(emit_groupf(compiler, (op == SLJIT_MOV_U8 ? CMPXCHG_rm8_r : CMPXCHG_rm_r) | pref, src_reg,…
4852 compiler->mode32 = 0;
4853 return emit_mov(compiler, SLJIT_R0, 0, TMP_REG1, 0);
4855 EMIT_MOV(compiler, SLJIT_R0, 0, free_reg, 0);
4857 …return emit_mov(compiler, free_reg, 0, (free_reg == SLJIT_R1) ? SLJIT_MEM1(SLJIT_SP) : TMP_REG1, 0…
4863 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 … argument
4866 CHECK(check_sljit_get_local_base(compiler, dst, dstw, offset));
4872 compiler->mode32 = 0;
4879 FAIL_IF(emit_load_imm64(compiler, TMP_REG1, offset));
4881 …SLJIT_ASSERT(emit_lea_binary(compiler, dst, dstw, SLJIT_SP, 0, TMP_REG1, 0) != SLJIT_ERR_UNSUPPORT…
4882 return compiler->error;
4884 return emit_lea_binary(compiler, dst, dstw, SLJIT_SP, 0, TMP_REG1, 0);
4890 return emit_lea_binary(compiler, dst, dstw, SLJIT_SP, 0, SLJIT_IMM, offset);
4891 return emit_mov(compiler, dst, dstw, SLJIT_SP, 0);
4894 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, slji… argument
4903 CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
4908 const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const));
4910 set_const(const_, compiler);
4913 compiler->mode32 = 0;
4916 if (emit_load_imm64(compiler, reg, init_value))
4919 if (emit_mov(compiler, dst, dstw, SLJIT_IMM, init_value))
4923 inst = (sljit_u8*)ensure_buf(compiler, 1);
4930 if (emit_mov(compiler, dst, dstw, TMP_REG1, 0))
4937 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_mov_addr(struct sljit_compiler *compiler, sl… argument
4946 CHECK_PTR(check_sljit_emit_mov_addr(compiler, dst, dstw));
4951 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
4953 set_mov_addr(jump, compiler, 0);
4956 compiler->mode32 = 0;
4959 PTR_FAIL_IF(emit_load_imm64(compiler, reg, 0));
4960 jump->addr = compiler->size;
4965 PTR_FAIL_IF(emit_mov(compiler, dst, dstw, SLJIT_IMM, 0));
4968 inst = (sljit_u8*)ensure_buf(compiler, 1);
4975 PTR_FAIL_IF(emit_mov(compiler, dst, dstw, TMP_REG1, 0));