• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:compiler

2  *    Stack-less Just-In-Time compiler
55 /* --------------------------------------------------------------------- */
57 /* --------------------------------------------------------------------- */
153 /* Bit-shift instructions */
171 /* Bit-manipulation instructions */
258 /* Basic Floating-Point Instructions */
259 /* Floating-Point Arithmetic Operation Instructions */
280 /* Floating-Point Conversion Instructions */
292 /* Floating-Point Move Instructions */
308 /* Floating-Point Branch Instructions */
312 /* Floating-Point Common Memory Access Instructions */
354 #define I12_MIN (-0x800)
356 #define BRANCH16_MIN (-(0x8000 << 2))
358 #define BRANCH21_MIN (-(0x100000 << 2))
360 #define JUMP_MIN (-(0x2000000 << 2))
362 #define JIRL_MIN (-(0x8000 << 2))
365 #define S32_MIN (-0x80000000l)
399 static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins ins) in push_inst() argument
401 sljit_ins *ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_inst()
404 compiler->size++; in push_inst()
414 inst = (sljit_ins *)jump->addr; in detect_jump_type()
416 if (jump->flags & SLJIT_REWRITABLE_JUMP) in detect_jump_type()
419 if (jump->flags & JUMP_ADDR) in detect_jump_type()
420 target_addr = jump->u.target; in detect_jump_type()
422 SLJIT_ASSERT(jump->u.label != NULL); in detect_jump_type()
423 target_addr = (sljit_uw)(code + jump->u.label->size) + (sljit_uw)executable_offset; in detect_jump_type()
426 diff = (sljit_sw)target_addr - (sljit_sw)inst - executable_offset; in detect_jump_type()
428 if (jump->flags & IS_COND) { in detect_jump_type()
432 inst--; in detect_jump_type()
434 jump->flags |= PATCH_B; in detect_jump_type()
435 jump->addr = (sljit_uw)inst; in detect_jump_type()
439 diff -= SSIZE_OF(ins); in detect_jump_type()
443 if (jump->flags & IS_COND) { in detect_jump_type()
444 inst[-1] |= (sljit_ins)IMM_I16(2); in detect_jump_type()
447 jump->flags |= PATCH_J; in detect_jump_type()
452 if (jump->flags & IS_COND) in detect_jump_type()
453 inst[-1] |= (sljit_ins)IMM_I16(3); in detect_jump_type()
455 jump->flags |= PATCH_REL32; in detect_jump_type()
461 if (jump->flags & IS_COND) in detect_jump_type()
462 inst[-1] |= (sljit_ins)IMM_I16(3); in detect_jump_type()
464 jump->flags |= PATCH_ABS32; in detect_jump_type()
470 if (jump->flags & IS_COND) in detect_jump_type()
471 inst[-1] |= (sljit_ins)IMM_I16(4); in detect_jump_type()
473 jump->flags |= PATCH_ABS52; in detect_jump_type()
479 if (jump->flags & IS_COND) in detect_jump_type()
480 inst[-1] |= (sljit_ins)IMM_I16(5); in detect_jump_type()
491 SLJIT_ASSERT(jump->flags < ((sljit_uw)6 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
492 if (jump->flags & JUMP_ADDR) in mov_addr_get_length()
493 addr = jump->u.target; in mov_addr_get_length()
495 addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code + jump->u.label->size, executable_offset); in mov_addr_get_length()
497 diff = (sljit_sw)addr - (sljit_sw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); in mov_addr_get_length()
500 SLJIT_ASSERT(jump->flags >= ((sljit_uw)1 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
501 jump->flags |= PATCH_REL32; in mov_addr_get_length()
506 SLJIT_ASSERT(jump->flags >= ((sljit_uw)1 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
507 jump->flags |= PATCH_ABS32; in mov_addr_get_length()
512 SLJIT_ASSERT(jump->flags >= ((sljit_uw)2 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
513 jump->flags |= PATCH_ABS52; in mov_addr_get_length()
517 SLJIT_ASSERT(jump->flags >= ((sljit_uw)3 << JUMP_SIZE_SHIFT)); in mov_addr_get_length()
523 sljit_uw flags = jump->flags; in load_addr_to_reg()
524 sljit_uw addr = (flags & JUMP_ADDR) ? jump->u.target : jump->u.label->u.addr; in load_addr_to_reg()
525 sljit_ins *ins = (sljit_ins*)jump->addr; in load_addr_to_reg()
530 addr -= (sljit_uw)SLJIT_ADD_EXEC_OFFSET(ins, executable_offset); in load_addr_to_reg()
568 static void reduce_code_size(struct sljit_compiler *compiler) in reduce_code_size() argument
578 label = compiler->labels; in reduce_code_size()
579 jump = compiler->jumps; in reduce_code_size()
580 const_ = compiler->consts; in reduce_code_size()
591 label->size -= size_reduce; in reduce_code_size()
593 label = label->next; in reduce_code_size()
598 const_->addr -= size_reduce; in reduce_code_size()
599 const_ = const_->next; in reduce_code_size()
607 jump->addr -= size_reduce; in reduce_code_size()
608 if (!(jump->flags & JUMP_MOV_ADDR)) { in reduce_code_size()
611 if (!(jump->flags & SLJIT_REWRITABLE_JUMP)) { in reduce_code_size()
612 if (jump->flags & JUMP_ADDR) { in reduce_code_size()
613 if (jump->u.target <= S32_MAX) in reduce_code_size()
615 else if (jump->u.target <= S52_MAX) in reduce_code_size()
619 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr; in reduce_code_size()
621 …if ((jump->flags & IS_COND) && (diff + 1) <= (BRANCH16_MAX / SSIZE_OF(ins)) && (diff + 1) >= (BRAN… in reduce_code_size()
630 size_reduce += JUMP_MAX_SIZE - total_size; in reduce_code_size()
631 jump->flags |= total_size << JUMP_SIZE_SHIFT; in reduce_code_size()
635 if (!(jump->flags & JUMP_ADDR)) { in reduce_code_size()
637 diff = (sljit_sw)jump->u.label->size - (sljit_sw)jump->addr; in reduce_code_size()
641 } else if (jump->u.target < S32_MAX) in reduce_code_size()
643 else if (jump->u.target <= S52_MAX) in reduce_code_size()
646 size_reduce += 3 - total_size; in reduce_code_size()
647 jump->flags |= total_size << JUMP_SIZE_SHIFT; in reduce_code_size()
650 jump = jump->next; in reduce_code_size()
654 compiler->size -= size_reduce; in reduce_code_size()
657 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler, sljit_s32 optio… in sljit_generate_code() argument
674 CHECK_PTR(check_sljit_generate_code(compiler)); in sljit_generate_code()
676 reduce_code_size(compiler); in sljit_generate_code()
678 …code = (sljit_ins*)allocate_executable_memory(compiler->size * sizeof(sljit_ins), options, exec_al… in sljit_generate_code()
681 reverse_buf(compiler); in sljit_generate_code()
682 buf = compiler->buf; in sljit_generate_code()
686 label = compiler->labels; in sljit_generate_code()
687 jump = compiler->jumps; in sljit_generate_code()
688 const_ = compiler->consts; in sljit_generate_code()
693 buf_ptr = (sljit_ins*)buf->memory; in sljit_generate_code()
694 buf_end = buf_ptr + (buf->used_size >> 2); in sljit_generate_code()
698 SLJIT_ASSERT(!label || label->size >= word_count); in sljit_generate_code()
699 SLJIT_ASSERT(!jump || jump->addr >= word_count); in sljit_generate_code()
700 SLJIT_ASSERT(!const_ || const_->addr >= word_count); in sljit_generate_code()
704 label->u.addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); in sljit_generate_code()
705 label->size = (sljit_uw)(code_ptr - code); in sljit_generate_code()
706 label = label->next; in sljit_generate_code()
711 if (!(jump->flags & JUMP_MOV_ADDR)) { in sljit_generate_code()
712 word_count = word_count - 1 + (jump->flags >> JUMP_SIZE_SHIFT); in sljit_generate_code()
713 jump->addr = (sljit_uw)code_ptr; in sljit_generate_code()
715 …SLJIT_ASSERT((jump->flags & PATCH_B) || ((sljit_uw)code_ptr - jump->addr < (jump->flags >> JUMP_SI… in sljit_generate_code()
717 word_count += jump->flags >> JUMP_SIZE_SHIFT; in sljit_generate_code()
720 jump->addr = addr; in sljit_generate_code()
722 jump = jump->next; in sljit_generate_code()
725 const_->addr = (sljit_uw)code_ptr; in sljit_generate_code()
726 const_ = const_->next; in sljit_generate_code()
736 buf = buf->next; in sljit_generate_code()
739 if (label && label->size == word_count) { in sljit_generate_code()
740 label->u.addr = (sljit_uw)code_ptr; in sljit_generate_code()
741 label->size = (sljit_uw)(code_ptr - code); in sljit_generate_code()
742 label = label->next; in sljit_generate_code()
748 SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size); in sljit_generate_code()
750 jump = compiler->jumps; in sljit_generate_code()
753 if (!(jump->flags & (PATCH_B | PATCH_J)) || (jump->flags & JUMP_MOV_ADDR)) { in sljit_generate_code()
758 addr = (jump->flags & JUMP_ADDR) ? jump->u.target : jump->u.label->u.addr; in sljit_generate_code()
759 buf_ptr = (sljit_ins *)jump->addr; in sljit_generate_code()
760 addr -= (sljit_uw)SLJIT_ADD_EXEC_OFFSET(buf_ptr, executable_offset); in sljit_generate_code()
762 if (jump->flags & PATCH_B) { in sljit_generate_code()
769 if (jump->flags & IS_CALL) in sljit_generate_code()
774 jump = jump->next; in sljit_generate_code()
777 compiler->error = SLJIT_ERR_COMPILED; in sljit_generate_code()
778 compiler->executable_offset = executable_offset; in sljit_generate_code()
779 compiler->executable_size = (sljit_uw)(code_ptr - code) * sizeof(sljit_ins); in sljit_generate_code()
831 /* --------------------------------------------------------------------- */
833 /* --------------------------------------------------------------------- */
868 static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst_r, sljit_sw imm) in load_immediate() argument
871 return push_inst(compiler, ADDI_D | RD(dst_r) | RJ(TMP_ZERO) | IMM_I12(imm)); in load_immediate()
873 if (imm <= 0x7fffffffl && imm >= -0x80000000l) { in load_immediate()
874 FAIL_IF(push_inst(compiler, LU12I_W | RD(dst_r) | (sljit_ins)(((imm & 0xffffffff) >> 12) << 5))); in load_immediate()
875 return push_inst(compiler, ORI | RD(dst_r) | RJ(dst_r) | IMM_I12(imm)); in load_immediate()
876 } else if (imm <= 0x7ffffffffffffl && imm >= -0x8000000000000l) { in load_immediate()
877 FAIL_IF(push_inst(compiler, LU12I_W | RD(dst_r) | (sljit_ins)(((imm & 0xffffffff) >> 12) << 5))); in load_immediate()
878 FAIL_IF(push_inst(compiler, ORI | RD(dst_r) | RJ(dst_r) | IMM_I12(imm))); in load_immediate()
879 return push_inst(compiler, LU32I_D | RD(dst_r) | (sljit_ins)(((imm >> 32) & 0xfffff) << 5)); in load_immediate()
881 FAIL_IF(push_inst(compiler, LU12I_W | RD(dst_r) | (sljit_ins)(((imm & 0xffffffff) >> 12) << 5))); in load_immediate()
882 FAIL_IF(push_inst(compiler, ORI | RD(dst_r) | RJ(dst_r) | IMM_I12(imm))); in load_immediate()
883 FAIL_IF(push_inst(compiler, LU32I_D | RD(dst_r) | (sljit_ins)(((imm >> 32) & 0xfffff) << 5))); in load_immediate()
884 return push_inst(compiler, LU52I_D | RD(dst_r) | RJ(dst_r) | IMM_I12(imm >> 52)); in load_immediate()
887 #define STACK_MAX_DISTANCE (-I12_MIN)
889 static sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit…
891 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, in sljit_emit_enter() argument
899 …CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds,… in sljit_emit_enter()
900 set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_emit_enter()
902 local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds - saved_arg_count, 1); in sljit_emit_enter()
906 compiler->local_size = local_size; in sljit_emit_enter()
910 FAIL_IF(push_inst(compiler, ADDI_D | RD(SLJIT_SP) | RJ(SLJIT_SP) | IMM_I12(-local_size))); in sljit_emit_enter()
911 offset = local_size - SSIZE_OF(sw); in sljit_emit_enter()
914 FAIL_IF(push_inst(compiler, ADDI_D | RD(SLJIT_SP) | RJ(SLJIT_SP) | IMM_I12(STACK_MAX_DISTANCE))); in sljit_emit_enter()
915 local_size -= STACK_MAX_DISTANCE; in sljit_emit_enter()
918 FAIL_IF(load_immediate(compiler, TMP_REG1, local_size)); in sljit_emit_enter()
919 offset = STACK_MAX_DISTANCE - SSIZE_OF(sw); in sljit_emit_enter()
922 FAIL_IF(push_inst(compiler, STACK_STORE | RD(RETURN_ADDR_REG) | RJ(SLJIT_SP) | IMM_I12(offset))); in sljit_emit_enter()
924 tmp = SLJIT_S0 - saveds; in sljit_emit_enter()
925 for (i = SLJIT_S0 - saved_arg_count; i > tmp; i--) { in sljit_emit_enter()
926 offset -= SSIZE_OF(sw); in sljit_emit_enter()
927 FAIL_IF(push_inst(compiler, STACK_STORE | RD(i) | RJ(SLJIT_SP) | IMM_I12(offset))); in sljit_emit_enter()
930 for (i = scratches; i >= SLJIT_FIRST_SAVED_REG; i--) { in sljit_emit_enter()
931 offset -= SSIZE_OF(sw); in sljit_emit_enter()
932 FAIL_IF(push_inst(compiler, STACK_STORE | RD(i) | RJ(SLJIT_SP) | IMM_I12(offset))); in sljit_emit_enter()
935 tmp = SLJIT_FS0 - fsaveds; in sljit_emit_enter()
936 for (i = SLJIT_FS0; i > tmp; i--) { in sljit_emit_enter()
937 offset -= SSIZE_OF(f64); in sljit_emit_enter()
938 FAIL_IF(push_inst(compiler, FST_D | FRD(i) | RJ(SLJIT_SP) | IMM_I12(offset))); in sljit_emit_enter()
941 for (i = fscratches; i >= SLJIT_FIRST_SAVED_FLOAT_REG; i--) { in sljit_emit_enter()
942 offset -= SSIZE_OF(f64); in sljit_emit_enter()
943 FAIL_IF(push_inst(compiler, FST_D | FRD(i) | RJ(SLJIT_SP) | IMM_I12(offset))); in sljit_emit_enter()
947 FAIL_IF(push_inst(compiler, SUB_D | RD(SLJIT_SP) | RJ(SLJIT_SP) | RK(TMP_REG1))); in sljit_emit_enter()
949 FAIL_IF(push_inst(compiler, ADDI_D | RD(SLJIT_SP) | RJ(SLJIT_SP) | IMM_I12(-local_size))); in sljit_emit_enter()
961 FAIL_IF(push_inst(compiler, ADDI_D | RD(SLJIT_S0 - saved_arg_count) | RJ(tmp) | IMM_I12(0))); in sljit_emit_enter()
975 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, in sljit_set_context() argument
980 …CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds… in sljit_set_context()
981 set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_set_context()
983 local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds - SLJIT_KEPT_SAVEDS_COUNT(options), 1); in sljit_set_context()
986 compiler->local_size = (local_size + SLJIT_LOCALS_OFFSET + 15) & ~0xf; in sljit_set_context()
991 #define STACK_MAX_DISTANCE (-I12_MIN - 16)
993 static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler, sljit_s32 is_return_to) in emit_stack_frame_release() argument
996 sljit_s32 local_size = compiler->local_size; in emit_stack_frame_release()
999 local_size -= STACK_MAX_DISTANCE; in emit_stack_frame_release()
1002 FAIL_IF(load_immediate(compiler, TMP_REG2, local_size)); in emit_stack_frame_release()
1003 FAIL_IF(push_inst(compiler, ADD_D | RD(SLJIT_SP) | RJ(SLJIT_SP) | RK(TMP_REG2))); in emit_stack_frame_release()
1005 FAIL_IF(push_inst(compiler, ADDI_D | RD(SLJIT_SP) | RJ(SLJIT_SP) | IMM_I12(local_size))); in emit_stack_frame_release()
1012 offset = local_size - SSIZE_OF(sw); in emit_stack_frame_release()
1014 FAIL_IF(push_inst(compiler, STACK_LOAD | RD(RETURN_ADDR_REG) | RJ(SLJIT_SP) | IMM_I12(offset))); in emit_stack_frame_release()
1016 tmp = SLJIT_S0 - compiler->saveds; in emit_stack_frame_release()
1017 for (i = SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->options); i > tmp; i--) { in emit_stack_frame_release()
1018 offset -= SSIZE_OF(sw); in emit_stack_frame_release()
1019 FAIL_IF(push_inst(compiler, STACK_LOAD | RD(i) | RJ(SLJIT_SP) | IMM_I12(offset))); in emit_stack_frame_release()
1022 for (i = compiler->scratches; i >= SLJIT_FIRST_SAVED_REG; i--) { in emit_stack_frame_release()
1023 offset -= SSIZE_OF(sw); in emit_stack_frame_release()
1024 FAIL_IF(push_inst(compiler, STACK_LOAD | RD(i) | RJ(SLJIT_SP) | IMM_I12(offset))); in emit_stack_frame_release()
1027 tmp = SLJIT_FS0 - compiler->fsaveds; in emit_stack_frame_release()
1028 for (i = SLJIT_FS0; i > tmp; i--) { in emit_stack_frame_release()
1029 offset -= SSIZE_OF(f64); in emit_stack_frame_release()
1030 FAIL_IF(push_inst(compiler, FLD_D | FRD(i) | RJ(SLJIT_SP) | IMM_I12(offset))); in emit_stack_frame_release()
1033 for (i = compiler->fscratches; i >= SLJIT_FIRST_SAVED_FLOAT_REG; i--) { in emit_stack_frame_release()
1034 offset -= SSIZE_OF(f64); in emit_stack_frame_release()
1035 FAIL_IF(push_inst(compiler, FLD_D | FRD(i) | RJ(SLJIT_SP) | IMM_I12(offset))); in emit_stack_frame_release()
1038 return push_inst(compiler, ADDI_D | RD(SLJIT_SP) | RJ(SLJIT_SP) | IMM_I12(local_size)); in emit_stack_frame_release()
1043 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_void(struct sljit_compiler *compiler) in sljit_emit_return_void() argument
1046 CHECK(check_sljit_emit_return_void(compiler)); in sljit_emit_return_void()
1048 FAIL_IF(emit_stack_frame_release(compiler, 0)); in sljit_emit_return_void()
1049 return push_inst(compiler, JIRL | RD(TMP_ZERO) | RJ(RETURN_ADDR_REG) | IMM_I12(0)); in sljit_emit_return_void()
1052 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_to(struct sljit_compiler *compiler, in sljit_emit_return_to() argument
1056 CHECK(check_sljit_emit_return_to(compiler, src, srcw)); in sljit_emit_return_to()
1060 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw)); in sljit_emit_return_to()
1063 …} else if (src >= SLJIT_FIRST_SAVED_REG && src <= (SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->op… in sljit_emit_return_to()
1064 FAIL_IF(push_inst(compiler, ADDI_D | RD(TMP_REG1) | RJ(src) | IMM_I12(0))); in sljit_emit_return_to()
1069 FAIL_IF(emit_stack_frame_release(compiler, 1)); in sljit_emit_return_to()
1071 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_return_to()
1072 return sljit_emit_ijump(compiler, SLJIT_JUMP, src, srcw); in sljit_emit_return_to()
1075 /* --------------------------------------------------------------------- */
1077 /* --------------------------------------------------------------------- */
1129 static sljit_s32 push_mem_inst(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, slj… in push_mem_inst() argument
1150 return push_inst(compiler, ins); in push_mem_inst()
1154 static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, s… in getput_arg_fast() argument
1159 * argw in [-2048, 2047] (ld/st rd, rj, imm) can be used. */ in getput_arg_fast()
1165 FAIL_IF(push_mem_inst(compiler, flags, reg, arg, argw)); in getput_arg_fast()
1166 return -1; in getput_arg_fast()
1183 if (((next_argw - argw) <= I12_MAX && (next_argw - argw) >= I12_MIN) in can_cache()
1193 static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_… in getput_arg() argument
1209 FAIL_IF(push_inst(compiler, SLLI_D | RD(TMP_REG3) | RJ(OFFS_REG(arg)) | IMM_I12(argw))); in getput_arg()
1210 return push_mem_inst(compiler, flags, reg, SLJIT_MEM2(base, TMP_REG3), 0); in getput_arg()
1213 …if (compiler->cache_arg == arg && argw - compiler->cache_argw <= I12_MAX && argw - compiler->cache… in getput_arg()
1214 return push_mem_inst(compiler, flags, reg, SLJIT_MEM1(TMP_REG3), argw - compiler->cache_argw); in getput_arg()
1216 …if (compiler->cache_arg == SLJIT_MEM && (argw - compiler->cache_argw <= I12_MAX) && (argw - compil… in getput_arg()
1217 offset = argw - compiler->cache_argw; in getput_arg()
1220 compiler->cache_arg = SLJIT_MEM; in getput_arg()
1222 …if (next_arg && next_argw - argw <= I12_MAX && next_argw - argw >= I12_MIN && argw_hi != TO_ARGW_H… in getput_arg()
1223 FAIL_IF(load_immediate(compiler, TMP_REG3, argw)); in getput_arg()
1224 compiler->cache_argw = argw; in getput_arg()
1227 FAIL_IF(load_immediate(compiler, TMP_REG3, argw_hi)); in getput_arg()
1228 compiler->cache_argw = argw_hi; in getput_arg()
1235 return push_mem_inst(compiler, flags, reg, SLJIT_MEM1(TMP_REG3), offset); in getput_arg()
1237 if (arg == next_arg && next_argw - argw <= I12_MAX && next_argw - argw >= I12_MIN) { in getput_arg()
1238 compiler->cache_arg = arg; in getput_arg()
1239 FAIL_IF(push_inst(compiler, ADD_D | RD(TMP_REG3) | RJ(TMP_REG3) | RK(base))); in getput_arg()
1240 return push_mem_inst(compiler, flags, reg, SLJIT_MEM1(TMP_REG3), offset); in getput_arg()
1244 return push_mem_inst(compiler, flags, reg, SLJIT_MEM2(base, TMP_REG3), 0); in getput_arg()
1246 FAIL_IF(push_inst(compiler, ADD_D | RD(tmp_r) | RJ(TMP_REG3) | RK(base))); in getput_arg()
1247 return push_mem_inst(compiler, flags, reg, SLJIT_MEM1(tmp_r), offset); in getput_arg()
1250 static sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit… in emit_op_mem() argument
1255 if (getput_arg_fast(compiler, flags, reg, arg, argw)) in emit_op_mem()
1256 return compiler->error; in emit_op_mem()
1265 FAIL_IF(push_inst(compiler, SLLI_D | RD(tmp_r) | RJ(OFFS_REG(arg)) | IMM_I12(argw))); in emit_op_mem()
1266 return push_mem_inst(compiler, flags, reg, SLJIT_MEM2(base, tmp_r), 0); in emit_op_mem()
1268 FAIL_IF(load_immediate(compiler, tmp_r, argw)); in emit_op_mem()
1271 return push_mem_inst(compiler, flags, reg, SLJIT_MEM2(base, tmp_r), 0); in emit_op_mem()
1272 return push_mem_inst(compiler, flags, reg, SLJIT_MEM1(tmp_r), 0); in emit_op_mem()
1276 static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_… in emit_op_mem2() argument
1278 if (getput_arg_fast(compiler, flags, reg, arg1, arg1w)) in emit_op_mem2()
1279 return compiler->error; in emit_op_mem2()
1280 return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w); in emit_op_mem2()
1285 /* andi/ori/xori are zero-extended */
1289 FAIL_IF(push_inst(compiler, ADDI_D | RD(EQUAL_FLAG) | RJ(TMP_ZERO) | IMM_I12(src2))); \
1290 FAIL_IF(push_inst(compiler, op_reg | RD(EQUAL_FLAG) | RJ(src1) | RK(EQUAL_FLAG))); \
1294 FAIL_IF(push_inst(compiler, ADDI_D | RD(TMP_REG1) | RJ(TMP_ZERO) | IMM_I12(src2))); \
1295 FAIL_IF(push_inst(compiler, op_reg | RD(dst) | RJ(src1) | RK(TMP_REG1))); \
1297 FAIL_IF(push_inst(compiler, ADDI_D | RD(dst) | RJ(TMP_ZERO) | IMM_I12(src2))); \
1298 FAIL_IF(push_inst(compiler, op_reg | RD(dst) | RJ(src1) | RK(dst))); \
1303 FAIL_IF(push_inst(compiler, op_reg | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); \
1305 FAIL_IF(push_inst(compiler, op_reg | RD(dst) | RJ(src1) | RK(src2))); \
1313 static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s… in emit_single_op() argument
1324 return push_inst(compiler, INST(ADD, op) | RD(dst) | RJ(src2) | IMM_I12(0)); in emit_single_op()
1330 return push_inst(compiler, ANDI | RD(dst) | RJ(src2) | IMM_I12(0xff)); in emit_single_op()
1337 return push_inst(compiler, EXT_W_B | RD(dst) | RJ(src2)); in emit_single_op()
1344 return push_inst(compiler, INST(BSTRPICK, op) | RD(dst) | RJ(src2) | (15 << 16)); in emit_single_op()
1351 return push_inst(compiler, EXT_W_H | RD(dst) | RJ(src2)); in emit_single_op()
1358 return push_inst(compiler, BSTRPICK_D | RD(dst) | RJ(src2) | (31 << 16)); in emit_single_op()
1365 return push_inst(compiler, SLLI_W | RD(dst) | RJ(src2) | IMM_I12(0)); in emit_single_op()
1371 return push_inst(compiler, INST(CLZ, op) | RD(dst) | RJ(src2)); in emit_single_op()
1375 return push_inst(compiler, INST(CTZ, op) | RD(dst) | RJ(src2)); in emit_single_op()
1379 return push_inst(compiler, ((op & SLJIT_32) ? REVB_2W : REVB_D) | RD(dst) | RJ(src2)); in emit_single_op()
1383 FAIL_IF(push_inst(compiler, REVB_2H | RD(dst) | RJ(src2))); in emit_single_op()
1384 return push_inst(compiler, EXT_W_H | RD(dst) | RJ(dst)); in emit_single_op()
1388 FAIL_IF(push_inst(compiler, REVB_2H | RD(dst) | RJ(src2))); in emit_single_op()
1389 return push_inst(compiler, INST(BSTRPICK, op) | RD(dst) | RJ(dst) | (15 << 16)); in emit_single_op()
1393 FAIL_IF(push_inst(compiler, REVB_2W | RD(dst) | RJ(src2))); in emit_single_op()
1394 return push_inst(compiler, SLLI_W | RD(dst) | RJ(dst) | IMM_I12(0)); in emit_single_op()
1398 FAIL_IF(push_inst(compiler, REVB_2W | RD(dst) | RJ(src2))); in emit_single_op()
1399 return push_inst(compiler, BSTRPICK_D | RD(dst) | RJ(dst) | (31 << 16)); in emit_single_op()
1409 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(EQUAL_FLAG) | RJ(src1) | IMM_I12(0))); in emit_single_op()
1411 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(EQUAL_FLAG) | RJ(TMP_ZERO) | IMM_I12(-1))); in emit_single_op()
1412 FAIL_IF(push_inst(compiler, XOR | RD(EQUAL_FLAG) | RJ(src1) | RK(EQUAL_FLAG))); in emit_single_op()
1415 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(EQUAL_FLAG) | RJ(src1) | IMM_I12(src2))); in emit_single_op()
1419 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(dst) | RJ(src1) | IMM_I12(src2))); in emit_single_op()
1422 FAIL_IF(push_inst(compiler, XOR | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1424 FAIL_IF(push_inst(compiler, INST(ADD, op) | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1432 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(OTHER_FLAG) | RJ(src1) | IMM_I12(0))); in emit_single_op()
1439 FAIL_IF(push_inst(compiler, INST(ADD, op) | RD(dst) | RJ(src1) | RK(src2))); in emit_single_op()
1445 FAIL_IF(push_inst(compiler, SLTUI | RD(OTHER_FLAG) | RJ(dst) | IMM_I12(src2))); in emit_single_op()
1447 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RJ(dst) | RK(carry_src_r))); in emit_single_op()
1453 FAIL_IF(push_inst(compiler, XOR | RD(TMP_REG1) | RJ(dst) | RK(EQUAL_FLAG))); in emit_single_op()
1455 FAIL_IF(push_inst(compiler, INST(ADD, op) | RD(EQUAL_FLAG) | RJ(dst) | IMM_I12(0))); in emit_single_op()
1456 FAIL_IF(push_inst(compiler, INST(SRLI, op) | RD(TMP_REG1) | RJ(TMP_REG1) | IMM_EXTEND(31))); in emit_single_op()
1457 return push_inst(compiler, XOR | RD(OTHER_FLAG) | RJ(TMP_REG1) | RK(OTHER_FLAG)); in emit_single_op()
1463 FAIL_IF(push_inst(compiler, ADDI_D | RD(dst) | RJ(src1) | IMM_I12(src2))); in emit_single_op()
1471 FAIL_IF(push_inst(compiler, ADDI_D | RD(EQUAL_FLAG) | RJ(src1) | IMM_I12(0))); in emit_single_op()
1476 FAIL_IF(push_inst(compiler, ADD_D | RD(dst) | RJ(src1) | RK(src2))); in emit_single_op()
1482 FAIL_IF(push_inst(compiler, SLTUI | RD(EQUAL_FLAG) | RJ(dst) | IMM_I12(src2))); in emit_single_op()
1484 FAIL_IF(push_inst(compiler, SLTU | RD(EQUAL_FLAG) | RJ(dst) | RK(carry_src_r))); in emit_single_op()
1487 FAIL_IF(push_inst(compiler, ADD_D | RD(dst) | RJ(dst) | RK(OTHER_FLAG))); in emit_single_op()
1493 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RJ(dst) | RK(OTHER_FLAG))); in emit_single_op()
1495 return push_inst(compiler, OR | RD(OTHER_FLAG) | RJ(OTHER_FLAG) | RK(EQUAL_FLAG)); in emit_single_op()
1499 FAIL_IF(push_inst(compiler, ADDI_D | RD(TMP_REG2) | RJ(TMP_ZERO) | IMM_I12(src2))); in emit_single_op()
1508 FAIL_IF(push_inst(compiler, SLTUI | RD(OTHER_FLAG) | RJ(src1) | IMM_I12(src2))); in emit_single_op()
1511 FAIL_IF(push_inst(compiler, SLTI | RD(OTHER_FLAG) | RJ(src1) | IMM_I12(src2))); in emit_single_op()
1521 FAIL_IF(push_inst(compiler, ADDI_D | RD(reg) | RJ(TMP_ZERO) | IMM_I12(src2))); in emit_single_op()
1528 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1531 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RJ(src2) | RK(src1))); in emit_single_op()
1534 FAIL_IF(push_inst(compiler, SLT | RD(OTHER_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1537 FAIL_IF(push_inst(compiler, SLT | RD(OTHER_FLAG) | RJ(src2) | RK(src1))); in emit_single_op()
1545 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(EQUAL_FLAG) | RJ(src1) | IMM_I12(-src2))); in emit_single_op()
1547 return push_inst(compiler, INST(ADDI, op) | RD(dst) | RJ(src1) | IMM_I12(-src2)); in emit_single_op()
1550 FAIL_IF(push_inst(compiler, INST(SUB, op) | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1552 return push_inst(compiler, INST(SUB, op) | RD(dst) | RJ(src1) | RK(src2)); in emit_single_op()
1563 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(EQUAL_FLAG) | RJ(src1) | IMM_I12(0))); in emit_single_op()
1565 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(EQUAL_FLAG) | RJ(src1) | IMM_I12(-1))); in emit_single_op()
1566 FAIL_IF(push_inst(compiler, XOR | RD(EQUAL_FLAG) | RJ(src1) | RK(EQUAL_FLAG))); in emit_single_op()
1569 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(EQUAL_FLAG) | RJ(src1) | IMM_I12(-src2))); in emit_single_op()
1572 FAIL_IF(push_inst(compiler, SLTUI | RD(OTHER_FLAG) | RJ(src1) | IMM_I12(src2))); in emit_single_op()
1576 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(dst) | RJ(src1) | IMM_I12(-src2))); in emit_single_op()
1579 FAIL_IF(push_inst(compiler, XOR | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1581 FAIL_IF(push_inst(compiler, INST(SUB, op) | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1584 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1588 FAIL_IF(push_inst(compiler, INST(SUB, op) | RD(dst) | RJ(src1) | RK(src2))); in emit_single_op()
1594 FAIL_IF(push_inst(compiler, XOR | RD(TMP_REG1) | RJ(dst) | RK(EQUAL_FLAG))); in emit_single_op()
1596 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(EQUAL_FLAG) | RJ(dst) | IMM_I12(0))); in emit_single_op()
1597 FAIL_IF(push_inst(compiler, INST(SRLI, op) | RD(TMP_REG1) | RJ(TMP_REG1) | IMM_EXTEND(31))); in emit_single_op()
1598 return push_inst(compiler, XOR | RD(OTHER_FLAG) | RJ(TMP_REG1) | RK(OTHER_FLAG)); in emit_single_op()
1602 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(TMP_REG2) | RJ(TMP_ZERO) | IMM_I12(src2))); in emit_single_op()
1611 FAIL_IF(push_inst(compiler, SLTUI | RD(EQUAL_FLAG) | RJ(src1) | IMM_I12(src2))); in emit_single_op()
1613 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(dst) | RJ(src1) | IMM_I12(-src2))); in emit_single_op()
1616 FAIL_IF(push_inst(compiler, SLTU | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1618 FAIL_IF(push_inst(compiler, INST(SUB, op) | RD(dst) | RJ(src1) | RK(src2))); in emit_single_op()
1622 FAIL_IF(push_inst(compiler, SLTU | RD(TMP_REG1) | RJ(dst) | RK(OTHER_FLAG))); in emit_single_op()
1624 FAIL_IF(push_inst(compiler, INST(SUB, op) | RD(dst) | RJ(dst) | RK(OTHER_FLAG))); in emit_single_op()
1629 return push_inst(compiler, OR | RD(OTHER_FLAG) | RJ(EQUAL_FLAG) | RK(TMP_REG1)); in emit_single_op()
1635 return push_inst(compiler, INST(MUL, op) | RD(dst) | RJ(src1) | RK(src2)); in emit_single_op()
1638 FAIL_IF(push_inst(compiler, MUL_D | RD(OTHER_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1639 FAIL_IF(push_inst(compiler, MUL_W | RD(dst) | RJ(src1) | RK(src2))); in emit_single_op()
1640 return push_inst(compiler, SUB_D | RD(OTHER_FLAG) | RJ(dst) | RK(OTHER_FLAG)); in emit_single_op()
1643 FAIL_IF(push_inst(compiler, MULH_D | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1644 FAIL_IF(push_inst(compiler, MUL_D | RD(dst) | RJ(src1) | RK(src2))); in emit_single_op()
1645 FAIL_IF(push_inst(compiler, SRAI_D | RD(OTHER_FLAG) | RJ(dst) | IMM_I12((63)))); in emit_single_op()
1646 return push_inst(compiler, SUB_D | RD(OTHER_FLAG) | RJ(EQUAL_FLAG) | RK(OTHER_FLAG)); in emit_single_op()
1693 src2 = word_size - src2; in emit_single_op()
1694 return push_inst(compiler, INST(ROTRI, op) | RD(dst) | RJ(src1) | IMM_I12(src2)); in emit_single_op()
1699 return push_inst(compiler, INST(ADDI, op) | RD(dst) | RJ(src1) | IMM_I12(0)); in emit_single_op()
1704 FAIL_IF(push_inst(compiler, INST(SUB, op)| RD(OTHER_FLAG) | RJ(TMP_ZERO) | RK(src2))); in emit_single_op()
1707 return push_inst(compiler, INST(ROTR, op) | RD(dst) | RJ(src1) | RK(src2)); in emit_single_op()
1716 FAIL_IF(push_inst(compiler, op_imm | RD(EQUAL_FLAG) | RJ(src1) | IMM_I12(src2))); in emit_single_op()
1720 return push_inst(compiler, op_imm | RD(dst) | RJ(src1) | IMM_I12(src2)); in emit_single_op()
1724 FAIL_IF(push_inst(compiler, op_reg | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); in emit_single_op()
1728 return push_inst(compiler, op_reg | RD(dst) | RJ(src1) | RK(src2)); in emit_single_op()
1733 static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags, in emit_op() argument
1748 compiler->cache_arg = 0; in emit_op()
1749 compiler->cache_argw = 0; in emit_op()
1761 } else if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, flags | ARG_TEST, TMP_REG1, dst, dstw)) in emit_op()
1786 FAIL_IF(load_immediate(compiler, TMP_REG1, src1w)); in emit_op()
1792 if (getput_arg_fast(compiler, flags | LOAD_DATA, TMP_REG1, src1, src1w)) in emit_op()
1793 FAIL_IF(compiler->error); in emit_op()
1808 FAIL_IF(load_immediate(compiler, src2_tmp_reg, src2w)); in emit_op()
1821 if (getput_arg_fast(compiler, flags | LOAD_DATA, src2_tmp_reg, src2, src2w)) in emit_op()
1822 FAIL_IF(compiler->error); in emit_op()
1832 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, TMP_REG1, src1, src1w, src2, src2w)); in emit_op()
1833 … FAIL_IF(getput_arg(compiler, flags | LOAD_DATA | MEM_USE_TMP2, TMP_REG2, src2, src2w, dst, dstw)); in emit_op()
1835 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, TMP_REG2, src2, src2w, src1, src1w)); in emit_op()
1836 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, TMP_REG1, src1, src1w, dst, dstw)); in emit_op()
1840 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, TMP_REG1, src1, src1w, dst, dstw)); in emit_op()
1842 …FAIL_IF(getput_arg(compiler, flags | LOAD_DATA | ((src1_r == TMP_REG1) ? MEM_USE_TMP2 : 0), src2_t… in emit_op()
1844 FAIL_IF(emit_single_op(compiler, op, flags, dst_r, src1_r, src2_r)); in emit_op()
1848 getput_arg_fast(compiler, flags, dst_r, dst, dstw); in emit_op()
1849 return compiler->error; in emit_op()
1851 return getput_arg(compiler, flags, dst_r, dst, dstw, 0, 0); in emit_op()
1857 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op) in sljit_emit_op0() argument
1860 CHECK(check_sljit_emit_op0(compiler, op)); in sljit_emit_op0()
1864 return push_inst(compiler, BREAK); in sljit_emit_op0()
1866 return push_inst(compiler, ANDI | RD(TMP_ZERO) | RJ(TMP_ZERO) | IMM_I12(0)); in sljit_emit_op0()
1868 FAIL_IF(push_inst(compiler, ADDI_D | RD(TMP_REG1) | RJ(SLJIT_R1) | IMM_I12(0))); in sljit_emit_op0()
1869 FAIL_IF(push_inst(compiler, MULH_DU | RD(SLJIT_R1) | RJ(SLJIT_R0) | RK(SLJIT_R1))); in sljit_emit_op0()
1870 return push_inst(compiler, MUL_D | RD(SLJIT_R0) | RJ(SLJIT_R0) | RK(TMP_REG1)); in sljit_emit_op0()
1872 FAIL_IF(push_inst(compiler, ADDI_D | RD(TMP_REG1) | RJ(SLJIT_R1) | IMM_I12(0))); in sljit_emit_op0()
1873 FAIL_IF(push_inst(compiler, MULH_D | RD(SLJIT_R1) | RJ(SLJIT_R0) | RK(SLJIT_R1))); in sljit_emit_op0()
1874 return push_inst(compiler, MUL_D | RD(SLJIT_R0) | RJ(SLJIT_R0) | RK(TMP_REG1)); in sljit_emit_op0()
1876 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(TMP_REG1) | RJ(SLJIT_R0) | IMM_I12(0))); in sljit_emit_op0()
1877 …FAIL_IF(push_inst(compiler, ((op & SLJIT_32)? DIV_WU: DIV_DU) | RD(SLJIT_R0) | RJ(SLJIT_R0) | RK(S… in sljit_emit_op0()
1878 …return push_inst(compiler, ((op & SLJIT_32)? MOD_WU: MOD_DU) | RD(SLJIT_R1) | RJ(TMP_REG1) | RK(SL… in sljit_emit_op0()
1880 FAIL_IF(push_inst(compiler, INST(ADDI, op) | RD(TMP_REG1) | RJ(SLJIT_R0) | IMM_I12(0))); in sljit_emit_op0()
1881 FAIL_IF(push_inst(compiler, INST(DIV, op) | RD(SLJIT_R0) | RJ(SLJIT_R0) | RK(SLJIT_R1))); in sljit_emit_op0()
1882 return push_inst(compiler, INST(MOD, op) | RD(SLJIT_R1) | RJ(TMP_REG1) | RK(SLJIT_R1)); in sljit_emit_op0()
1884 …return push_inst(compiler, ((op & SLJIT_32)? DIV_WU: DIV_DU) | RD(SLJIT_R0) | RJ(SLJIT_R0) | RK(SL… in sljit_emit_op0()
1886 return push_inst(compiler, INST(DIV, op) | RD(SLJIT_R0) | RJ(SLJIT_R0) | RK(SLJIT_R1)); in sljit_emit_op0()
1896 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op1() argument
1903 CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw)); in sljit_emit_op1()
1913 return emit_op(compiler, SLJIT_MOV, WORD_DATA | MOVE_OP, dst, dstw, TMP_ZERO, 0, src, srcw); in sljit_emit_op1()
1916 …return emit_op(compiler, SLJIT_MOV_U32, INT_DATA | MOVE_OP, dst, dstw, TMP_ZERO, 0, src, (src == S… in sljit_emit_op1()
1921 …return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA | MOVE_OP, dst, dstw, TMP_ZERO, 0, … in sljit_emit_op1()
1924 …return emit_op(compiler, op, BYTE_DATA | MOVE_OP, dst, dstw, TMP_ZERO, 0, src, (src == SLJIT_IMM) … in sljit_emit_op1()
1927 …return emit_op(compiler, op, BYTE_DATA | SIGNED_DATA | MOVE_OP, dst, dstw, TMP_ZERO, 0, src, (src … in sljit_emit_op1()
1930 …return emit_op(compiler, op, HALF_DATA | MOVE_OP, dst, dstw, TMP_ZERO, 0, src, (src == SLJIT_IMM) … in sljit_emit_op1()
1933 …return emit_op(compiler, op, HALF_DATA | SIGNED_DATA | MOVE_OP, dst, dstw, TMP_ZERO, 0, src, (src … in sljit_emit_op1()
1938 return emit_op(compiler, op, flags, dst, dstw, TMP_ZERO, 0, src, srcw); in sljit_emit_op1()
1942 return emit_op(compiler, op, HALF_DATA, dst, dstw, TMP_ZERO, 0, src, srcw); in sljit_emit_op1()
1946 return emit_op(compiler, op | SLJIT_32, INT_DATA, dst, dstw, TMP_ZERO, 0, src, srcw); in sljit_emit_op1()
1953 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2() argument
1961 CHECK(check_sljit_emit_op2(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_op2()
1978 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD; in sljit_emit_op2()
1979 return emit_op(compiler, op, flags | CUMULATIVE_OP | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1983 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_SUB; in sljit_emit_op2()
1984 return emit_op(compiler, op, flags | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1987 compiler->status_flags_state = 0; in sljit_emit_op2()
1988 return emit_op(compiler, op, flags | CUMULATIVE_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1993 return emit_op(compiler, op, flags | CUMULATIVE_OP | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2010 return emit_op(compiler, op, flags | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2017 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2u(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2u() argument
2022 CHECK(check_sljit_emit_op2(compiler, op, 1, 0, 0, src1, src1w, src2, src2w)); in sljit_emit_op2u()
2024 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_op2u()
2025 return sljit_emit_op2(compiler, op, 0, 0, src1, src1w, src2, src2w); in sljit_emit_op2u()
2028 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2r(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2r() argument
2034 CHECK(check_sljit_emit_op2r(compiler, op, dst_reg, src1, src1w, src2, src2w)); in sljit_emit_op2r()
2038 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_op2r()
2039 …FAIL_IF(sljit_emit_op2(compiler, SLJIT_MUL | (op & SLJIT_32), TMP_REG2, 0, src1, src1w, src2, src2… in sljit_emit_op2r()
2040 return push_inst(compiler, ADD_D | RD(dst_reg) | RJ(dst_reg) | RK(TMP_REG2)); in sljit_emit_op2r()
2046 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_shift_into(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_shift_into() argument
2059 CHECK(check_sljit_emit_shift_into(compiler, op, dst_reg, src1_reg, src2_reg, src3, src3w)); in sljit_emit_shift_into()
2064 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_shift_into()
2065 …return sljit_emit_op2(compiler, (is_left ? SLJIT_ROTL : SLJIT_ROTR) | (op & SLJIT_32), dst_reg, 0,… in sljit_emit_shift_into()
2071 src3w &= bit_length - 1; in sljit_emit_shift_into()
2078 src3w = bit_length - src3w; in sljit_emit_shift_into()
2082 src3w = bit_length - src3w; in sljit_emit_shift_into()
2086 FAIL_IF(push_inst(compiler, ins1 | RD(dst_reg) | RJ(src1_reg))); in sljit_emit_shift_into()
2087 FAIL_IF(push_inst(compiler, ins2 | RD(TMP_REG1) | RJ(src2_reg))); in sljit_emit_shift_into()
2088 return push_inst(compiler, OR | RD(dst_reg) | RJ(dst_reg) | RK(TMP_REG1)); in sljit_emit_shift_into()
2092 FAIL_IF(emit_op_mem(compiler, inp_flags, TMP_REG2, src3, src3w)); in sljit_emit_shift_into()
2095 push_inst(compiler, INST(ADDI, op) | RD(TMP_REG2) | RJ(src3) | IMM_I12(0)); in sljit_emit_shift_into()
2109 FAIL_IF(push_inst(compiler, ins1 | RD(dst_reg) | RJ(src1_reg) | RK(src3))); in sljit_emit_shift_into()
2112 FAIL_IF(push_inst(compiler, ins2 | RD(TMP_REG1) | RJ(src2_reg) | IMM_I12(1))); in sljit_emit_shift_into()
2113 FAIL_IF(push_inst(compiler, XORI | RD(TMP_REG2) | RJ(src3) | IMM_I12((sljit_ins)bit_length - 1))); in sljit_emit_shift_into()
2116 FAIL_IF(push_inst(compiler, INST(SUB, op) | RD(TMP_REG2) | RJ(TMP_ZERO) | RK(src3))); in sljit_emit_shift_into()
2118 FAIL_IF(push_inst(compiler, ins3 | RD(TMP_REG1) | RJ(src2_reg) | RK(TMP_REG2))); in sljit_emit_shift_into()
2119 return push_inst(compiler, OR | RD(dst_reg) | RJ(dst_reg) | RK(TMP_REG1)); in sljit_emit_shift_into()
2122 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op_src() argument
2128 CHECK(check_sljit_emit_op_src(compiler, op, src, srcw)); in sljit_emit_op_src()
2134 FAIL_IF(push_inst(compiler, ADDI_D | RD(RETURN_ADDR_REG) | RJ(src) | IMM_I12(0))); in sljit_emit_op_src()
2136 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, RETURN_ADDR_REG, src, srcw)); in sljit_emit_op_src()
2138 return push_inst(compiler, JIRL | RD(TMP_ZERO) | RJ(RETURN_ADDR_REG) | IMM_I12(0)); in sljit_emit_op_src()
2148 FAIL_IF(push_inst(compiler, SLLI_D | RD(TMP_REG1) | RJ(OFFS_REG(src)) | IMM_I12(srcw))); in sljit_emit_op_src()
2149 FAIL_IF(push_inst(compiler, ADD_D | RD(TMP_REG1) | RJ(base) | RK(TMP_REG1))); in sljit_emit_op_src()
2152 return push_inst(compiler,PRELD | RJ(base) | IMM_I12(srcw)); in sljit_emit_op_src()
2154 FAIL_IF(load_immediate(compiler, TMP_REG1, srcw)); in sljit_emit_op_src()
2156 FAIL_IF(push_inst(compiler, ADD_D | RD(TMP_REG1) | RJ(base) | RK(TMP_REG1))); in sljit_emit_op_src()
2158 return push_inst(compiler, PRELD | RD(0) | RJ(TMP_REG1)); in sljit_emit_op_src()
2163 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_dst(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op_dst() argument
2169 CHECK(check_sljit_emit_op_dst(compiler, op, dst, dstw)); in sljit_emit_op_dst()
2175 return push_inst(compiler, ADDI_D | RD(dst) | RJ(RETURN_ADDR_REG) | IMM_I12(0)); in sljit_emit_op_dst()
2181 …FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, dst_r, SLJIT_MEM1(SLJIT_SP), compiler->local_… in sljit_emit_op_dst()
2186 return emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw); in sljit_emit_op_dst()
2199 return -1; in sljit_get_register_index()
2204 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler, in sljit_emit_op_custom() argument
2209 CHECK(check_sljit_emit_op_custom(compiler, instruction, size)); in sljit_emit_op_custom()
2211 return push_inst(compiler, *(sljit_ins*)instruction); in sljit_emit_op_custom()
2214 /* --------------------------------------------------------------------- */
2216 /* --------------------------------------------------------------------- */
2239 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
2262 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src, srcw, dst, dstw)); in sljit_emit_fop1_conv_sw_from_f64()
2266 FAIL_IF(push_inst(compiler, inst | FRD(TMP_FREG1) | FRJ(src))); in sljit_emit_fop1_conv_sw_from_f64()
2267 FAIL_IF(push_inst(compiler, FINST(MOVFR2GR, word_data) | RD(dst_r) | FRJ(TMP_FREG1))); in sljit_emit_fop1_conv_sw_from_f64()
2270 return emit_op_mem2(compiler, word_data ? WORD_DATA : INT_DATA, TMP_REG2, dst, dstw, 0, 0); in sljit_emit_fop1_conv_sw_from_f64()
2274 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_w(struct sljit_compiler *compiler, slji… in sljit_emit_fop1_conv_f64_from_w() argument
2297 …FAIL_IF(emit_op_mem2(compiler, (word_data ? WORD_DATA : INT_DATA) | LOAD_DATA, TMP_REG1, src, srcw… in sljit_emit_fop1_conv_f64_from_w()
2303 FAIL_IF(load_immediate(compiler, TMP_REG1, srcw)); in sljit_emit_fop1_conv_f64_from_w()
2306 FAIL_IF(push_inst(compiler, (word_data ? MOVGR2FR_D : MOVGR2FR_W) | FRD(dst_r) | RJ(src))); in sljit_emit_fop1_conv_f64_from_w()
2307 FAIL_IF(push_inst(compiler, inst | FRD(dst_r) | FRJ(dst_r))); in sljit_emit_fop1_conv_f64_from_w()
2310 return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0); in sljit_emit_fop1_conv_f64_from_w()
2314 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
2318 return sljit_emit_fop1_conv_f64_from_w(compiler, op, dst, dstw, src, srcw); in sljit_emit_fop1_conv_f64_from_sw()
2321 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
2344 …FAIL_IF(emit_op_mem2(compiler, (word_data ? WORD_DATA : INT_DATA) | LOAD_DATA, TMP_REG1, src, srcw… in sljit_emit_fop1_conv_f64_from_uw()
2350 FAIL_IF(load_immediate(compiler, TMP_REG1, srcw)); in sljit_emit_fop1_conv_f64_from_uw()
2355 FAIL_IF(push_inst(compiler, SRLI_W | RD(src) | RJ(src) | IMM_I12(0))); in sljit_emit_fop1_conv_f64_from_uw()
2357 FAIL_IF(push_inst(compiler, BLT | RJ(src) | RD(TMP_ZERO) | IMM_I16(4))); in sljit_emit_fop1_conv_f64_from_uw()
2359 FAIL_IF(push_inst(compiler, (word_data ? MOVGR2FR_D : MOVGR2FR_W) | FRD(dst_r) | RJ(src))); in sljit_emit_fop1_conv_f64_from_uw()
2360 FAIL_IF(push_inst(compiler, inst | FRD(dst_r) | FRJ(dst_r))); in sljit_emit_fop1_conv_f64_from_uw()
2361 FAIL_IF(push_inst(compiler, B | IMM_I26(7))); in sljit_emit_fop1_conv_f64_from_uw()
2363 FAIL_IF(push_inst(compiler, ANDI | RD(TMP_REG2) | RJ(src) | IMM_I12(1))); in sljit_emit_fop1_conv_f64_from_uw()
2364 FAIL_IF(push_inst(compiler, (word_data ? SRLI_D : SRLI_W) | RD(TMP_REG1) | RJ(src) | IMM_I12(1))); in sljit_emit_fop1_conv_f64_from_uw()
2365 FAIL_IF(push_inst(compiler, OR | RD(TMP_REG1) | RJ(TMP_REG1) | RK(TMP_REG2))); in sljit_emit_fop1_conv_f64_from_uw()
2366 FAIL_IF(push_inst(compiler, INST(MOVGR2FR, (!word_data)) | FRD(dst_r) | RJ(TMP_REG1))); in sljit_emit_fop1_conv_f64_from_uw()
2367 FAIL_IF(push_inst(compiler, inst | FRD(dst_r) | FRJ(dst_r))); in sljit_emit_fop1_conv_f64_from_uw()
2368 FAIL_IF(push_inst(compiler, FINST(FADD, op) | FRD(dst_r) | FRJ(dst_r) | FRK(dst_r))); in sljit_emit_fop1_conv_f64_from_uw()
2371 return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0); in sljit_emit_fop1_conv_f64_from_uw()
2375 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1_cmp() argument
2380 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w)); in sljit_emit_fop1_cmp()
2385 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, 0, 0)); in sljit_emit_fop1_cmp()
2389 FAIL_IF(push_inst(compiler, XOR | RD(OTHER_FLAG) | RJ(OTHER_FLAG) | RK(OTHER_FLAG))); in sljit_emit_fop1_cmp()
2394 …FAIL_IF(push_inst(compiler, FINST(FCMP_COND, op) | COND_CEQ | FCD(F_OTHER_FLAG) | FRJ(src1) | FRK(… in sljit_emit_fop1_cmp()
2398 …FAIL_IF(push_inst(compiler, FINST(FCMP_COND, op) | COND_CLT | FCD(F_OTHER_FLAG) | FRJ(src1) | FRK(… in sljit_emit_fop1_cmp()
2402 …FAIL_IF(push_inst(compiler, FINST(FCMP_COND, op) | COND_CLT | FCD(F_OTHER_FLAG) | FRJ(src2) | FRK(… in sljit_emit_fop1_cmp()
2405 …FAIL_IF(push_inst(compiler, FINST(FCMP_COND, op) | COND_CULT | FCD(F_OTHER_FLAG) | FRJ(src2) | FRK… in sljit_emit_fop1_cmp()
2408 …FAIL_IF(push_inst(compiler, FINST(FCMP_COND, op) | COND_CULT | FCD(F_OTHER_FLAG) | FRJ(src1) | FRK… in sljit_emit_fop1_cmp()
2411 …FAIL_IF(push_inst(compiler, FINST(FCMP_COND, op) | COND_CUEQ | FCD(F_OTHER_FLAG) | FRJ(src1) | FRK… in sljit_emit_fop1_cmp()
2414 …FAIL_IF(push_inst(compiler, FINST(FCMP_COND, op) | COND_CUN | FCD(F_OTHER_FLAG) | FRJ(src1) | FRK(… in sljit_emit_fop1_cmp()
2416 return push_inst(compiler, MOVCF2GR | RD(OTHER_FLAG) | FCJ(F_OTHER_FLAG)); in sljit_emit_fop1_cmp()
2419 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1() argument
2426 compiler->cache_arg = 0; in sljit_emit_fop1()
2427 compiler->cache_argw = 0; in sljit_emit_fop1()
2430 SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw); in sljit_emit_fop1()
2438 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, dst_r, src, srcw, dst, dstw)); in sljit_emit_fop1()
2446 FAIL_IF(push_inst(compiler, FINST(FMOV, op) | FRD(dst_r) | FRJ(src))); in sljit_emit_fop1()
2452 FAIL_IF(push_inst(compiler, FINST(FNEG, op) | FRD(dst_r) | FRJ(src))); in sljit_emit_fop1()
2455 FAIL_IF(push_inst(compiler, FINST(FABS, op) | FRD(dst_r) | FRJ(src))); in sljit_emit_fop1()
2459 FAIL_IF(push_inst(compiler, ((op & SLJIT_32) ? FCVT_D_S : FCVT_S_D) | FRD(dst_r) | FRJ(src))); in sljit_emit_fop1()
2465 return emit_op_mem2(compiler, FLOAT_DATA(op), dst_r, dst, dstw, 0, 0); in sljit_emit_fop1()
2469 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop2() argument
2477 CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_fop2()
2482 compiler->cache_arg = 0; in sljit_emit_fop2()
2483 compiler->cache_argw = 0; in sljit_emit_fop2()
2488 if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w)) { in sljit_emit_fop2()
2489 FAIL_IF(compiler->error); in sljit_emit_fop2()
2496 if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w)) { in sljit_emit_fop2()
2497 FAIL_IF(compiler->error); in sljit_emit_fop2()
2505 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, src1, src1w)); in sljit_emit_fop2()
2506 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, dst, dstw)); in sljit_emit_fop2()
2508 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w)); in sljit_emit_fop2()
2509 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, dst, dstw)); in sljit_emit_fop2()
2513 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, dst, dstw)); in sljit_emit_fop2()
2515 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, dst, dstw)); in sljit_emit_fop2()
2524 FAIL_IF(push_inst(compiler, FINST(FADD, op) | FRD(dst_r) | FRJ(src1) | FRK(src2))); in sljit_emit_fop2()
2527 FAIL_IF(push_inst(compiler, FINST(FSUB, op) | FRD(dst_r) | FRJ(src1) | FRK(src2))); in sljit_emit_fop2()
2530 FAIL_IF(push_inst(compiler, FINST(FMUL, op) | FRD(dst_r) | FRJ(src1) | FRK(src2))); in sljit_emit_fop2()
2533 FAIL_IF(push_inst(compiler, FINST(FDIV, op) | FRD(dst_r) | FRJ(src1) | FRK(src2))); in sljit_emit_fop2()
2538 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG2, dst, dstw, 0, 0)); in sljit_emit_fop2()
2542 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2r(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop2r() argument
2550 CHECK(check_sljit_emit_fop2r(compiler, op, dst_freg, src1, src1w, src2, src2w)); in sljit_emit_fop2r()
2555 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src2, src2w, 0, 0)); in sljit_emit_fop2r()
2561 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, reg, src1, src1w, 0, 0)); in sljit_emit_fop2r()
2565 return push_inst(compiler, FINST(FCOPYSIGN, op) | FRD(dst_freg) | FRJ(src1) | FRK(src2)); in sljit_emit_fop2r()
2568 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fset32(struct sljit_compiler *compiler, in sljit_emit_fset32() argument
2577 CHECK(check_sljit_emit_fset32(compiler, freg, value)); in sljit_emit_fset32()
2582 return push_inst(compiler, MOVGR2FR_W | RJ(TMP_ZERO) | FRD(freg)); in sljit_emit_fset32()
2584 FAIL_IF(load_immediate(compiler, TMP_REG1, u.imm)); in sljit_emit_fset32()
2585 return push_inst(compiler, MOVGR2FR_W | RJ(TMP_REG1) | FRD(freg)); in sljit_emit_fset32()
2588 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fset64(struct sljit_compiler *compiler, in sljit_emit_fset64() argument
2597 CHECK(check_sljit_emit_fset64(compiler, freg, value)); in sljit_emit_fset64()
2602 return push_inst(compiler, MOVGR2FR_D | RJ(TMP_ZERO) | FRD(freg)); in sljit_emit_fset64()
2604 FAIL_IF(load_immediate(compiler, TMP_REG1, u.imm)); in sljit_emit_fset64()
2605 return push_inst(compiler, MOVGR2FR_D | RJ(TMP_REG1) | FRD(freg)); in sljit_emit_fset64()
2608 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fcopy(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fcopy() argument
2614 CHECK(check_sljit_emit_fcopy(compiler, op, freg, reg)); in sljit_emit_fcopy()
2620 return push_inst(compiler, inst); in sljit_emit_fcopy()
2623 /* --------------------------------------------------------------------- */
2625 /* --------------------------------------------------------------------- */
2627 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler) in sljit_emit_label() argument
2632 CHECK_PTR(check_sljit_emit_label(compiler)); in sljit_emit_label()
2634 if (compiler->last_label && compiler->last_label->size == compiler->size) in sljit_emit_label()
2635 return compiler->last_label; in sljit_emit_label()
2637 label = (struct sljit_label*)ensure_abuf(compiler, sizeof(struct sljit_label)); in sljit_emit_label()
2639 set_label(label, compiler); in sljit_emit_label()
2694 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_… in sljit_emit_jump() argument
2700 CHECK_PTR(check_sljit_emit_jump(compiler, type)); in sljit_emit_jump()
2702 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
2704 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
2710 PTR_FAIL_IF(push_inst(compiler, inst)); in sljit_emit_jump()
2711 jump->flags |= IS_COND; in sljit_emit_jump()
2714 jump->addr = compiler->size; in sljit_emit_jump()
2718 jump->flags |= IS_CALL; in sljit_emit_jump()
2722 PTR_FAIL_IF(push_inst(compiler, inst)); in sljit_emit_jump()
2725 compiler->size += JUMP_MAX_SIZE - 1; in sljit_emit_jump()
2729 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_… in sljit_emit_call() argument
2734 CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types)); in sljit_emit_call()
2737 PTR_FAIL_IF(emit_stack_frame_release(compiler, 0)); in sljit_emit_call()
2741 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_call()
2742 return sljit_emit_jump(compiler, type); in sljit_emit_call()
2745 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s… in sljit_emit_cmp() argument
2755 CHECK_PTR(check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w)); in sljit_emit_cmp()
2759 compiler->cache_arg = 0; in sljit_emit_cmp()
2760 compiler->cache_argw = 0; in sljit_emit_cmp()
2765 PTR_FAIL_IF(emit_op_mem2(compiler, flags, TMP_REG1, src1, src1w, src2, src2w)); in sljit_emit_cmp()
2770 PTR_FAIL_IF(emit_op_mem2(compiler, flags, src2_tmp_reg, src2, src2w, 0, 0)); in sljit_emit_cmp()
2776 PTR_FAIL_IF(load_immediate(compiler, TMP_REG1, src1w)); in sljit_emit_cmp()
2785 PTR_FAIL_IF(load_immediate(compiler, src2_tmp_reg, src2w)); in sljit_emit_cmp()
2792 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_cmp()
2794 set_jump(jump, compiler, (sljit_u32)((type & SLJIT_REWRITABLE_JUMP) | IS_COND)); in sljit_emit_cmp()
2833 PTR_FAIL_IF(push_inst(compiler, inst)); in sljit_emit_cmp()
2835 jump->addr = compiler->size; in sljit_emit_cmp()
2836 PTR_FAIL_IF(push_inst(compiler, JIRL | RD(TMP_ZERO) | RJ(TMP_REG1) | IMM_I12(0))); in sljit_emit_cmp()
2839 compiler->size += JUMP_MAX_SIZE - 1; in sljit_emit_cmp()
2844 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type… in sljit_emit_ijump() argument
2849 CHECK(check_sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_ijump()
2854 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw)); in sljit_emit_ijump()
2857 …return push_inst(compiler, JIRL | RD((type >= SLJIT_FAST_CALL) ? RETURN_ADDR_REG : TMP_ZERO) | RJ(… in sljit_emit_ijump()
2861 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
2863 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_CALL : 0)); in sljit_emit_ijump()
2864 jump->u.target = (sljit_uw)srcw; in sljit_emit_ijump()
2866 jump->addr = compiler->size; in sljit_emit_ijump()
2867 …FAIL_IF(push_inst(compiler, JIRL | RD((type >= SLJIT_FAST_CALL) ? RETURN_ADDR_REG : TMP_ZERO) | RJ… in sljit_emit_ijump()
2870 compiler->size += JUMP_MAX_SIZE - 1; in sljit_emit_ijump()
2875 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_icall() argument
2881 CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw)); in sljit_emit_icall()
2885 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw)); in sljit_emit_icall()
2890 …if (src >= SLJIT_FIRST_SAVED_REG && src <= (SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->options))… in sljit_emit_icall()
2891 FAIL_IF(push_inst(compiler, ADDI_D | RD(TMP_REG1) | RJ(src) | IMM_I12(0))); in sljit_emit_icall()
2895 FAIL_IF(emit_stack_frame_release(compiler, 0)); in sljit_emit_icall()
2899 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_icall()
2900 return sljit_emit_ijump(compiler, type, src, srcw); in sljit_emit_icall()
2903 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 o… in sljit_emit_op_flags() argument
2912 CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type)); in sljit_emit_op_flags()
2918 compiler->cache_arg = 0; in sljit_emit_op_flags()
2919 compiler->cache_argw = 0; in sljit_emit_op_flags()
2922 FAIL_IF(emit_op_mem2(compiler, mem_type | LOAD_DATA, TMP_REG1, dst, dstw, dst, dstw)); in sljit_emit_op_flags()
2931 FAIL_IF(push_inst(compiler, SLTUI | RD(dst_r) | RJ(EQUAL_FLAG) | IMM_I12(1))); in sljit_emit_op_flags()
2936 FAIL_IF(push_inst(compiler, SLTUI | RD(dst_r) | RJ(EQUAL_FLAG) | IMM_I12(1))); in sljit_emit_op_flags()
2942 if (compiler->status_flags_state & (SLJIT_CURRENT_FLAGS_ADD | SLJIT_CURRENT_FLAGS_SUB)) { in sljit_emit_op_flags()
2946 FAIL_IF(push_inst(compiler, SLTUI | RD(dst_r) | RJ(OTHER_FLAG) | IMM_I12(1))); in sljit_emit_op_flags()
2972 FAIL_IF(push_inst(compiler, XORI | RD(dst_r) | RJ(src_r) | IMM_I12(1))); in sljit_emit_op_flags()
2978 return emit_op_mem(compiler, mem_type, src_r, dst, dstw); in sljit_emit_op_flags()
2981 return push_inst(compiler, ADDI_D | RD(dst_r) | RJ(src_r) | IMM_I12(0)); in sljit_emit_op_flags()
2988 return emit_op(compiler, saved_op, mem_type, dst, dstw, TMP_REG1, 0, src_r, 0); in sljit_emit_op_flags()
2989 return emit_op(compiler, saved_op, mem_type, dst, dstw, dst, dstw, src_r, 0); in sljit_emit_op_flags()
2992 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_select(struct sljit_compiler *compiler, sljit_s32 typ… in sljit_emit_select() argument
3002 CHECK(check_sljit_emit_select(compiler, type, dst_reg, src1, src1w, src2_reg)); in sljit_emit_select()
3012 FAIL_IF(push_inst(compiler, ADDI_D | RD(TMP_REG1) | RJ(dst_reg) | IMM_I12(0))); in sljit_emit_select()
3021 FAIL_IF(push_inst(compiler, ADDI_D | RD(dst_reg) | RJ(src2_reg) | IMM_I12(0))); in sljit_emit_select()
3025 size = compiler->size; in sljit_emit_select()
3027 ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in sljit_emit_select()
3029 compiler->size++; in sljit_emit_select()
3032 FAIL_IF(emit_op_mem(compiler, inp_flags, dst_reg, src1, src1w)); in sljit_emit_select()
3036 FAIL_IF(load_immediate(compiler, dst_reg, src1w)); in sljit_emit_select()
3038 FAIL_IF(push_inst(compiler, ADDI_D | RD(dst_reg) | RJ(src1) | IMM_I12(0))); in sljit_emit_select()
3040 *ptr = get_jump_instruction(type & ~SLJIT_32) | IMM_I16(compiler->size - size); in sljit_emit_select()
3044 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fselect(struct sljit_compiler *compiler, sljit_s32 ty… in sljit_emit_fselect() argument
3052 CHECK(check_sljit_emit_fselect(compiler, type, dst_freg, src1, src1w, src2_freg)); in sljit_emit_fselect()
3059 FAIL_IF(push_inst(compiler, MOVGR2CF | FCD(F_OTHER_FLAG) | RJ(EQUAL_FLAG))); in sljit_emit_fselect()
3063 FAIL_IF(push_inst(compiler, MOVGR2CF | FCD(F_OTHER_FLAG) | RJ(OTHER_FLAG))); in sljit_emit_fselect()
3067 FAIL_IF(emit_op_mem(compiler, FLOAT_DATA(type) | LOAD_DATA, TMP_FREG2, src1, src1w)); in sljit_emit_fselect()
3069 …return push_inst(compiler, FSEL | FRD(dst_freg) | FRJ(TMP_FREG2) | FRK(src2_freg) | FCA(F_OTHER_FL… in sljit_emit_fselect()
3070 …return push_inst(compiler, FSEL | FRD(dst_freg) | FRJ(src2_freg) | FRK(TMP_FREG2) | FCA(F_OTHER_FL… in sljit_emit_fselect()
3073 … return push_inst(compiler, FSEL | FRD(dst_freg) | FRJ(src1) | FRK(src2_freg) | FCA(F_OTHER_FLAG)); in sljit_emit_fselect()
3074 return push_inst(compiler, FSEL | FRD(dst_freg) | FRJ(src2_freg) | FRK(src1) | FCA(F_OTHER_FLAG)); in sljit_emit_fselect()
3080 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_mem() argument
3087 CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw)); in sljit_emit_mem()
3090 return sljit_emit_mem_unaligned(compiler, type, reg, mem, memw); in sljit_emit_mem()
3096 FAIL_IF(push_inst(compiler, SLLI_D | RD(TMP_REG1) | RJ(OFFS_REG(mem)) | IMM_I12(memw))); in sljit_emit_mem()
3097 FAIL_IF(push_inst(compiler, ADD_D| RD(TMP_REG1) | RJ(TMP_REG1) | RK(mem & REG_MASK))); in sljit_emit_mem()
3099 FAIL_IF(push_inst(compiler, ADD_D| RD(TMP_REG1) | RJ(mem & REG_MASK) | RK(OFFS_REG(mem)))); in sljit_emit_mem()
3103 } else if (memw > I12_MAX - SSIZE_OF(sw) || memw < I12_MIN) { in sljit_emit_mem()
3104 if (((memw + 0x800) & 0xfff) <= 0xfff - SSIZE_OF(sw)) { in sljit_emit_mem()
3105 FAIL_IF(load_immediate(compiler, TMP_REG1, TO_ARGW_HI(memw))); in sljit_emit_mem()
3108 FAIL_IF(load_immediate(compiler, TMP_REG1, memw)); in sljit_emit_mem()
3113 FAIL_IF(push_inst(compiler, ADD_D| RD(TMP_REG1) | RJ(TMP_REG1) | RK(mem & REG_MASK))); in sljit_emit_mem()
3121 SLJIT_ASSERT((memw >= 0 && memw <= I12_MAX - SSIZE_OF(sw)) || (memw > I12_MAX && memw <= 0xfff)); in sljit_emit_mem()
3124 …FAIL_IF(push_mem_inst(compiler, WORD_DATA | LOAD_DATA, REG_PAIR_SECOND(reg), SLJIT_MEM1(mem), (mem… in sljit_emit_mem()
3125 return push_mem_inst(compiler, WORD_DATA | LOAD_DATA, REG_PAIR_FIRST(reg), SLJIT_MEM1(mem), memw); in sljit_emit_mem()
3130 FAIL_IF(push_mem_inst(compiler, flags, REG_PAIR_FIRST(reg), SLJIT_MEM1(mem), memw)); in sljit_emit_mem()
3131 …return push_mem_inst(compiler, flags, REG_PAIR_SECOND(reg), SLJIT_MEM1(mem), (memw + SSIZE_OF(sw))… in sljit_emit_mem()
3136 static sljit_s32 sljit_emit_simd_mem_offset(struct sljit_compiler *compiler, sljit_s32 *mem_ptr, sl… in sljit_emit_simd_mem_offset() argument
3142 FAIL_IF(push_inst(compiler, SLLI_D | RD(TMP_REG3) | RJ(OFFS_REG(mem)) | IMM_I12(memw & 0x3))); in sljit_emit_simd_mem_offset()
3143 return push_inst(compiler, ADD_D | RD(TMP_REG3) | RJ(TMP_REG3) | RK(mem & REG_MASK)); in sljit_emit_simd_mem_offset()
3148 return load_immediate(compiler, TMP_REG3, memw); in sljit_emit_simd_mem_offset()
3160 FAIL_IF(load_immediate(compiler, TMP_REG3, memw)); in sljit_emit_simd_mem_offset()
3161 return push_inst(compiler, ADD_D | RD(TMP_REG3) | RJ(TMP_REG3) | RK(mem)); in sljit_emit_simd_mem_offset()
3164 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_mov(struct sljit_compiler *compiler, sljit_s32 t… in sljit_emit_simd_mov() argument
3172 CHECK(check_sljit_emit_simd_mov(compiler, type, freg, srcdst, srcdstw)); in sljit_emit_simd_mov()
3196 return push_inst(compiler, ins); in sljit_emit_simd_mov()
3205 return push_inst(compiler, ins | FRD(freg) | RJ((sljit_u8)srcdst) | IMM_I12(srcdstw)); in sljit_emit_simd_mov()
3207 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &srcdst, srcdstw)); in sljit_emit_simd_mov()
3208 return push_inst(compiler, ins | FRD(freg) | RJ(srcdst) | IMM_I12(0)); in sljit_emit_simd_mov()
3212 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_replicate(struct sljit_compiler *compiler, sljit… in sljit_emit_simd_replicate() argument
3221 CHECK(check_sljit_emit_simd_replicate(compiler, type, freg, src, srcw)); in sljit_emit_simd_replicate()
3235 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &src, srcw)); in sljit_emit_simd_replicate()
3240 …return push_inst(compiler, VLDREPL | ins | FRD(freg) | RJ(src) | (sljit_ins)1 << (23 - elem_size)); in sljit_emit_simd_replicate()
3248 …return push_inst(compiler, VREPLGR2VR | ins | FRD(freg) | RJ(TMP_ZERO) | (sljit_ins)elem_size << 1… in sljit_emit_simd_replicate()
3250 …FAIL_IF(push_inst(compiler, VREPLVE | ins | FRD(freg) | FRJ(src) | RK(TMP_ZERO) | (sljit_ins)elem_… in sljit_emit_simd_replicate()
3254 return push_inst(compiler, XVPERMI | ins | FRD(freg) | FRJ(freg)); in sljit_emit_simd_replicate()
3263 FAIL_IF(load_immediate(compiler, TMP_REG2, srcw)); in sljit_emit_simd_replicate()
3267 return push_inst(compiler, ins | FRD(freg) | RJ(src)); in sljit_emit_simd_replicate()
3270 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_lane_mov(struct sljit_compiler *compiler, sljit_… in sljit_emit_simd_lane_mov() argument
3279 CHECK(check_sljit_emit_simd_lane_mov(compiler, type, freg, lane_index, srcdst, srcdstw)); in sljit_emit_simd_lane_mov()
3302 FAIL_IF(push_inst(compiler, VOR_V | ins | FRD(TMP_FREG1) | FRJ(freg) | FRK(freg))); in sljit_emit_simd_lane_mov()
3307 FAIL_IF(push_inst(compiler, VXOR_V | ins | FRD(freg) | FRJ(freg) | FRK(freg))); in sljit_emit_simd_lane_mov()
3311 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &srcdst, srcdstw)); in sljit_emit_simd_lane_mov()
3317 ins |= (sljit_ins)lane_index << 18 | (sljit_ins)(1 << (23 - elem_size)); in sljit_emit_simd_lane_mov()
3318 return push_inst(compiler, VSTELM | ins | FRD(freg) | RJ(srcdst)); in sljit_emit_simd_lane_mov()
3320 …emit_op_mem(compiler, (elem_size == 3 ? WORD_DATA : (elem_size == 2 ? INT_DATA : (elem_size == 1 ?… in sljit_emit_simd_lane_mov()
3326 … FAIL_IF(push_inst(compiler, VOR_V | (sljit_ins)1 << 26 | FRD(TMP_FREG1) | FRJ(freg) | FRK(freg))); in sljit_emit_simd_lane_mov()
3327 if (lane_index >= (2 << (3 - elem_size))) { in sljit_emit_simd_lane_mov()
3328 …FAIL_IF(push_inst(compiler, XVPERMI | (sljit_ins)1 << 18 | FRD(TMP_FREG1) | FRJ(freg) | IMM_I8(1))… in sljit_emit_simd_lane_mov()
3329 …FAIL_IF(push_inst(compiler, VINSGR2VR | ins | FRD(TMP_FREG1) | RJ(srcdst) | IMM_V(lane_index % (2 … in sljit_emit_simd_lane_mov()
3330 … return push_inst(compiler, XVPERMI | (sljit_ins)1 << 18 | FRD(freg) | FRJ(TMP_FREG1) | IMM_I8(2)); in sljit_emit_simd_lane_mov()
3332 FAIL_IF(push_inst(compiler, VINSGR2VR | ins | FRD(freg) | RJ(srcdst) | IMM_V(lane_index))); in sljit_emit_simd_lane_mov()
3333 …return push_inst(compiler, XVPERMI | (sljit_ins)1 << 18 | FRD(freg) | FRJ(TMP_FREG1) | IMM_I8(18)); in sljit_emit_simd_lane_mov()
3339 return push_inst(compiler, VINSGR2VR | ins | FRD(freg) | RJ(srcdst) | IMM_V(lane_index)); in sljit_emit_simd_lane_mov()
3347 FAIL_IF(push_inst(compiler, VPICKVE2GR_U | ins | RD(TMP_REG1) | FRJ(freg) | IMM_V(lane_index))); in sljit_emit_simd_lane_mov()
3348 return push_inst(compiler, VINSGR2VR | ins | FRD(srcdst) | RJ(TMP_REG1) | IMM_V(0)); in sljit_emit_simd_lane_mov()
3350 FAIL_IF(push_inst(compiler, VPICKVE2GR_U | ins | RD(TMP_REG1) | FRJ(srcdst) | IMM_V(0))); in sljit_emit_simd_lane_mov()
3351 return push_inst(compiler, VINSGR2VR | ins | FRD(freg) | RJ(TMP_REG1) | IMM_V(lane_index)); in sljit_emit_simd_lane_mov()
3356 FAIL_IF(load_immediate(compiler, TMP_REG1, srcdstw)); in sljit_emit_simd_lane_mov()
3370 if (lane_index >= (2 << (3 - elem_size))) { in sljit_emit_simd_lane_mov()
3376 … FAIL_IF(push_inst(compiler, VOR_V | (sljit_ins)1 << 26 | FRD(TMP_FREG1) | FRJ(freg) | FRK(freg))); in sljit_emit_simd_lane_mov()
3377 …FAIL_IF(push_inst(compiler, XVPERMI | (sljit_ins)1 << 18 | FRD(TMP_FREG1) | FRJ(freg) | IMM_I8(1))… in sljit_emit_simd_lane_mov()
3378 …return push_inst(compiler, ins | RD(srcdst) | FRJ(TMP_FREG1) | IMM_V(lane_index % (2 << (3 - elem_… in sljit_emit_simd_lane_mov()
3381 ins ^= (sljit_ins)1 << (15 - elem_size); in sljit_emit_simd_lane_mov()
3386 return push_inst(compiler, ins | RD(srcdst) | FRJ(freg) | IMM_V(lane_index)); in sljit_emit_simd_lane_mov()
3392 … FAIL_IF(push_inst(compiler, VOR_V | (sljit_ins)1 << 26 | FRD(TMP_FREG1) | FRJ(freg) | FRK(freg))); in sljit_emit_simd_lane_mov()
3393 if (lane_index >= (2 << (3 - elem_size))) { in sljit_emit_simd_lane_mov()
3394 …FAIL_IF(push_inst(compiler, XVPERMI | (sljit_ins)1 << 18 | FRD(TMP_FREG1) | FRJ(freg) | IMM_I8(1))… in sljit_emit_simd_lane_mov()
3395 …FAIL_IF(push_inst(compiler, VINSGR2VR | ins | FRD(TMP_FREG1) | RJ(srcdst) | IMM_V(lane_index % (2 … in sljit_emit_simd_lane_mov()
3396 … return push_inst(compiler, XVPERMI | (sljit_ins)1 << 18 | FRD(freg) | FRJ(TMP_FREG1) | IMM_I8(2)); in sljit_emit_simd_lane_mov()
3398 FAIL_IF(push_inst(compiler, VINSGR2VR | ins | FRD(freg) | RJ(srcdst) | IMM_V(lane_index))); in sljit_emit_simd_lane_mov()
3399 …return push_inst(compiler, XVPERMI | (sljit_ins)1 << 18 | FRD(freg) | FRJ(TMP_FREG1) | IMM_I8(18)); in sljit_emit_simd_lane_mov()
3405 return push_inst(compiler, VINSGR2VR | ins | FRD(freg) | RJ(srcdst) | IMM_V(lane_index)); in sljit_emit_simd_lane_mov()
3411 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_lane_replicate(struct sljit_compiler *compiler, … in sljit_emit_simd_lane_replicate() argument
3420 CHECK(check_sljit_emit_simd_lane_replicate(compiler, type, freg, src, src_lane_index)); in sljit_emit_simd_lane_replicate()
3434 …FAIL_IF(push_inst(compiler, VREPLVEI | (sljit_ins)1 << 26 | ins | FRD(freg) | FRJ(src) | IMM_V(src… in sljit_emit_simd_lane_replicate()
3436 …ins = (src_lane_index < (2 << (3 - elem_size))) ? (sljit_ins)(0x44 << 10) : (sljit_ins)(0xee << 10… in sljit_emit_simd_lane_replicate()
3438 return push_inst(compiler, XVPERMI | ins | FRD(freg) | FRJ(freg)); in sljit_emit_simd_lane_replicate()
3441 return push_inst(compiler, VREPLVEI | ins | FRD(freg) | FRJ(src) | IMM_V(src_lane_index)); in sljit_emit_simd_lane_replicate()
3444 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_extend(struct sljit_compiler *compiler, sljit_s3… in sljit_emit_simd_extend() argument
3454 CHECK(check_sljit_emit_simd_extend(compiler, type, freg, src, srcw)); in sljit_emit_simd_extend()
3474 FAIL_IF(push_inst(compiler, ins | FRD(freg) | RJ(src) | IMM_I12(srcw))); in sljit_emit_simd_extend()
3476 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &src, srcw)); in sljit_emit_simd_extend()
3477 FAIL_IF(push_inst(compiler, ins | FRD(freg) | RJ(src) | IMM_I12(0))); in sljit_emit_simd_extend()
3489 FAIL_IF(push_inst(compiler, XVPERMI | FRD(src) | FRJ(src) | IMM_I8(16))); in sljit_emit_simd_extend()
3492 return push_inst(compiler, VFCVTL_D_S | ins | FRD(freg) | FRJ(src)); in sljit_emit_simd_extend()
3502 FAIL_IF(push_inst(compiler, XVPERMI | FRD(src) | FRJ(src) | IMM_I8(16))); in sljit_emit_simd_extend()
3504 FAIL_IF(push_inst(compiler, ins | ((sljit_ins)1 << (13 + elem_size)) | FRD(freg) | FRJ(src))); in sljit_emit_simd_extend()
3511 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_sign(struct sljit_compiler *compiler, sljit_s32 … in sljit_emit_simd_sign() argument
3521 CHECK(check_sljit_emit_simd_sign(compiler, type, freg, dst, dstw)); in sljit_emit_simd_sign()
3542 …FAIL_IF(push_inst(compiler, VMSKLTZ | ins | (sljit_ins)(elem_size << 10) | FRD(TMP_FREG1) | FRJ(fr… in sljit_emit_simd_sign()
3544 FAIL_IF(push_inst(compiler, VPICKVE2GR_U | (sljit_ins)(0x3c << 10) | RD(dst_r) | FRJ(TMP_FREG1))); in sljit_emit_simd_sign()
3547 …FAIL_IF(push_inst(compiler, VPICKVE2GR_U | (sljit_ins)(0x38 << 10) | ins | RD(TMP_REG3) | FRJ(TMP_… in sljit_emit_simd_sign()
3548 …FAIL_IF(push_inst(compiler, SLLI_W | RD(TMP_REG3) | RJ(TMP_REG3) | IMM_I12(2 << (3 - elem_size)))); in sljit_emit_simd_sign()
3549 FAIL_IF(push_inst(compiler, OR | RD(dst_r) | RJ(dst_r) | RK(TMP_REG3))); in sljit_emit_simd_sign()
3553 return emit_op_mem(compiler, ((type & SLJIT_32) ? INT_DATA : WORD_DATA), TMP_REG2, dst, dstw); in sljit_emit_simd_sign()
3558 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_op2(struct sljit_compiler *compiler, sljit_s32 t… in sljit_emit_simd_op2() argument
3566 CHECK(check_sljit_emit_simd_op2(compiler, type, dst_freg, src1_freg, src2_freg)); in sljit_emit_simd_op2()
3595 return push_inst(compiler, ins | FRD(dst_freg) | FRJ(src1_freg) | FRK(src2_freg)); in sljit_emit_simd_op2()
3598 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_atomic_load(struct sljit_compiler *compiler, in sljit_emit_atomic_load() argument
3606 CHECK(check_sljit_emit_atomic_load(compiler, op, dst_reg, mem_reg)); in sljit_emit_atomic_load()
3626 return push_inst(compiler, ins | RD(dst_reg) | RJ(mem_reg) | IMM_I12(0)); in sljit_emit_atomic_load()
3629 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_atomic_store(struct sljit_compiler *compiler, in sljit_emit_atomic_store() argument
3640 CHECK(check_sljit_emit_atomic_store(compiler, op, src_reg, mem_reg, temp_reg)); in sljit_emit_atomic_store()
3664 FAIL_IF(push_inst(compiler, XOR | RD(TMP_REG1) | RJ(temp_reg) | RK(TMP_ZERO))); in sljit_emit_atomic_store()
3667 FAIL_IF(push_inst(compiler, ins | RD(tmp) | RJ(mem_reg) | RK(src_reg))); in sljit_emit_atomic_store()
3672 FAIL_IF(push_inst(compiler, unsign | RD(tmp) | RJ(tmp))); in sljit_emit_atomic_store()
3674 FAIL_IF(push_inst(compiler, XOR | RD(EQUAL_FLAG) | RJ(tmp) | RK(temp_reg))); in sljit_emit_atomic_store()
3675 return push_inst(compiler, SLTUI | RD(EQUAL_FLAG) | RJ(EQUAL_FLAG) | IMM_I12(1)); in sljit_emit_atomic_store()
3678 static SLJIT_INLINE sljit_s32 emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw i… in emit_const() argument
3682 …FAIL_IF(push_inst(compiler, LU12I_W | RD(dst) | (sljit_ins)(((init_value & 0xffffffff) >> 12) << 5… in emit_const()
3683 FAIL_IF(push_inst(compiler, LU32I_D | RD(dst) | (sljit_ins)(((init_value >> 32) & 0xfffff) << 5))); in emit_const()
3684 FAIL_IF(push_inst(compiler, LU52I_D | RD(dst) | RJ(dst) | (sljit_ins)(IMM_I12(init_value >> 52)))); in emit_const()
3685 return push_inst(compiler, ORI | RD(dst) | RJ(dst) | IMM_I12(init_value)); in emit_const()
3716 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, slji… in sljit_emit_const() argument
3722 CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); in sljit_emit_const()
3725 const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const)); in sljit_emit_const()
3727 set_const(const_, compiler); in sljit_emit_const()
3730 PTR_FAIL_IF(emit_const(compiler, dst_r, init_value, 0)); in sljit_emit_const()
3733 PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw)); in sljit_emit_const()
3738 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_mov_addr(struct sljit_compiler *compiler, sl… in sljit_emit_mov_addr() argument
3744 CHECK_PTR(check_sljit_emit_mov_addr(compiler, dst, dstw)); in sljit_emit_mov_addr()
3747 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_mov_addr()
3749 set_mov_addr(jump, compiler, 0); in sljit_emit_mov_addr()
3752 PTR_FAIL_IF(push_inst(compiler, (sljit_ins)dst_r)); in sljit_emit_mov_addr()
3754 compiler->size += JUMP_MAX_SIZE - 1; in sljit_emit_mov_addr()
3757 PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw)); in sljit_emit_mov_addr()