Lines Matching refs:compiler

192 static sljit_s32 function_check_is_freg(struct sljit_compiler *compiler, sljit_s32 fr, sljit_s32 is…  in function_check_is_freg()  argument
194 if (compiler->scratches == -1) in function_check_is_freg()
200 return (fr >= SLJIT_FR0 && fr < (SLJIT_FR0 + compiler->fscratches)) in function_check_is_freg()
201 || (fr > (SLJIT_FS0 - compiler->fsaveds) && fr <= SLJIT_FS0) in function_check_is_freg()
209 static sljit_s32 push_cpool(struct sljit_compiler *compiler) in push_cpool() argument
218 if (compiler->last_label && compiler->last_label->size == compiler->size) in push_cpool()
219 compiler->last_label->size += compiler->cpool_fill + (CONST_POOL_ALIGNMENT - 1) + 1; in push_cpool()
221 SLJIT_ASSERT(compiler->cpool_fill > 0 && compiler->cpool_fill <= CPOOL_SIZE); in push_cpool()
222 inst = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_cpool()
224 compiler->size++; in push_cpool()
225 *inst = 0xff000000 | compiler->cpool_fill; in push_cpool()
228 inst = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_cpool()
230 compiler->size++; in push_cpool()
234 cpool_ptr = compiler->cpool; in push_cpool()
235 cpool_end = cpool_ptr + compiler->cpool_fill; in push_cpool()
237 inst = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_cpool()
239 compiler->size++; in push_cpool()
242 compiler->cpool_diff = CONST_POOL_EMPTY; in push_cpool()
243 compiler->cpool_fill = 0; in push_cpool()
247 static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins inst) in push_inst() argument
251 …if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_di… in push_inst()
252 FAIL_IF(push_cpool(compiler)); in push_inst()
254 ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_inst()
256 compiler->size++; in push_inst()
261 static sljit_s32 push_inst_with_literal(struct sljit_compiler *compiler, sljit_ins inst, sljit_uw l… in push_inst_with_literal() argument
269 …if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_di… in push_inst_with_literal()
270 FAIL_IF(push_cpool(compiler)); in push_inst_with_literal()
271 else if (compiler->cpool_fill > 0) { in push_inst_with_literal()
272 cpool_ptr = compiler->cpool; in push_inst_with_literal()
273 cpool_end = cpool_ptr + compiler->cpool_fill; in push_inst_with_literal()
274 cpool_unique_ptr = compiler->cpool_unique; in push_inst_with_literal()
277 cpool_index = (sljit_uw)(cpool_ptr - compiler->cpool); in push_inst_with_literal()
287 if (compiler->cpool_fill < CPOOL_SIZE) { in push_inst_with_literal()
288 cpool_index = compiler->cpool_fill; in push_inst_with_literal()
289 compiler->cpool_fill++; in push_inst_with_literal()
292 FAIL_IF(push_cpool(compiler)); in push_inst_with_literal()
294 compiler->cpool_fill = 1; in push_inst_with_literal()
299 ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_inst_with_literal()
301 compiler->size++; in push_inst_with_literal()
304 compiler->cpool[cpool_index] = literal; in push_inst_with_literal()
305 compiler->cpool_unique[cpool_index] = 0; in push_inst_with_literal()
306 if (compiler->cpool_diff == CONST_POOL_EMPTY) in push_inst_with_literal()
307 compiler->cpool_diff = compiler->size; in push_inst_with_literal()
311 static sljit_s32 push_inst_with_unique_literal(struct sljit_compiler *compiler, sljit_ins inst, slj… in push_inst_with_unique_literal() argument
315 …(SLJIT_UNLIKELY((compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_diff… in push_inst_with_unique_literal()
316 FAIL_IF(push_cpool(compiler)); in push_inst_with_unique_literal()
318 SLJIT_ASSERT(compiler->cpool_fill < CPOOL_SIZE && (inst & 0xfff) == 0); in push_inst_with_unique_literal()
319 ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_inst_with_unique_literal()
321 compiler->size++; in push_inst_with_unique_literal()
322 *ptr = inst | compiler->cpool_fill; in push_inst_with_unique_literal()
324 compiler->cpool[compiler->cpool_fill] = literal; in push_inst_with_unique_literal()
325 compiler->cpool_unique[compiler->cpool_fill] = 1; in push_inst_with_unique_literal()
326 compiler->cpool_fill++; in push_inst_with_unique_literal()
327 if (compiler->cpool_diff == CONST_POOL_EMPTY) in push_inst_with_unique_literal()
328 compiler->cpool_diff = compiler->size; in push_inst_with_unique_literal()
332 static SLJIT_INLINE sljit_s32 prepare_blx(struct sljit_compiler *compiler) in prepare_blx() argument
335 …if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_di… in prepare_blx()
336 return push_cpool(compiler); in prepare_blx()
340 static SLJIT_INLINE sljit_s32 emit_blx(struct sljit_compiler *compiler) in emit_blx() argument
343 …SLJIT_ASSERT(compiler->cpool_diff == CONST_POOL_EMPTY || compiler->size - compiler->cpool_diff < M… in emit_blx()
346 return push_inst(compiler, BLX | RM(TMP_REG1)); in emit_blx()
401 static sljit_s32 resolve_const_pool_index(struct sljit_compiler *compiler, struct future_patch **fi… in resolve_const_pool_index() argument
406 SLJIT_UNUSED_ARG(compiler); in resolve_const_pool_index()
425 SLJIT_FREE(curr_patch, compiler->allocator_data); in resolve_const_pool_index()
435 …curr_patch = (struct future_patch*)SLJIT_MALLOC(sizeof(struct future_patch), compiler->allocator_d… in resolve_const_pool_index()
440 SLJIT_FREE(curr_patch, compiler->allocator_data); in resolve_const_pool_index()
456 static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins inst) in push_inst() argument
460 ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_inst()
462 compiler->size++; in push_inst()
467 static SLJIT_INLINE sljit_s32 emit_imm(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw imm) in emit_imm() argument
469 FAIL_IF(push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | ((sljit_u32)imm & 0xfff))); in emit_imm()
470 …return push_inst(compiler, MOVT | RD(reg) | ((imm >> 12) & 0xf0000) | (((sljit_u32)imm >> 16) & 0x… in emit_imm()
628 static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg, sljit_uw imm);
629 static sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit…
723 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler) in sljit_generate_code() argument
750 CHECK_PTR(check_sljit_generate_code(compiler)); in sljit_generate_code()
751 reverse_buf(compiler); in sljit_generate_code()
755 size = compiler->size + (compiler->patches << 1); in sljit_generate_code()
756 if (compiler->cpool_fill > 0) in sljit_generate_code()
757 size += compiler->cpool_fill + CONST_POOL_ALIGNMENT - 1; in sljit_generate_code()
759 size = compiler->size; in sljit_generate_code()
761 code = (sljit_ins*)SLJIT_MALLOC_EXEC(size * sizeof(sljit_ins), compiler->exec_allocator_data); in sljit_generate_code()
763 buf = compiler->buf; in sljit_generate_code()
779 label = compiler->labels; in sljit_generate_code()
780 jump = compiler->jumps; in sljit_generate_code()
781 const_ = compiler->consts; in sljit_generate_code()
782 put_label = compiler->put_labels; in sljit_generate_code()
801 …if (SLJIT_UNLIKELY(resolve_const_pool_index(compiler, &first_patch, cpool_current_index, cpool_sta… in sljit_generate_code()
802 SLJIT_FREE_EXEC(code, compiler->exec_allocator_data); in sljit_generate_code()
803 compiler->error = SLJIT_ERR_ALLOC_FAILED; in sljit_generate_code()
893 if (compiler->cpool_fill > 0) { in sljit_generate_code()
895 …ndex = patch_pc_relative_loads(last_pc_patch, code_ptr, cpool_start_address, compiler->cpool_fill); in sljit_generate_code()
899 buf_ptr = compiler->cpool; in sljit_generate_code()
900 buf_end = buf_ptr + compiler->cpool_fill; in sljit_generate_code()
903 …if (SLJIT_UNLIKELY(resolve_const_pool_index(compiler, &first_patch, cpool_current_index, cpool_sta… in sljit_generate_code()
904 SLJIT_FREE_EXEC(code, compiler->exec_allocator_data); in sljit_generate_code()
905 compiler->error = SLJIT_ERR_ALLOC_FAILED; in sljit_generate_code()
915 jump = compiler->jumps; in sljit_generate_code()
958 const_ = compiler->consts; in sljit_generate_code()
977 put_label = compiler->put_labels; in sljit_generate_code()
995 compiler->error = SLJIT_ERR_COMPILED; in sljit_generate_code()
996 compiler->executable_offset = executable_offset; in sljit_generate_code()
997 compiler->executable_size = (sljit_uw)(code_ptr - code) * sizeof(sljit_uw); in sljit_generate_code()
1127 static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags,
1132 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, in sljit_emit_enter() argument
1148 …CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds,… in sljit_emit_enter()
1149 set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_emit_enter()
1166 FAIL_IF(push_inst(compiler, PUSH | (1 << 14) | imm)); in sljit_emit_enter()
1168 FAIL_IF(push_inst(compiler, 0xe52d0004 | RD(TMP_REG2))); in sljit_emit_enter()
1175 FAIL_IF(push_inst(compiler, SUB | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | sizeof(sljit_sw))); in sljit_emit_enter()
1180 …FAIL_IF(push_inst(compiler, VPUSH | VD(SLJIT_FS0) | ((sljit_ins)SLJIT_NUMBER_OF_SAVED_FLOAT_REGIST… in sljit_emit_enter()
1183 FAIL_IF(push_inst(compiler, VPUSH | VD(SLJIT_FS0) | ((sljit_ins)fsaveds << 1))); in sljit_emit_enter()
1185 …FAIL_IF(push_inst(compiler, VPUSH | VD(fscratches) | ((sljit_ins)(fscratches - (SLJIT_FIRST_SAVED_… in sljit_emit_enter()
1190 compiler->local_size = local_size; in sljit_emit_enter()
1211 …FAIL_IF(push_inst(compiler, VMOV2 | (offset << 10) | ((offset + sizeof(sljit_sw)) << 14) | float_a… in sljit_emit_enter()
1213 FAIL_IF(push_inst(compiler, VLDR_F32 | 0x800100 | RN(SLJIT_SP) in sljit_emit_enter()
1220 FAIL_IF(push_inst(compiler, VMOV | (float_arg_count << 16) | (offset << 10))); in sljit_emit_enter()
1222 FAIL_IF(push_inst(compiler, VLDR_F32 | 0x800000 | RN(SLJIT_SP) in sljit_emit_enter()
1238 FAIL_IF(push_inst(compiler, MOV | RD(tmp) | (offset >> 2))); in sljit_emit_enter()
1240 …FAIL_IF(push_inst(compiler, LDR | 0x800000 | RN(SLJIT_SP) | RD(tmp) | (offset + (sljit_ins)size - … in sljit_emit_enter()
1248 compiler->args_size = offset; in sljit_emit_enter()
1276 …FAIL_IF(push_inst(compiler, MOV | RD(SLJIT_S0 - saved_arg_count) | RM(SLJIT_R0 + word_arg_count))); in sljit_emit_enter()
1289 FAIL_IF(push_inst(compiler, *(--remap_ptr))); in sljit_emit_enter()
1293 …FAIL_IF(emit_op(compiler, SLJIT_SUB, ALLOW_IMM | ALLOW_DOUBLE_IMM, SLJIT_SP, 0, SLJIT_SP, 0, SLJIT… in sljit_emit_enter()
1298 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, in sljit_set_context() argument
1305 …CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds… in sljit_set_context()
1306 set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_set_context()
1314 compiler->local_size = ((size + local_size + 0x7) & ~0x7) - size; in sljit_set_context()
1318 static sljit_s32 emit_add_sp(struct sljit_compiler *compiler, sljit_uw imm) in emit_add_sp() argument
1323 …return emit_op(compiler, SLJIT_ADD, ALLOW_IMM | ALLOW_DOUBLE_IMM, SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_… in emit_add_sp()
1325 return push_inst(compiler, ADD | RD(SLJIT_SP) | RN(SLJIT_SP) | imm2); in emit_add_sp()
1328 static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler, sljit_s32 frame_size) in emit_stack_frame_release() argument
1337 local_size = compiler->local_size; in emit_stack_frame_release()
1338 fscratches = compiler->fscratches; in emit_stack_frame_release()
1339 fsaveds = compiler->fsaveds; in emit_stack_frame_release()
1343 FAIL_IF(emit_add_sp(compiler, (sljit_uw)local_size)); in emit_stack_frame_release()
1346 …FAIL_IF(push_inst(compiler, VPOP | VD(SLJIT_FS0) | ((sljit_ins)SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTE… in emit_stack_frame_release()
1349 …FAIL_IF(push_inst(compiler, VPOP | VD(fscratches) | ((sljit_ins)(fscratches - (SLJIT_FIRST_SAVED_F… in emit_stack_frame_release()
1351 FAIL_IF(push_inst(compiler, VPOP | VD(SLJIT_FS0) | ((sljit_ins)fsaveds << 1))); in emit_stack_frame_release()
1354 local_size = GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 1) & 0x7; in emit_stack_frame_release()
1369 tmp = SLJIT_S0 - compiler->saveds; in emit_stack_frame_release()
1370 i = SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->options); in emit_stack_frame_release()
1378 i = compiler->scratches; in emit_stack_frame_release()
1400 return push_inst(compiler, LDR_POST | RN(SLJIT_SP) | RD(restored_reg) | 0x800008); in emit_stack_frame_release()
1402 …return push_inst(compiler, LDR_POST | RN(SLJIT_SP) | RD(restored_reg) | (sljit_ins)(frame_size - (… in emit_stack_frame_release()
1405 …FAIL_IF(push_inst(compiler, LDR | 0x800000 | RN(SLJIT_SP) | RD(restored_reg) | (sljit_ins)local_si… in emit_stack_frame_release()
1421 …FAIL_IF(push_inst(compiler, SUB | RD(SLJIT_SP) | RN(SLJIT_SP) | (1 << 25) | (sljit_ins)(frame_size… in emit_stack_frame_release()
1423 FAIL_IF(emit_add_sp(compiler, (sljit_uw)(local_size - frame_size))); in emit_stack_frame_release()
1433 …return push_inst(compiler, LDR | 0x800000 | RN(SLJIT_SP) | RD(restored_reg) | (sljit_ins)frame_siz… in emit_stack_frame_release()
1437 return push_inst(compiler, LDR_POST | RN(SLJIT_SP) | RD(restored_reg) | (sljit_ins)tmp); in emit_stack_frame_release()
1441 FAIL_IF(emit_add_sp(compiler, (sljit_uw)local_size)); in emit_stack_frame_release()
1450 return push_inst(compiler, LDR_POST | RN(SLJIT_SP) | RD(lr_dst) | 0x800004); in emit_stack_frame_release()
1453 FAIL_IF(push_inst(compiler, POP | reg_list)); in emit_stack_frame_release()
1456 …return push_inst(compiler, SUB | RD(SLJIT_SP) | RN(SLJIT_SP) | (1 << 25) | ((sljit_ins)frame_size … in emit_stack_frame_release()
1461 return push_inst(compiler, ADD | RD(SLJIT_SP) | RN(SLJIT_SP) | (1 << 25) | sizeof(sljit_sw)); in emit_stack_frame_release()
1464 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_void(struct sljit_compiler *compiler) in sljit_emit_return_void() argument
1467 CHECK(check_sljit_emit_return_void(compiler)); in sljit_emit_return_void()
1469 return emit_stack_frame_release(compiler, 0); in sljit_emit_return_void()
1472 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_to(struct sljit_compiler *compiler, in sljit_emit_return_to() argument
1476 CHECK(check_sljit_emit_return_to(compiler, src, srcw)); in sljit_emit_return_to()
1479 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1)); in sljit_emit_return_to()
1482 …} else if (src >= SLJIT_FIRST_SAVED_REG && src <= (SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->op… in sljit_emit_return_to()
1483 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | RM(src))); in sljit_emit_return_to()
1488 FAIL_IF(emit_stack_frame_release(compiler, 1)); in sljit_emit_return_to()
1490 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_return_to()
1491 return sljit_emit_ijump(compiler, SLJIT_JUMP, src, srcw); in sljit_emit_return_to()
1498 static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s… in emit_single_op() argument
1509 return push_inst(compiler, ((flags & INV_IMM) ? MVN : MOV) | RD(dst) | src2); in emit_single_op()
1511 return push_inst(compiler, MOV | RD(dst) | RM(src2)); in emit_single_op()
1519 return push_inst(compiler, (op == SLJIT_MOV_U8 ? UXTB : SXTB) | RD(dst) | RM(src2)); in emit_single_op()
1523 return push_inst(compiler, ((flags & INV_IMM) ? MVN : MOV) | RD(dst) | src2); in emit_single_op()
1531 return push_inst(compiler, (op == SLJIT_MOV_U16 ? UXTH : SXTH) | RD(dst) | RM(src2)); in emit_single_op()
1535 return push_inst(compiler, ((flags & INV_IMM) ? MVN : MOV) | RD(dst) | src2); in emit_single_op()
1541 FAIL_IF(push_inst(compiler, CLZ | RD(dst) | RM(src2))); in emit_single_op()
1548 FAIL_IF(push_inst(compiler, RSB | SRC2_IMM | RD(TMP_REG1) | RN(src2) | 0)); in emit_single_op()
1549 FAIL_IF(push_inst(compiler, AND | RD(TMP_REG2) | RN(src2) | RM(TMP_REG1))); in emit_single_op()
1550 FAIL_IF(push_inst(compiler, CLZ | RD(dst) | RM(TMP_REG2))); in emit_single_op()
1551 FAIL_IF(push_inst(compiler, CMP | SET_FLAGS | SRC2_IMM | RN(dst) | 32)); in emit_single_op()
1552 return push_inst(compiler, (EOR ^ 0xf0000000) | SRC2_IMM | RD(dst) | RN(dst) | 0x1f); in emit_single_op()
1554 FAIL_IF(push_inst(compiler, RBIT | RD(dst) | RM(src2))); in emit_single_op()
1555 return push_inst(compiler, CLZ | RD(dst) | RM(dst)); in emit_single_op()
1562 return push_inst(compiler, REV | RD(dst) | RM(src2)); in emit_single_op()
1567 FAIL_IF(push_inst(compiler, REV16 | RD(dst) | RM(src2))); in emit_single_op()
1570 return push_inst(compiler, (op == SLJIT_REV_U16 ? UXTH : SXTH) | RD(dst) | RM(dst)); in emit_single_op()
1575 return push_inst(compiler, CMN | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2))); in emit_single_op()
1576 …return push_inst(compiler, ADD | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? s… in emit_single_op()
1580 …return push_inst(compiler, ADC | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? s… in emit_single_op()
1586 return push_inst(compiler, CMP | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2))); in emit_single_op()
1588 return push_inst(compiler, (!(flags & ARGS_SWAPPED) ? SUB : RSB) | (flags & SET_FLAGS) in emit_single_op()
1593 return push_inst(compiler, (!(flags & ARGS_SWAPPED) ? SBC : RSC) | (flags & SET_FLAGS) in emit_single_op()
1599 compiler->status_flags_state = 0; in emit_single_op()
1602 return push_inst(compiler, MUL | RN(dst) | RM8(src2) | RM(src1)); in emit_single_op()
1604 FAIL_IF(push_inst(compiler, SMULL | RN(TMP_REG1) | RD(dst) | RM8(src2) | RM(src1))); in emit_single_op()
1607 return push_inst(compiler, CMP | SET_FLAGS | RN(TMP_REG1) | RM(dst) | 0xfc0); in emit_single_op()
1611 return push_inst(compiler, TST | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2))); in emit_single_op()
1612 return push_inst(compiler, (!(flags & INV_IMM) ? AND : BIC) | (flags & SET_FLAGS) in emit_single_op()
1617 …return push_inst(compiler, ORR | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? s… in emit_single_op()
1622 return push_inst(compiler, MVN | (flags & SET_FLAGS) | RD(dst) | RM(src1)); in emit_single_op()
1624 …return push_inst(compiler, EOR | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? s… in emit_single_op()
1645 if (compiler->shift_imm == 0x20) { in emit_single_op()
1646 FAIL_IF(push_inst(compiler, RSB | SRC2_IMM | RD(TMP_REG2) | RN(src2) | 0)); in emit_single_op()
1649 compiler->shift_imm = (sljit_uw)(-(sljit_sw)compiler->shift_imm) & 0x1f; in emit_single_op()
1664 if (compiler->shift_imm != 0x20) { in emit_single_op()
1667 if (compiler->shift_imm != 0) in emit_single_op()
1668 return push_inst(compiler, MOV | (flags & SET_FLAGS) | in emit_single_op()
1669 RD(dst) | (compiler->shift_imm << 7) | (shift_type << 5) | RM(src2)); in emit_single_op()
1670 return push_inst(compiler, MOV | (flags & SET_FLAGS) | RD(dst) | RM(src2)); in emit_single_op()
1676 FAIL_IF(push_inst(compiler, AND | RD(TMP_REG2) | RN(src2) | SRC2_IMM | 0x1f)); in emit_single_op()
1680 return push_inst(compiler, MOV | (flags & SET_FLAGS) | RD(dst) in emit_single_op()
1829 static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg, sljit_uw imm) in load_immediate() argument
1836 return push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | (imm & 0xfff)); in load_immediate()
1842 return push_inst(compiler, MOV | RD(reg) | tmp); in load_immediate()
1846 return push_inst(compiler, MVN | RD(reg) | tmp); in load_immediate()
1852 FAIL_IF(push_inst(compiler, MOV | RD(reg) | imm1)); in load_immediate()
1853 return push_inst(compiler, ORR | RD(reg) | RN(reg) | imm2); in load_immediate()
1858 FAIL_IF(push_inst(compiler, MVN | RD(reg) | imm1)); in load_immediate()
1859 return push_inst(compiler, BIC | RD(reg) | RN(reg) | imm2); in load_immediate()
1863 …return push_inst_with_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, reg, TMP_PC, … in load_immediate()
1865 FAIL_IF(push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | (imm & 0xfff))); in load_immediate()
1868 return push_inst(compiler, MOVT | RD(reg) | ((imm >> 12) & 0xf0000) | ((imm >> 16) & 0xfff)); in load_immediate()
1872 static sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, in emit_op_mem() argument
1886 FAIL_IF(load_immediate(compiler, tmp_reg, tmp)); in emit_op_mem()
1896 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, tmp, reg, tmp_reg, in emit_op_mem()
1906 …FAIL_IF(push_inst(compiler, ADD | RD(tmp_reg) | RN(arg) | RM(offset_reg) | ((sljit_ins)argw << 7))… in emit_op_mem()
1907 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, tmp_reg, TYPE2_TRANSFER_IMM(0))); in emit_op_mem()
1911 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg, in emit_op_mem()
1923 FAIL_IF(push_inst(compiler, ADD | RD(tmp_reg) | RN(arg) | imm)); in emit_op_mem()
1935 FAIL_IF(push_inst(compiler, SUB | RD(tmp_reg) | RN(arg) | imm)); in emit_op_mem()
1947 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg, argw)); in emit_op_mem()
1955 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 0, reg, arg, argw)); in emit_op_mem()
1958 FAIL_IF(load_immediate(compiler, tmp_reg, (sljit_uw)argw)); in emit_op_mem()
1959 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg, in emit_op_mem()
1963 static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags, in emit_op() argument
1993 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD; in emit_op()
1997 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD; in emit_op()
2001 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_SUB; in emit_op()
2005 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_SUB; in emit_op()
2075 FAIL_IF(emit_op_mem(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w, TMP_REG1)); in emit_op()
2078 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)src1w)); in emit_op()
2091 return emit_op_mem(compiler, inp_flags, src2, dst, dstw, TMP_REG2); in emit_op()
2105 FAIL_IF(emit_op_mem(compiler, inp_flags | LOAD_DATA, src2_reg, src2, src2w, TMP_REG2)); in emit_op()
2107 FAIL_IF(load_immediate(compiler, src2_reg, (sljit_uw)src2w)); in emit_op()
2112 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)src1w)); in emit_op()
2125 FAIL_IF(load_immediate(compiler, TMP_REG2, (sljit_uw)src2w)); in emit_op()
2128 …FAIL_IF(emit_single_op(compiler, op, flags, (sljit_uw)dst_reg, (sljit_uw)src1_reg, (sljit_uw)src2_… in emit_op()
2152 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)src1w)); in emit_op()
2155 …FAIL_IF(emit_single_op(compiler, op, flags, (sljit_uw)dst_reg, (sljit_uw)src2_reg, (sljit_uw)src1_… in emit_op()
2164 …FAIL_IF(emit_single_op(compiler, op, flags, (sljit_uw)dst_reg, (sljit_uw)src1_reg, (sljit_uw)src2_… in emit_op()
2169 return emit_op_mem(compiler, inp_flags, dst_reg, dst, dstw, TMP_REG1); in emit_op()
2187 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op) in sljit_emit_op0() argument
2193 CHECK(check_sljit_emit_op0(compiler, op)); in sljit_emit_op0()
2198 FAIL_IF(push_inst(compiler, BKPT)); in sljit_emit_op0()
2201 FAIL_IF(push_inst(compiler, NOP)); in sljit_emit_op0()
2205 return push_inst(compiler, (op == SLJIT_LMUL_UW ? UMULL : SMULL) in sljit_emit_op0()
2215 if (compiler->scratches >= 4) in sljit_emit_op0()
2217 if (compiler->scratches >= 3) in sljit_emit_op0()
2223 FAIL_IF(push_inst(compiler, STR | 0x2d0000 | (saved_reg_count >= 3 ? 16 : 8) in sljit_emit_op0()
2227 FAIL_IF(push_inst(compiler, STR | 0x8d0004 | (saved_reg_list[1] << 12) /* str rX, [sp, #4] */)); in sljit_emit_op0()
2231 FAIL_IF(push_inst(compiler, STR | 0x8d0008 | (saved_reg_list[2] << 12) /* str rX, [sp, #8] */)); in sljit_emit_op0()
2236 FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM, in sljit_emit_op0()
2245 FAIL_IF(push_inst(compiler, LDR | 0x8d0008 | (saved_reg_list[2] << 12) /* ldr rX, [sp, #8] */)); in sljit_emit_op0()
2249 FAIL_IF(push_inst(compiler, LDR | 0x8d0004 | (saved_reg_list[1] << 12) /* ldr rX, [sp, #4] */)); in sljit_emit_op0()
2251 …return push_inst(compiler, (LDR ^ (1 << 24)) | 0x8d0000 | (sljit_ins)(saved_reg_count >= 3 ? 16 : … in sljit_emit_op0()
2263 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op1() argument
2268 CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw)); in sljit_emit_op1()
2278 return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
2281 …return emit_op(compiler, SLJIT_MOV_U8, ALLOW_ANY_IMM | BYTE_SIZE, dst, dstw, TMP_REG1, 0, src, (sr… in sljit_emit_op1()
2284 …return emit_op(compiler, SLJIT_MOV_S8, ALLOW_ANY_IMM | SIGNED | BYTE_SIZE, dst, dstw, TMP_REG1, 0,… in sljit_emit_op1()
2287 …return emit_op(compiler, SLJIT_MOV_U16, ALLOW_ANY_IMM | HALF_SIZE, dst, dstw, TMP_REG1, 0, src, (s… in sljit_emit_op1()
2290 …return emit_op(compiler, SLJIT_MOV_S16, ALLOW_ANY_IMM | SIGNED | HALF_SIZE, dst, dstw, TMP_REG1, 0… in sljit_emit_op1()
2297 return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
2301 return emit_op(compiler, op, HALF_SIZE, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
2307 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2() argument
2315 CHECK(check_sljit_emit_op2(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_op2()
2325 …return emit_op(compiler, op, ALLOW_IMM | ALLOW_NEG_IMM | ALLOW_DOUBLE_IMM, dst, dstw, src1, src1w,… in sljit_emit_op2()
2328 return emit_op(compiler, op, ALLOW_IMM | ALLOW_DOUBLE_IMM, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2335 return emit_op(compiler, op, inp_flags, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2338 return emit_op(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2341 return emit_op(compiler, op, ALLOW_ANY_IMM, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2352 compiler->shift_imm = src2w & 0x1f; in sljit_emit_op2()
2353 return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src1, src1w); in sljit_emit_op2()
2355 compiler->shift_imm = 0x20; in sljit_emit_op2()
2356 return emit_op(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2363 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2u(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2u() argument
2368 CHECK(check_sljit_emit_op2(compiler, op, 1, 0, 0, src1, src1w, src2, src2w)); in sljit_emit_op2u()
2370 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_op2u()
2371 return sljit_emit_op2(compiler, op, TMP_REG2, 0, src1, src1w, src2, src2w); in sljit_emit_op2u()
2374 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_shift_into(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_shift_into() argument
2383 CHECK(check_sljit_emit_shift_into(compiler, op, dst_reg, src1_reg, src2_reg, src3, src3w)); in sljit_emit_shift_into()
2389 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_shift_into()
2390 …return sljit_emit_op2(compiler, is_left ? SLJIT_ROTL : SLJIT_ROTR, dst_reg, 0, src1_reg, 0, src3, … in sljit_emit_shift_into()
2402 …FAIL_IF(push_inst(compiler, MOV | RD(dst_reg) | RM(src1_reg) | ((sljit_ins)(is_left ? 0 : 1) << 5)… in sljit_emit_shift_into()
2404 …return push_inst(compiler, ORR | RD(dst_reg) | RN(dst_reg) | RM(src2_reg) | ((sljit_ins)(is_left ?… in sljit_emit_shift_into()
2408 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG2, src3, src3w, TMP_REG2)); in sljit_emit_shift_into()
2413 FAIL_IF(push_inst(compiler, AND | SRC2_IMM | RD(TMP_REG2) | RN(src3) | 0x1f)); in sljit_emit_shift_into()
2417 …FAIL_IF(push_inst(compiler, MOV | RD(dst_reg) | RM8(src3) | ((sljit_ins)(is_left ? 0 : 1) << 5) | … in sljit_emit_shift_into()
2418 …FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | RM(src2_reg) | ((sljit_ins)(is_left ? 1 : 0) << 5… in sljit_emit_shift_into()
2419 FAIL_IF(push_inst(compiler, EOR | SRC2_IMM | RD(TMP_REG2) | RN(src3) | 0x1f)); in sljit_emit_shift_into()
2420 …return push_inst(compiler, ORR | RD(dst_reg) | RN(dst_reg) | RM8(TMP_REG2) | ((sljit_ins)(is_left … in sljit_emit_shift_into()
2423 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op_src() argument
2427 CHECK(check_sljit_emit_op_src(compiler, op, src, srcw)); in sljit_emit_op_src()
2435 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG2) | RM(src))); in sljit_emit_op_src()
2437 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG2, src, srcw, TMP_REG1)); in sljit_emit_op_src()
2439 return push_inst(compiler, BX | RM(TMP_REG2)); in sljit_emit_op_src()
2447 return emit_op_mem(compiler, PRELOAD | LOAD_DATA, TMP_PC, src, srcw, TMP_REG1); in sljit_emit_op_src()
2453 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_dst(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op_dst() argument
2459 CHECK(check_sljit_emit_op_dst(compiler, op, dst, dstw)); in sljit_emit_op_dst()
2467 return push_inst(compiler, MOV | RD(dst) | RM(TMP_REG2)); in sljit_emit_op_dst()
2470 …size = GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds - SLJIT_KEPT_SAVEDS_COUNT(co… in sljit_emit_op_dst()
2472 if (compiler->fsaveds > 0 || compiler->fscratches >= SLJIT_FIRST_SAVED_FLOAT_REG) { in sljit_emit_op_dst()
2477 size += GET_SAVED_FLOAT_REGISTERS_SIZE(compiler->fscratches, compiler->fsaveds, f64); in sljit_emit_op_dst()
2480 SLJIT_ASSERT(((compiler->local_size + size + SSIZE_OF(sw)) & 0x7) == 0); in sljit_emit_op_dst()
2483 …FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, dst_r, SLJIT_MEM1(SLJIT_SP), compiler->local_… in sljit_emit_op_dst()
2488 return emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1); in sljit_emit_op_dst()
2509 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler, in sljit_emit_op_custom() argument
2514 CHECK(check_sljit_emit_op_custom(compiler, instruction, size)); in sljit_emit_op_custom()
2516 return push_inst(compiler, *(sljit_ins*)instruction); in sljit_emit_op_custom()
2527 static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, slji… in emit_fop_mem() argument
2536 …FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG2) | RN(arg & REG_MASK) | RM(OFFS_REG(arg)) | (((sljit… in emit_fop_mem()
2544 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, arg & REG_MASK, reg, argw >> 2)); in emit_fop_mem()
2546 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, arg & REG_MASK, reg, (-argw) >> 2)); in emit_fop_mem()
2550 FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG2) | RN(arg & REG_MASK) | imm)); in emit_fop_mem()
2551 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG2, reg, (argw & 0x3fc) >> 2)); in emit_fop_mem()
2556 FAIL_IF(push_inst(compiler, SUB | RD(TMP_REG2) | RN(arg & REG_MASK) | imm)); in emit_fop_mem()
2557 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, TMP_REG2, reg, (argw & 0x3fc) >> 2)); in emit_fop_mem()
2562 FAIL_IF(load_immediate(compiler, TMP_REG2, (sljit_uw)argw)); in emit_fop_mem()
2563 FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG2) | RN(arg & REG_MASK) | RM(TMP_REG2))); in emit_fop_mem()
2566 FAIL_IF(load_immediate(compiler, TMP_REG2, (sljit_uw)argw)); in emit_fop_mem()
2568 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG2, reg, 0)); in emit_fop_mem()
2571 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, slj… in sljit_emit_fop1_conv_sw_from_f64() argument
2578 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG1, src, srcw)); in sljit_emit_fop1_conv_sw_from_f64()
2582 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_S32_F32, op & SLJIT_32, TMP_FREG1, src, 0))); in sljit_emit_fop1_conv_sw_from_f64()
2585 return push_inst(compiler, VMOV | (1 << 20) | RD(dst) | VN(TMP_FREG1)); in sljit_emit_fop1_conv_sw_from_f64()
2588 return emit_fop_mem(compiler, 0, TMP_FREG1, dst, dstw); in sljit_emit_fop1_conv_sw_from_f64()
2591 static sljit_s32 sljit_emit_fop1_conv_f64_from_w(struct sljit_compiler *compiler, sljit_ins ins, in sljit_emit_fop1_conv_f64_from_w() argument
2598 FAIL_IF(push_inst(compiler, VMOV | RD(src) | VN(TMP_FREG1))); in sljit_emit_fop1_conv_f64_from_w()
2601 FAIL_IF(emit_fop_mem(compiler, FPU_LOAD, TMP_FREG1, src, srcw)); in sljit_emit_fop1_conv_f64_from_w()
2604 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)srcw)); in sljit_emit_fop1_conv_f64_from_w()
2605 FAIL_IF(push_inst(compiler, VMOV | RD(TMP_REG1) | VN(TMP_FREG1))); in sljit_emit_fop1_conv_f64_from_w()
2608 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(ins, ins & SLJIT_32, dst_r, TMP_FREG1, 0))); in sljit_emit_fop1_conv_f64_from_w()
2611 return emit_fop_mem(compiler, (ins & SLJIT_32), TMP_FREG1, dst, dstw); in sljit_emit_fop1_conv_f64_from_w()
2615 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, slj… in sljit_emit_fop1_conv_f64_from_sw() argument
2619 …return sljit_emit_fop1_conv_f64_from_w(compiler, VCVT_F32_S32 | (~op & SLJIT_32), dst, dstw, src, … in sljit_emit_fop1_conv_f64_from_sw()
2622 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_uw(struct sljit_compiler *compiler, slj… in sljit_emit_fop1_conv_f64_from_uw() argument
2626 …return sljit_emit_fop1_conv_f64_from_w(compiler, VCVT_F32_U32 | (~op & SLJIT_32), dst, dstw, src, … in sljit_emit_fop1_conv_f64_from_uw()
2629 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1_cmp() argument
2636 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG1, src1, src1w)); in sljit_emit_fop1_cmp()
2641 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG2, src2, src2w)); in sljit_emit_fop1_cmp()
2645 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCMP_F32, op & SLJIT_32, src1, src2, 0))); in sljit_emit_fop1_cmp()
2646 FAIL_IF(push_inst(compiler, VMRS)); in sljit_emit_fop1_cmp()
2651 …return push_inst(compiler, (CMP - CONDITIONAL) | (0x60000000 /* VS */) | SET_FLAGS | RN(TMP_REG1) … in sljit_emit_fop1_cmp()
2654 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1() argument
2663 SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw); in sljit_emit_fop1()
2671 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, dst_r, src, srcw)); in sljit_emit_fop1()
2679 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, op & SLJIT_32, dst_r, src, 0))); in sljit_emit_fop1()
2685 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VNEG_F32, op & SLJIT_32, dst_r, src, 0))); in sljit_emit_fop1()
2688 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VABS_F32, op & SLJIT_32, dst_r, src, 0))); in sljit_emit_fop1()
2691 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F64_F32, op & SLJIT_32, dst_r, src, 0))); in sljit_emit_fop1()
2697 return emit_fop_mem(compiler, (op & SLJIT_32), dst_r, dst, dstw); in sljit_emit_fop1()
2701 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop2() argument
2709 CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_fop2()
2719 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG2, src2, src2w)); in sljit_emit_fop2()
2724 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG1, src1, src1w)); in sljit_emit_fop2()
2730 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VADD_F32, op & SLJIT_32, dst_r, src2, src1))); in sljit_emit_fop2()
2733 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VSUB_F32, op & SLJIT_32, dst_r, src2, src1))); in sljit_emit_fop2()
2736 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMUL_F32, op & SLJIT_32, dst_r, src2, src1))); in sljit_emit_fop2()
2739 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VDIV_F32, op & SLJIT_32, dst_r, src2, src1))); in sljit_emit_fop2()
2742 …FAIL_IF(push_inst(compiler, VMOV | (1 << 20) | VN(src2) | RD(TMP_REG1) | ((op & SLJIT_32) ? (1 << … in sljit_emit_fop2()
2743 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VABS_F32, op & SLJIT_32, dst_r, src1, 0))); in sljit_emit_fop2()
2744 FAIL_IF(push_inst(compiler, CMP | SET_FLAGS | RN(TMP_REG1) | SRC2_IMM | 0)); in sljit_emit_fop2()
2745 …return push_inst(compiler, EMIT_FPU_OPERATION((VNEG_F32 & ~COND_MASK) | 0xb0000000, op & SLJIT_32,… in sljit_emit_fop2()
2749 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32), TMP_FREG1, dst, dstw)); in sljit_emit_fop2()
2756 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fset32(struct sljit_compiler *compiler, in sljit_emit_fset32() argument
2769 CHECK(check_sljit_emit_fset32(compiler, freg, value)); in sljit_emit_fset32()
2779 … return push_inst(compiler, (VMOV_F32 ^ (1 << 6)) | ((ins & 0xf0) << 12) | VD(freg) | (ins & 0xf)); in sljit_emit_fset32()
2784 FAIL_IF(load_immediate(compiler, TMP_REG1, u.imm)); in sljit_emit_fset32()
2785 return push_inst(compiler, VMOV | VN(freg) | RD(TMP_REG1)); in sljit_emit_fset32()
2788 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fset64(struct sljit_compiler *compiler, in sljit_emit_fset64() argument
2801 CHECK(check_sljit_emit_fset64(compiler, freg, value)); in sljit_emit_fset64()
2811 …return push_inst(compiler, (VMOV_F32 ^ (1 << 6)) | (1 << 8) | ((ins & 0xf0) << 12) | VD(freg) | (i… in sljit_emit_fset64()
2816 FAIL_IF(load_immediate(compiler, TMP_REG1, u.imm[0])); in sljit_emit_fset64()
2818 return push_inst(compiler, VMOV2 | RN(TMP_REG1) | RD(TMP_REG1) | VM(freg)); in sljit_emit_fset64()
2820 FAIL_IF(load_immediate(compiler, TMP_REG2, u.imm[1])); in sljit_emit_fset64()
2821 return push_inst(compiler, VMOV2 | RN(TMP_REG2) | RD(TMP_REG1) | VM(freg)); in sljit_emit_fset64()
2824 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fcopy(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fcopy() argument
2831 CHECK(check_sljit_emit_fcopy(compiler, op, freg, reg)); in sljit_emit_fcopy()
2848 return push_inst(compiler, inst); in sljit_emit_fcopy()
2855 static sljit_ins get_cc(struct sljit_compiler *compiler, sljit_s32 type) in get_cc() argument
2873 if (compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD) in get_cc()
2881 if (compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD) in get_cc()
2916 if (!(compiler->status_flags_state & (SLJIT_CURRENT_FLAGS_ADD | SLJIT_CURRENT_FLAGS_SUB))) in get_cc()
2924 if (!(compiler->status_flags_state & (SLJIT_CURRENT_FLAGS_ADD | SLJIT_CURRENT_FLAGS_SUB))) in get_cc()
2944 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler) in sljit_emit_label() argument
2949 CHECK_PTR(check_sljit_emit_label(compiler)); in sljit_emit_label()
2951 if (compiler->last_label && compiler->last_label->size == compiler->size) in sljit_emit_label()
2952 return compiler->last_label; in sljit_emit_label()
2954 label = (struct sljit_label*)ensure_abuf(compiler, sizeof(struct sljit_label)); in sljit_emit_label()
2956 set_label(label, compiler); in sljit_emit_label()
2960 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_… in sljit_emit_jump() argument
2965 CHECK_PTR(check_sljit_emit_jump(compiler, type)); in sljit_emit_jump()
2967 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
2969 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
2976 PTR_FAIL_IF(prepare_blx(compiler)); in sljit_emit_jump()
2977 PTR_FAIL_IF(push_inst_with_unique_literal(compiler, ((EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, in sljit_emit_jump()
2978 type <= SLJIT_JUMP ? TMP_PC : TMP_REG1, TMP_PC, 0)) & ~COND_MASK) | get_cc(compiler, type), 0)); in sljit_emit_jump()
2981 jump->addr = compiler->size; in sljit_emit_jump()
2982 compiler->patches++; in sljit_emit_jump()
2987 PTR_FAIL_IF(emit_blx(compiler)); in sljit_emit_jump()
2991 jump->addr = compiler->size; in sljit_emit_jump()
2995 PTR_FAIL_IF(emit_imm(compiler, TMP_REG1, 0)); in sljit_emit_jump()
2996 …PTR_FAIL_IF(push_inst(compiler, (((type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG1)) & ~COND_MASK) | … in sljit_emit_jump()
2997 jump->addr = compiler->size; in sljit_emit_jump()
3004 static sljit_s32 softfloat_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, slj… in softfloat_call_with_args() argument
3046 if (offset > 4 * sizeof(sljit_sw) && (!is_tail_call || offset > compiler->args_size)) { in softfloat_call_with_args()
3056 FAIL_IF(emit_stack_frame_release(compiler, (sljit_s32)offset)); in softfloat_call_with_args()
3058 FAIL_IF(push_inst(compiler, SUB | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | offset)); in softfloat_call_with_args()
3061 FAIL_IF(emit_stack_frame_release(compiler, -1)); in softfloat_call_with_args()
3076 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | (src_offset >> 2))); in softfloat_call_with_args()
3079 …FAIL_IF(push_inst(compiler, VMOV2 | 0x100000 | (offset << 10) | ((offset + sizeof(sljit_sw)) << 14… in softfloat_call_with_args()
3081 FAIL_IF(push_inst(compiler, VSTR_F32 | 0x800100 | RN(SLJIT_SP) in softfloat_call_with_args()
3090 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | (src_offset >> 2))); in softfloat_call_with_args()
3093 FAIL_IF(push_inst(compiler, VMOV | 0x100000 | (float_arg_count << 16) | (offset << 10))); in softfloat_call_with_args()
3095 FAIL_IF(push_inst(compiler, VSTR_F32 | 0x800000 | RN(SLJIT_SP) in softfloat_call_with_args()
3107 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | (src_offset >> 2))); in softfloat_call_with_args()
3114 FAIL_IF(push_inst(compiler, MOV | (offset << 10) | (word_arg_offset >> 2))); in softfloat_call_with_args()
3116 …FAIL_IF(push_inst(compiler, STR | 0x800000 | RN(SLJIT_SP) | (word_arg_offset << 10) | (offset - 4 … in softfloat_call_with_args()
3127 static sljit_s32 softfloat_post_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types) in softfloat_post_call_with_args() argument
3130 FAIL_IF(push_inst(compiler, VMOV2 | (1 << 16) | (0 << 12) | 0)); in softfloat_post_call_with_args()
3132 FAIL_IF(push_inst(compiler, VMOV | (0 << 16) | (0 << 12))); in softfloat_post_call_with_args()
3139 static sljit_s32 hardfloat_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types) in hardfloat_call_with_args() argument
3152 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, in hardfloat_call_with_args()
3160 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, in hardfloat_call_with_args()
3165 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, in hardfloat_call_with_args()
3181 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_… in sljit_emit_call() argument
3190 CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types)); in sljit_emit_call()
3194 PTR_FAIL_IF(softfloat_call_with_args(compiler, arg_types, NULL, &extra_space)); in sljit_emit_call()
3200 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_call()
3201 jump = sljit_emit_jump(compiler, type); in sljit_emit_call()
3206 PTR_FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, in sljit_emit_call()
3209 PTR_FAIL_IF(push_inst(compiler, ADD | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | extra_space)); in sljit_emit_call()
3212 PTR_FAIL_IF(push_inst(compiler, BX | RM(TMP_REG2))); in sljit_emit_call()
3218 PTR_FAIL_IF(softfloat_post_call_with_args(compiler, arg_types)); in sljit_emit_call()
3224 PTR_FAIL_IF(emit_stack_frame_release(compiler, -1)); in sljit_emit_call()
3230 PTR_FAIL_IF(hardfloat_call_with_args(compiler, arg_types)); in sljit_emit_call()
3233 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_call()
3234 return sljit_emit_jump(compiler, type); in sljit_emit_call()
3237 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type… in sljit_emit_ijump() argument
3242 CHECK(check_sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_ijump()
3250 return push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(src)); in sljit_emit_ijump()
3254 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1)); in sljit_emit_ijump()
3255 return push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG1)); in sljit_emit_ijump()
3259 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
3261 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_BL : 0)); in sljit_emit_ijump()
3266 FAIL_IF(prepare_blx(compiler)); in sljit_emit_ijump()
3267 …FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, type … in sljit_emit_ijump()
3269 FAIL_IF(emit_blx(compiler)); in sljit_emit_ijump()
3271 FAIL_IF(emit_imm(compiler, TMP_REG1, 0)); in sljit_emit_ijump()
3272 FAIL_IF(push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG1))); in sljit_emit_ijump()
3274 jump->addr = compiler->size; in sljit_emit_ijump()
3278 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_icall() argument
3287 CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw)); in sljit_emit_icall()
3290 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1)); in sljit_emit_icall()
3294 …(src >= SLJIT_FIRST_SAVED_REG && src <= (SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->options)))) { in sljit_emit_icall()
3295 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | RM(src))); in sljit_emit_icall()
3301 FAIL_IF(softfloat_call_with_args(compiler, arg_types, &src, &extra_space)); in sljit_emit_icall()
3307 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_icall()
3308 FAIL_IF(sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_icall()
3312 FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, in sljit_emit_icall()
3315 FAIL_IF(push_inst(compiler, ADD | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | extra_space)); in sljit_emit_icall()
3318 return push_inst(compiler, BX | RM(TMP_REG2)); in sljit_emit_icall()
3322 return softfloat_post_call_with_args(compiler, arg_types); in sljit_emit_icall()
3327 FAIL_IF(emit_stack_frame_release(compiler, -1)); in sljit_emit_icall()
3333 FAIL_IF(hardfloat_call_with_args(compiler, arg_types)); in sljit_emit_icall()
3336 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_icall()
3337 return sljit_emit_ijump(compiler, type, src, srcw); in sljit_emit_icall()
3342 static SLJIT_INLINE sljit_s32 emit_fmov_before_return(struct sljit_compiler *compiler, sljit_s32 op… in emit_fmov_before_return() argument
3344 if (compiler->options & SLJIT_ENTER_REG_ARG) { in emit_fmov_before_return()
3348 SLJIT_SKIP_CHECKS(compiler); in emit_fmov_before_return()
3349 return sljit_emit_fop1(compiler, op, SLJIT_RETURN_FREG, 0, src, srcw); in emit_fmov_before_return()
3354 return push_inst(compiler, VMOV | (1 << 20) | RD(SLJIT_R0) | VN(src)); in emit_fmov_before_return()
3355 return push_inst(compiler, VMOV2 | (1 << 20) | RD(SLJIT_R0) | RN(SLJIT_R1) | VM(src)); in emit_fmov_before_return()
3358 SLJIT_SKIP_CHECKS(compiler); in emit_fmov_before_return()
3361 return sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, src, srcw); in emit_fmov_before_return()
3362 return sljit_emit_mem(compiler, SLJIT_MOV, SLJIT_REG_PAIR(SLJIT_R0, SLJIT_R1), src, srcw); in emit_fmov_before_return()
3367 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 o… in sljit_emit_op_flags() argument
3375 CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type)); in sljit_emit_op_flags()
3379 cc = get_cc(compiler, type); in sljit_emit_op_flags()
3383 FAIL_IF(push_inst(compiler, MOV | RD(dst_reg) | SRC2_IMM | 0)); in sljit_emit_op_flags()
3384 FAIL_IF(push_inst(compiler, ((MOV | RD(dst_reg) | SRC2_IMM | 1) & ~COND_MASK) | cc)); in sljit_emit_op_flags()
3386 return emit_op_mem(compiler, WORD_SIZE, TMP_REG1, dst, dstw, TMP_REG2); in sljit_emit_op_flags()
3393 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, dst, dstw, TMP_REG2)); in sljit_emit_op_flags()
3395 FAIL_IF(push_inst(compiler, ((ins | RD(dst_reg) | RN(dst_reg) | SRC2_IMM | 1) & ~COND_MASK) | cc)); in sljit_emit_op_flags()
3398 …FAIL_IF(push_inst(compiler, ((ins | RD(dst_reg) | RN(dst_reg) | SRC2_IMM | 0) & ~COND_MASK) | (cc … in sljit_emit_op_flags()
3401 FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG1, dst, dstw, TMP_REG2)); in sljit_emit_op_flags()
3404 return push_inst(compiler, MOV | SET_FLAGS | RD(TMP_REG2) | RM(dst_reg)); in sljit_emit_op_flags()
3408 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_select(struct sljit_compiler *compiler, sljit_s32 typ… in sljit_emit_select() argument
3416 CHECK(check_sljit_emit_select(compiler, type, dst_reg, src1, src1w, src2_reg)); in sljit_emit_select()
3428 …FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, (src2_reg != dst_reg) ? dst_reg : TMP_REG1, s… in sljit_emit_select()
3439 FAIL_IF(push_inst(compiler, MOV | RD(dst_reg) | RM(src2_reg))); in sljit_emit_select()
3441 cc = get_cc(compiler, type & ~SLJIT_32); in sljit_emit_select()
3446 return push_inst(compiler, ((MOV | RD(dst_reg) | tmp) & ~COND_MASK) | cc); in sljit_emit_select()
3450 return push_inst(compiler, ((MVN | RD(dst_reg) | tmp) & ~COND_MASK) | cc); in sljit_emit_select()
3454 …FAIL_IF(push_inst(compiler, (MOVW & ~COND_MASK) | cc | RD(dst_reg) | ((tmp << 4) & 0xf0000) | (tmp… in sljit_emit_select()
3457 …return push_inst(compiler, (MOVT & ~COND_MASK) | cc | RD(dst_reg) | ((tmp >> 12) & 0xf0000) | ((tm… in sljit_emit_select()
3459 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)src1w)); in sljit_emit_select()
3464 return push_inst(compiler, ((MOV | RD(dst_reg) | RM(src1)) & ~COND_MASK) | cc); in sljit_emit_select()
3467 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fselect(struct sljit_compiler *compiler, sljit_s32 ty… in sljit_emit_fselect() argument
3475 CHECK(check_sljit_emit_fselect(compiler, type, dst_freg, src1, src1w, src2_freg)); in sljit_emit_fselect()
3487 …FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, (type & SLJIT_32), dst_freg, src2_freg, 0… in sljit_emit_fselect()
3491 FAIL_IF(emit_fop_mem(compiler, (type & SLJIT_32) | FPU_LOAD, TMP_FREG1, src1, src1w)); in sljit_emit_fselect()
3495 cc = get_cc(compiler, type & ~SLJIT_32); in sljit_emit_fselect()
3496 …return push_inst(compiler, EMIT_FPU_OPERATION((VMOV_F32 & ~COND_MASK) | cc, (type & SLJIT_32), dst… in sljit_emit_fselect()
3501 static sljit_s32 update_mem_addr(struct sljit_compiler *compiler, sljit_s32 *mem, sljit_sw *memw, s… in update_mem_addr() argument
3515 …return push_inst(compiler, ADD | RD(TMP_REG1) | RN(arg & REG_MASK) | RM(OFFS_REG(arg)) | ((sljit_i… in update_mem_addr()
3535 return push_inst(compiler, ADD | RD(TMP_REG1) | RN(arg) | imm); in update_mem_addr()
3546 return push_inst(compiler, SUB | RD(TMP_REG1) | RN(arg) | imm); in update_mem_addr()
3555 FAIL_IF(load_immediate(compiler, TMP_REG1, tmp)); in update_mem_addr()
3560 return push_inst(compiler, ADD | RD(TMP_REG1) | RN(TMP_REG1) | RM(arg)); in update_mem_addr()
3563 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_mem() argument
3570 CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw)); in sljit_emit_mem()
3573 return sljit_emit_mem_unaligned(compiler, type, reg, mem, memw); in sljit_emit_mem()
3577 FAIL_IF(update_mem_addr(compiler, &mem, &memw, 0xfff - 4)); in sljit_emit_mem()
3583 …FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, REG_PAIR_SECOND(reg), SLJIT_MEM1(mem), memw +… in sljit_emit_mem()
3584 …return emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, REG_PAIR_FIRST(reg), SLJIT_MEM1(mem), memw, TM… in sljit_emit_mem()
3590 FAIL_IF(emit_op_mem(compiler, flags, REG_PAIR_FIRST(reg), SLJIT_MEM1(mem), memw, TMP_REG1)); in sljit_emit_mem()
3591 …return emit_op_mem(compiler, flags, REG_PAIR_SECOND(reg), SLJIT_MEM1(mem), memw + SSIZE_OF(sw), TM… in sljit_emit_mem()
3594 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem_update(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_mem_update() argument
3602 CHECK(check_sljit_emit_mem_update(compiler, type, reg, mem, memw)); in sljit_emit_mem_update()
3668 return push_inst(compiler, inst); in sljit_emit_mem_update()
3684 return push_inst(compiler, inst | (sljit_ins)memw); in sljit_emit_mem_update()
3692 return push_inst(compiler, inst | TYPE2_TRANSFER_IMM((sljit_ins)memw)); in sljit_emit_mem_update()
3695 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_fmem() argument
3700 CHECK(check_sljit_emit_fmem(compiler, type, freg, mem, memw)); in sljit_emit_fmem()
3703 …return emit_fop_mem(compiler, ((type ^ SLJIT_32) & SLJIT_32) | ((type & SLJIT_MEM_STORE) ? 0 : FPU… in sljit_emit_fmem()
3706 FAIL_IF(push_inst(compiler, VMOV | (1 << 20) | VN(freg) | RD(TMP_REG2))); in sljit_emit_fmem()
3709 return emit_op_mem(compiler, WORD_SIZE, TMP_REG2, mem, memw, TMP_REG1); in sljit_emit_fmem()
3711 FAIL_IF(update_mem_addr(compiler, &mem, &memw, 0xfff - 4)); in sljit_emit_fmem()
3714 FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, mem, memw, TMP_REG1)); in sljit_emit_fmem()
3715 FAIL_IF(push_inst(compiler, VMOV | (1 << 20) | VN(freg) | 0x80 | RD(TMP_REG2))); in sljit_emit_fmem()
3716 return emit_op_mem(compiler, WORD_SIZE, TMP_REG2, mem, memw + 4, TMP_REG1); in sljit_emit_fmem()
3720 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG2, mem, memw, TMP_REG1)); in sljit_emit_fmem()
3721 return push_inst(compiler, VMOV | VN(freg) | RD(TMP_REG2)); in sljit_emit_fmem()
3724 FAIL_IF(update_mem_addr(compiler, &mem, &memw, 0xfff - 4)); in sljit_emit_fmem()
3727 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG2, mem, memw, TMP_REG1)); in sljit_emit_fmem()
3728 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, mem, memw + 4, TMP_REG1)); in sljit_emit_fmem()
3729 return push_inst(compiler, VMOV2 | VM(freg) | RD(TMP_REG2) | RN(TMP_REG1)); in sljit_emit_fmem()
3732 static sljit_s32 sljit_emit_simd_mem_offset(struct sljit_compiler *compiler, sljit_s32 *mem_ptr, sl… in sljit_emit_simd_mem_offset() argument
3739 …return push_inst(compiler, ADD | RD(TMP_REG1) | RN(mem & REG_MASK) | RM(OFFS_REG(mem)) | ((sljit_i… in sljit_emit_simd_mem_offset()
3744 return load_immediate(compiler, TMP_REG1, (sljit_uw)memw); in sljit_emit_simd_mem_offset()
3758 return push_inst(compiler, ((memw < 0) ? SUB : ADD) | RD(TMP_REG1) | RN(mem) | imm); in sljit_emit_simd_mem_offset()
3760 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)memw)); in sljit_emit_simd_mem_offset()
3761 return push_inst(compiler, ADD | RD(TMP_REG1) | RN(TMP_REG1) | RM(mem)); in sljit_emit_simd_mem_offset()
3778 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_mov(struct sljit_compiler *compiler, sljit_s32 t… in sljit_emit_simd_mov() argument
3788 CHECK(check_sljit_emit_simd_mov(compiler, type, freg, srcdst, srcdstw)); in sljit_emit_simd_mov()
3816 return push_inst(compiler, VORR | ins); in sljit_emit_simd_mov()
3819 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &srcdst, srcdstw)); in sljit_emit_simd_mov()
3834 return push_inst(compiler, ins | RN(srcdst) | ((sljit_ins)elem_size) << 6 | 0xf); in sljit_emit_simd_mov()
3931 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_replicate(struct sljit_compiler *compiler, sljit… in sljit_emit_simd_replicate() argument
3940 CHECK(check_sljit_emit_simd_replicate(compiler, type, freg, src, srcw)); in sljit_emit_simd_replicate()
3957 return push_inst(compiler, VMOV_i | ((reg_size == 4) ? (1 << 6) : 0) | VD(freg)); in sljit_emit_simd_replicate()
3963 FAIL_IF(emit_fop_mem(compiler, FPU_LOAD | SLJIT_32, freg, src, srcw)); in sljit_emit_simd_replicate()
3966 FAIL_IF(push_inst(compiler, VORR | VD(freg) | VN(src) | VM(src))); in sljit_emit_simd_replicate()
3971 return push_inst(compiler, VORR | VD(freg) | VN(src) | VM(src)); in sljit_emit_simd_replicate()
3976 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &src, srcw)); in sljit_emit_simd_replicate()
3983 return push_inst(compiler, VLD1_r | ins | VD(freg) | RN(src) | 0xf); in sljit_emit_simd_replicate()
3993 return push_inst(compiler, VDUP_s | ins | VD(freg) | (sljit_ins)freg_map[src]); in sljit_emit_simd_replicate()
4006 return push_inst(compiler, VMOV_i | imm | VD(freg)); in sljit_emit_simd_replicate()
4009 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)srcw)); in sljit_emit_simd_replicate()
4028 return push_inst(compiler, VDUP | ins | VN(freg) | RD(src)); in sljit_emit_simd_replicate()
4031 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_lane_mov(struct sljit_compiler *compiler, sljit_… in sljit_emit_simd_lane_mov() argument
4040 CHECK(check_sljit_emit_simd_lane_mov(compiler, type, freg, lane_index, srcdst, srcdstw)); in sljit_emit_simd_lane_mov()
4065 FAIL_IF(push_inst(compiler, VORR | VD(freg) | VN(srcdst) | VM(srcdst))); in sljit_emit_simd_lane_mov()
4068 return push_inst(compiler, VMOV_i | VD(freg)); in sljit_emit_simd_lane_mov()
4072 FAIL_IF(push_inst(compiler, VORR | ins | VD(TMP_FREG2) | VN(freg) | VM(freg))); in sljit_emit_simd_lane_mov()
4078 FAIL_IF(push_inst(compiler, VMOV_i | ins | VD(freg))); in sljit_emit_simd_lane_mov()
4088 …return emit_fop_mem(compiler, ((type & SLJIT_SIMD_STORE) ? 0 : FPU_LOAD) | SLJIT_32, freg, srcdst,… in sljit_emit_simd_lane_mov()
4090 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &srcdst, srcdstw)); in sljit_emit_simd_lane_mov()
4094 …return push_inst(compiler, ((type & SLJIT_SIMD_STORE) ? VST1_s : VLD1_s) | ins | VD(freg) | RN(src… in sljit_emit_simd_lane_mov()
4100 return push_inst(compiler, VORR | VD(srcdst) | VN(freg) | VM(freg)); in sljit_emit_simd_lane_mov()
4101 return push_inst(compiler, VMOV_F32 | SLJIT_32 | VD(freg) | VM(srcdst)); in sljit_emit_simd_lane_mov()
4109 return push_inst(compiler, VMOV_F32 | VD(srcdst) | VM(freg)); in sljit_emit_simd_lane_mov()
4112 …FAIL_IF(push_inst(compiler, VMOV_s | (1 << 20) | ((sljit_ins)lane_index << 21) | VN(freg) | RD(TMP… in sljit_emit_simd_lane_mov()
4113 return push_inst(compiler, VMOV | VN(srcdst) | RD(TMP_REG1)); in sljit_emit_simd_lane_mov()
4116 FAIL_IF(push_inst(compiler, VMOV | (1 << 20) | VN(srcdst) | RD(TMP_REG1))); in sljit_emit_simd_lane_mov()
4117 return push_inst(compiler, VMOV_s | ((sljit_ins)lane_index << 21) | VN(freg) | RD(TMP_REG1)); in sljit_emit_simd_lane_mov()
4124 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)srcdstw)); in sljit_emit_simd_lane_mov()
4145 return push_inst(compiler, VMOV_s | ins | VN(freg) | RD(srcdst)); in sljit_emit_simd_lane_mov()
4148 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_lane_replicate(struct sljit_compiler *compiler, … in sljit_emit_simd_lane_replicate() argument
4157 CHECK(check_sljit_emit_simd_lane_replicate(compiler, type, freg, src, src_lane_index)); in sljit_emit_simd_lane_replicate()
4180 FAIL_IF(push_inst(compiler, VORR | VD(freg) | VN(src) | VM(src))); in sljit_emit_simd_lane_replicate()
4185 return push_inst(compiler, VORR | VD(freg) | VN(src) | VM(src)); in sljit_emit_simd_lane_replicate()
4194 return push_inst(compiler, VDUP_s | ins | VD(freg) | VM(src)); in sljit_emit_simd_lane_replicate()
4197 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_extend(struct sljit_compiler *compiler, sljit_s3… in sljit_emit_simd_extend() argument
4207 CHECK(check_sljit_emit_simd_extend(compiler, type, freg, src, srcw)); in sljit_emit_simd_extend()
4224 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &src, srcw)); in sljit_emit_simd_extend()
4226 FAIL_IF(push_inst(compiler, VLD1 | (0x7 << 8) | VD(freg) | RN(src) | 0xf)); in sljit_emit_simd_extend()
4228 …FAIL_IF(push_inst(compiler, VLD1_s | (sljit_ins)((reg_size - elem2_size + elem_size) << 10) | VD(f… in sljit_emit_simd_extend()
4237 FAIL_IF(push_inst(compiler, VSHLL | ((type & SLJIT_SIMD_EXTEND_SIGNED) ? 0 : (1 << 24)) in sljit_emit_simd_extend()
4243 return push_inst(compiler, VORR | VD(freg) | VN(TMP_FREG2) | VM(TMP_FREG2)); in sljit_emit_simd_extend()
4252 FAIL_IF(push_inst(compiler, VCVT_F64_F32 | VD(freg) | VM(src) | 0x20)); in sljit_emit_simd_extend()
4254 return push_inst(compiler, VCVT_F64_F32 | VD(freg) | VM(src)); in sljit_emit_simd_extend()
4257 FAIL_IF(push_inst(compiler, VCVT_F64_F32 | VD(freg) | VM(src))); in sljit_emit_simd_extend()
4259 return push_inst(compiler, VCVT_F64_F32 | VD(freg) | VM(src) | 0x20); in sljit_emit_simd_extend()
4262 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_sign(struct sljit_compiler *compiler, sljit_s32 … in sljit_emit_simd_sign() argument
4272 CHECK(check_sljit_emit_simd_sign(compiler, type, freg, dst, dstw)); in sljit_emit_simd_sign()
4310 FAIL_IF(push_inst(compiler, ins | VD(TMP_FREG2) | VM(freg))); in sljit_emit_simd_sign()
4313 …FAIL_IF(push_inst(compiler, VMOVN | ((sljit_ins)(elem_size - 1) << 18) | VD(TMP_FREG2) | VM(TMP_FR… in sljit_emit_simd_sign()
4318 …FAIL_IF(push_inst(compiler, VSRA | (1 << 24) | ins | ((imms & 0xff) << 16) | VD(TMP_FREG2) | VM(TM… in sljit_emit_simd_sign()
4322 …FAIL_IF(push_inst(compiler, VSRA | (1 << 24) | ins | (1 << 7) | (imms << 16) | VD(TMP_FREG2) | VM(… in sljit_emit_simd_sign()
4325 …FAIL_IF(push_inst(compiler, VMOV_s | (1 << 20) | (1 << 23) | (0x2 << 21) | RD(dst_r) | VN(TMP_FREG… in sljit_emit_simd_sign()
4329 …FAIL_IF(push_inst(compiler, VMOV_s | (1 << 20) | (1 << 23) | (0x2 << 21) | RD(TMP_REG2) | VN(TMP_F… in sljit_emit_simd_sign()
4330 FAIL_IF(push_inst(compiler, ORR | RD(dst_r) | RN(dst_r) | RM(TMP_REG2) | (0x8 << 7))); in sljit_emit_simd_sign()
4334 return emit_op_mem(compiler, WORD_SIZE, TMP_REG1, dst, dstw, TMP_REG2); in sljit_emit_simd_sign()
4339 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_op2(struct sljit_compiler *compiler, sljit_s32 t… in sljit_emit_simd_op2() argument
4347 CHECK(check_sljit_emit_simd_op2(compiler, type, dst_freg, src1_freg, src2_freg)); in sljit_emit_simd_op2()
4377 return push_inst(compiler, ins | VD(dst_freg) | VN(src1_freg) | VM(src2_freg)); in sljit_emit_simd_op2()
4382 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_atomic_load(struct sljit_compiler *compiler, sljit_s3… in sljit_emit_atomic_load() argument
4389 CHECK(check_sljit_emit_atomic_load(compiler, op, dst_reg, mem_reg)); in sljit_emit_atomic_load()
4403 return push_inst(compiler, ins | RN(mem_reg) | RD(dst_reg)); in sljit_emit_atomic_load()
4406 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_atomic_store(struct sljit_compiler *compiler, sljit_s… in sljit_emit_atomic_store() argument
4417 CHECK(check_sljit_emit_atomic_store(compiler, op, src_reg, mem_reg, temp_reg)); in sljit_emit_atomic_store()
4431 FAIL_IF(push_inst(compiler, ins | RN(mem_reg) | RD(TMP_REG1) | RM(src_reg))); in sljit_emit_atomic_store()
4433 return push_inst(compiler, CMP | SET_FLAGS | SRC2_IMM | RN(TMP_REG1)); in sljit_emit_atomic_store()
4438 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, slji… in sljit_emit_const() argument
4444 CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); in sljit_emit_const()
4450 PTR_FAIL_IF(push_inst_with_unique_literal(compiler, in sljit_emit_const()
4452 compiler->patches++; in sljit_emit_const()
4454 PTR_FAIL_IF(emit_imm(compiler, dst_r, init_value)); in sljit_emit_const()
4457 const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const)); in sljit_emit_const()
4459 set_const(const_, compiler); in sljit_emit_const()
4462 PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1)); in sljit_emit_const()
4466 …UTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, s… in sljit_emit_put_label() argument
4472 CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); in sljit_emit_put_label()
4478 …PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, d… in sljit_emit_put_label()
4479 compiler->patches++; in sljit_emit_put_label()
4481 PTR_FAIL_IF(emit_imm(compiler, dst_r, 0)); in sljit_emit_put_label()
4484 put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); in sljit_emit_put_label()
4486 set_put_label(put_label, compiler, 0); in sljit_emit_put_label()
4489 PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1)); in sljit_emit_put_label()