Lines Matching refs:compiler

152 static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins ins)  in push_inst()  argument
154 sljit_ins *ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_inst()
157 compiler->size++; in push_inst()
161 static sljit_s32 push_imm_s_inst(struct sljit_compiler *compiler, sljit_ins ins, sljit_sw imm) in push_imm_s_inst() argument
163 return push_inst(compiler, ins | IMM_S(imm)); in push_imm_s_inst()
373 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler) in sljit_generate_code() argument
391 CHECK_PTR(check_sljit_generate_code(compiler)); in sljit_generate_code()
392 reverse_buf(compiler); in sljit_generate_code()
394 …code = (sljit_ins*)SLJIT_MALLOC_EXEC(compiler->size * sizeof(sljit_ins), compiler->exec_allocator_… in sljit_generate_code()
396 buf = compiler->buf; in sljit_generate_code()
403 label = compiler->labels; in sljit_generate_code()
404 jump = compiler->jumps; in sljit_generate_code()
405 const_ = compiler->consts; in sljit_generate_code()
406 put_label = compiler->put_labels; in sljit_generate_code()
470 SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size); in sljit_generate_code()
472 jump = compiler->jumps; in sljit_generate_code()
512 put_label = compiler->put_labels; in sljit_generate_code()
518 compiler->error = SLJIT_ERR_COMPILED; in sljit_generate_code()
519 compiler->executable_offset = executable_offset; in sljit_generate_code()
520 compiler->executable_size = (sljit_uw)(code_ptr - code) * sizeof(sljit_ins); in sljit_generate_code()
595 static sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit…
597 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, in sljit_emit_enter() argument
605 …CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds,… in sljit_emit_enter()
606 set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_emit_enter()
619 compiler->local_size = local_size; in sljit_emit_enter()
623 FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_SP) | RS1(SLJIT_SP) | IMM_I(-local_size))); in sljit_emit_enter()
627 FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_SP) | RS1(SLJIT_SP) | IMM_I(STACK_MAX_DISTANCE))); in sljit_emit_enter()
631 FAIL_IF(load_immediate(compiler, TMP_REG1, local_size, TMP_REG3)); in sljit_emit_enter()
635 FAIL_IF(push_imm_s_inst(compiler, STACK_STORE | RS1(SLJIT_SP) | RS2(RETURN_ADDR_REG), offset)); in sljit_emit_enter()
640 FAIL_IF(push_imm_s_inst(compiler, STACK_STORE | RS1(SLJIT_SP) | RS2(i), offset)); in sljit_emit_enter()
645 FAIL_IF(push_imm_s_inst(compiler, STACK_STORE | RS1(SLJIT_SP) | RS2(i), offset)); in sljit_emit_enter()
657 FAIL_IF(push_imm_s_inst(compiler, FSD | RS1(SLJIT_SP) | FRS2(i), offset)); in sljit_emit_enter()
662 FAIL_IF(push_imm_s_inst(compiler, FSD | RS1(SLJIT_SP) | FRS2(i), offset)); in sljit_emit_enter()
666 FAIL_IF(push_inst(compiler, SUB | RD(SLJIT_SP) | RS1(SLJIT_SP) | RS2(TMP_REG1))); in sljit_emit_enter()
668 FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_SP) | RS1(SLJIT_SP) | IMM_I(-local_size))); in sljit_emit_enter()
680 FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_S0 - saved_arg_count) | RS1(tmp) | IMM_I(0))); in sljit_emit_enter()
694 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, in sljit_set_context() argument
699 …CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds… in sljit_set_context()
700 set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_set_context()
712 compiler->local_size = (local_size + SLJIT_LOCALS_OFFSET + 15) & ~0xf; in sljit_set_context()
719 static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler, sljit_s32 is_return_to) in emit_stack_frame_release() argument
722 sljit_s32 local_size = compiler->local_size; in emit_stack_frame_release()
728 FAIL_IF(load_immediate(compiler, TMP_REG2, local_size, TMP_REG3)); in emit_stack_frame_release()
729 FAIL_IF(push_inst(compiler, ADD | RD(SLJIT_SP) | RS1(SLJIT_SP) | RS2(TMP_REG2))); in emit_stack_frame_release()
731 FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_SP) | RS1(SLJIT_SP) | IMM_I(local_size))); in emit_stack_frame_release()
740 FAIL_IF(push_inst(compiler, STACK_LOAD | RD(RETURN_ADDR_REG) | RS1(SLJIT_SP) | IMM_I(offset))); in emit_stack_frame_release()
742 tmp = SLJIT_S0 - compiler->saveds; in emit_stack_frame_release()
743 for (i = SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->options); i > tmp; i--) { in emit_stack_frame_release()
745 FAIL_IF(push_inst(compiler, STACK_LOAD | RD(i) | RS1(SLJIT_SP) | IMM_I(offset))); in emit_stack_frame_release()
748 for (i = compiler->scratches; i >= SLJIT_FIRST_SAVED_REG; i--) { in emit_stack_frame_release()
750 FAIL_IF(push_inst(compiler, STACK_LOAD | RD(i) | RS1(SLJIT_SP) | IMM_I(offset))); in emit_stack_frame_release()
759 tmp = SLJIT_FS0 - compiler->fsaveds; in emit_stack_frame_release()
762 FAIL_IF(push_inst(compiler, FLD | FRD(i) | RS1(SLJIT_SP) | IMM_I(offset))); in emit_stack_frame_release()
765 for (i = compiler->fscratches; i >= SLJIT_FIRST_SAVED_FLOAT_REG; i--) { in emit_stack_frame_release()
767 FAIL_IF(push_inst(compiler, FLD | FRD(i) | RS1(SLJIT_SP) | IMM_I(offset))); in emit_stack_frame_release()
770 return push_inst(compiler, ADDI | RD(SLJIT_SP) | RS1(SLJIT_SP) | IMM_I(local_size)); in emit_stack_frame_release()
775 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_void(struct sljit_compiler *compiler) in sljit_emit_return_void() argument
778 CHECK(check_sljit_emit_return_void(compiler)); in sljit_emit_return_void()
780 FAIL_IF(emit_stack_frame_release(compiler, 0)); in sljit_emit_return_void()
781 return push_inst(compiler, JALR | RD(TMP_ZERO) | RS1(RETURN_ADDR_REG) | IMM_I(0)); in sljit_emit_return_void()
784 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_to(struct sljit_compiler *compiler, in sljit_emit_return_to() argument
788 CHECK(check_sljit_emit_return_to(compiler, src, srcw)); in sljit_emit_return_to()
792 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw)); in sljit_emit_return_to()
795 …} else if (src >= SLJIT_FIRST_SAVED_REG && src <= (SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->op… in sljit_emit_return_to()
796 FAIL_IF(push_inst(compiler, ADDI | RD(TMP_REG1) | RS1(src) | IMM_I(0))); in sljit_emit_return_to()
801 FAIL_IF(emit_stack_frame_release(compiler, 1)); in sljit_emit_return_to()
803 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_return_to()
804 return sljit_emit_ijump(compiler, SLJIT_JUMP, src, srcw); in sljit_emit_return_to()
844 static sljit_s32 push_mem_inst(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, slj… in push_mem_inst() argument
856 return push_inst(compiler, ins); in push_mem_inst()
860 static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, s… in getput_arg_fast() argument
870 FAIL_IF(push_mem_inst(compiler, flags, reg, arg & REG_MASK, argw)); in getput_arg_fast()
904 static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_… in getput_arg() argument
925 if (argw == compiler->cache_argw) { in getput_arg()
926 if (arg == compiler->cache_arg) in getput_arg()
927 return push_mem_inst(compiler, flags, reg, TMP_REG3, 0); in getput_arg()
929 if ((SLJIT_MEM | (arg & OFFS_REG_MASK)) == compiler->cache_arg) { in getput_arg()
931 compiler->cache_arg = arg; in getput_arg()
932 compiler->cache_argw = argw; in getput_arg()
933 FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG3) | RS1(TMP_REG3) | RS2(base))); in getput_arg()
934 return push_mem_inst(compiler, flags, reg, TMP_REG3, 0); in getput_arg()
936 FAIL_IF(push_inst(compiler, ADD | RD(tmp_r) | RS1(base) | RS2(TMP_REG3))); in getput_arg()
937 return push_mem_inst(compiler, flags, reg, tmp_r, 0); in getput_arg()
942 compiler->cache_arg = SLJIT_MEM | (arg & OFFS_REG_MASK); in getput_arg()
943 compiler->cache_argw = argw; in getput_arg()
944 FAIL_IF(push_inst(compiler, SLLI | RD(TMP_REG3) | RS1(OFFS_REG(arg)) | IMM_I(argw))); in getput_arg()
948 compiler->cache_arg = arg; in getput_arg()
949 compiler->cache_argw = argw; in getput_arg()
950 …FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG3) | RS1(base) | RS2(!argw ? OFFS_REG(arg) : TMP_REG3)… in getput_arg()
954 … FAIL_IF(push_inst(compiler, ADD | RD(tmp_r) | RS1(base) | RS2(!argw ? OFFS_REG(arg) : TMP_REG3))); in getput_arg()
955 return push_mem_inst(compiler, flags, reg, tmp_r, 0); in getput_arg()
958 …if (compiler->cache_arg == arg && argw - compiler->cache_argw <= SIMM_MAX && argw - compiler->cach… in getput_arg()
959 return push_mem_inst(compiler, flags, reg, TMP_REG3, argw - compiler->cache_argw); in getput_arg()
961 …if (compiler->cache_arg == SLJIT_MEM && (argw - compiler->cache_argw <= SIMM_MAX) && (argw - compi… in getput_arg()
962 offset = argw - compiler->cache_argw; in getput_arg()
964 compiler->cache_arg = SLJIT_MEM; in getput_arg()
969 FAIL_IF(load_immediate(compiler, TMP_REG3, argw, tmp_r)); in getput_arg()
970 compiler->cache_argw = argw; in getput_arg()
973 FAIL_IF(load_immediate(compiler, TMP_REG3, argw_hi, tmp_r)); in getput_arg()
974 compiler->cache_argw = argw_hi; in getput_arg()
981 return push_mem_inst(compiler, flags, reg, TMP_REG3, offset); in getput_arg()
984 compiler->cache_arg = arg; in getput_arg()
985 FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG3) | RS1(TMP_REG3) | RS2(base))); in getput_arg()
986 return push_mem_inst(compiler, flags, reg, TMP_REG3, offset); in getput_arg()
989 FAIL_IF(push_inst(compiler, ADD | RD(tmp_r) | RS1(TMP_REG3) | RS2(base))); in getput_arg()
990 return push_mem_inst(compiler, flags, reg, tmp_r, offset); in getput_arg()
993 static sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit… in emit_op_mem() argument
998 if (getput_arg_fast(compiler, flags, reg, arg, argw)) in emit_op_mem()
999 return compiler->error; in emit_op_mem()
1008 FAIL_IF(push_inst(compiler, SLLI | RD(tmp_r) | RS1(OFFS_REG(arg)) | IMM_I(argw))); in emit_op_mem()
1009 FAIL_IF(push_inst(compiler, ADD | RD(tmp_r) | RS1(tmp_r) | RS2(base))); in emit_op_mem()
1012 FAIL_IF(push_inst(compiler, ADD | RD(tmp_r) | RS1(base) | RS2(OFFS_REG(arg)))); in emit_op_mem()
1016 FAIL_IF(load_immediate(compiler, tmp_r, TO_ARGW_HI(argw), TMP_REG3)); in emit_op_mem()
1019 FAIL_IF(push_inst(compiler, ADD | RD(tmp_r) | RS1(tmp_r) | RS2(base))); in emit_op_mem()
1022 return push_mem_inst(compiler, flags, reg, tmp_r, argw & 0xfff); in emit_op_mem()
1025 static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_… in emit_op_mem2() argument
1027 if (getput_arg_fast(compiler, flags, reg, arg1, arg1w)) in emit_op_mem2()
1028 return compiler->error; in emit_op_mem2()
1029 return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w); in emit_op_mem2()
1040 static sljit_s32 emit_clz_ctz(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_s… in emit_clz_ctz() argument
1053 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(OTHER_FLAG) | RS1(TMP_ZERO) | IMM_I(max))); in emit_clz_ctz()
1057 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(TMP_REG2) | RS1(src) | IMM_I(0))); in emit_clz_ctz()
1059 …FAIL_IF(push_inst(compiler, BEQ | RS1(TMP_REG2) | RS2(TMP_ZERO) | ((sljit_ins)((is_clz ? 4 : 5) * … in emit_clz_ctz()
1061 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(OTHER_FLAG) | RS1(TMP_ZERO) | IMM_I(0))); in emit_clz_ctz()
1063 FAIL_IF(push_inst(compiler, ANDI | RD(TMP_REG1) | RS1(TMP_REG2) | IMM_I(1))); in emit_clz_ctz()
1064 …FAIL_IF(push_inst(compiler, BNE | RS1(TMP_REG1) | RS2(TMP_ZERO) | ((sljit_ins)(2 * SSIZE_OF(ins)) … in emit_clz_ctz()
1066 …FAIL_IF(push_inst(compiler, BLT | RS1(TMP_REG2) | RS2(TMP_ZERO) | ((sljit_ins)(2 * SSIZE_OF(ins)) … in emit_clz_ctz()
1069 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(TMP_REG1) | RS1(TMP_ZERO) | IMM_I(max))); in emit_clz_ctz()
1071 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(EQUAL_FLAG) | RS1(TMP_REG2) | IMM_I(0))); in emit_clz_ctz()
1072 FAIL_IF(push_inst(compiler, SRLI | WORD | RD(TMP_REG1) | RS1(TMP_REG1) | IMM_I(1))); in emit_clz_ctz()
1074 …FAIL_IF(push_inst(compiler, (is_clz ? SRL : SLL) | WORD | RD(TMP_REG2) | RS1(EQUAL_FLAG) | RS2(TMP… in emit_clz_ctz()
1075 …FAIL_IF(push_inst(compiler, BNE | RS1(TMP_REG2) | RS2(TMP_ZERO) | ((sljit_ins)0xfe000e80 - ((2 * S… in emit_clz_ctz()
1076 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(TMP_REG2) | RS1(TMP_REG1) | IMM_I(-1))); in emit_clz_ctz()
1077 …FAIL_IF(push_inst(compiler, (is_clz ? SRL : SLL) | WORD | RD(TMP_REG2) | RS1(EQUAL_FLAG) | RS2(TMP… in emit_clz_ctz()
1078 FAIL_IF(push_inst(compiler, OR | RD(OTHER_FLAG) | RS1(OTHER_FLAG) | RS2(TMP_REG1))); in emit_clz_ctz()
1079 …FAIL_IF(push_inst(compiler, BEQ | RS1(TMP_REG2) | RS2(TMP_ZERO) | ((sljit_ins)0xfe000e80 - ((5 * S… in emit_clz_ctz()
1081 return push_inst(compiler, ADDI | WORD | RD(dst) | RS1(OTHER_FLAG) | IMM_I(0)); in emit_clz_ctz()
1087 FAIL_IF(push_inst(compiler, op_imm | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(src2))); \
1089 FAIL_IF(push_inst(compiler, op_imm | RD(dst) | RS1(src1) | IMM_I(src2))); \
1093 FAIL_IF(push_inst(compiler, op_reg | RD(EQUAL_FLAG) | RS1(src1) | RS2(src2))); \
1095 FAIL_IF(push_inst(compiler, op_reg | RD(dst) | RS1(src1) | RS2(src2))); \
1102 static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s… in emit_single_op() argument
1117 return push_inst(compiler, ADDI | RD(dst) | RS1(src2) | IMM_I(0)); in emit_single_op()
1123 return push_inst(compiler, ANDI | RD(dst) | RS1(src2) | IMM_I(0xff)); in emit_single_op()
1130 FAIL_IF(push_inst(compiler, SLLI | WORD | RD(dst) | RS1(src2) | IMM_EXTEND(24))); in emit_single_op()
1131 return push_inst(compiler, SRAI | WORD | RD(dst) | RS1(dst) | IMM_EXTEND(24)); in emit_single_op()
1139 FAIL_IF(push_inst(compiler, SLLI | WORD | RD(dst) | RS1(src2) | IMM_EXTEND(16))); in emit_single_op()
1140 return push_inst(compiler, SRLI | WORD | RD(dst) | RS1(dst) | IMM_EXTEND(16)); in emit_single_op()
1148 FAIL_IF(push_inst(compiler, SLLI | WORD | RD(dst) | RS1(src2) | IMM_EXTEND(16))); in emit_single_op()
1149 return push_inst(compiler, SRAI | WORD | RD(dst) | RS1(dst) | IMM_EXTEND(16)); in emit_single_op()
1158 FAIL_IF(push_inst(compiler, SLLI | RD(dst) | RS1(src2) | IMM_I(32))); in emit_single_op()
1159 return push_inst(compiler, SRLI | RD(dst) | RS1(dst) | IMM_I(32)); in emit_single_op()
1167 return push_inst(compiler, ADDI | 0x8 | RD(dst) | RS1(src2) | IMM_I(0)); in emit_single_op()
1175 return emit_clz_ctz(compiler, op, dst, src2); in emit_single_op()
1185 FAIL_IF(push_inst(compiler, ADDI | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(0))); in emit_single_op()
1187 FAIL_IF(push_inst(compiler, XORI | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(-1))); in emit_single_op()
1190 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1194 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(dst) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1198 FAIL_IF(push_inst(compiler, XOR | RD(EQUAL_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1200 FAIL_IF(push_inst(compiler, ADD | WORD | RD(EQUAL_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1208 FAIL_IF(push_inst(compiler, ADDI | RD(OTHER_FLAG) | RS1(src1) | IMM_I(0))); in emit_single_op()
1215 FAIL_IF(push_inst(compiler, ADD | WORD | RD(dst) | RS1(src1) | RS2(src2))); in emit_single_op()
1221 FAIL_IF(push_inst(compiler, SLTUI | RD(OTHER_FLAG) | RS1(dst) | IMM_I(src2))); in emit_single_op()
1223 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RS1(dst) | RS2(carry_src_r))); in emit_single_op()
1229 FAIL_IF(push_inst(compiler, XOR | RD(TMP_REG1) | RS1(dst) | RS2(EQUAL_FLAG))); in emit_single_op()
1231 FAIL_IF(push_inst(compiler, ADDI | RD(EQUAL_FLAG) | RS1(dst) | IMM_I(0))); in emit_single_op()
1232 FAIL_IF(push_inst(compiler, SRLI | WORD | RD(TMP_REG1) | RS1(TMP_REG1) | IMM_EXTEND(31))); in emit_single_op()
1233 return push_inst(compiler, XOR | RD(OTHER_FLAG) | RS1(TMP_REG1) | RS2(OTHER_FLAG)); in emit_single_op()
1239 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(dst) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1247 FAIL_IF(push_inst(compiler, ADDI | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(0))); in emit_single_op()
1252 FAIL_IF(push_inst(compiler, ADD | WORD | RD(dst) | RS1(src1) | RS2(src2))); in emit_single_op()
1258 FAIL_IF(push_inst(compiler, SLTUI | RD(EQUAL_FLAG) | RS1(dst) | IMM_I(src2))); in emit_single_op()
1260 FAIL_IF(push_inst(compiler, SLTU | RD(EQUAL_FLAG) | RS1(dst) | RS2(carry_src_r))); in emit_single_op()
1263 FAIL_IF(push_inst(compiler, ADD | WORD | RD(dst) | RS1(dst) | RS2(OTHER_FLAG))); in emit_single_op()
1269 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RS1(dst) | RS2(OTHER_FLAG))); in emit_single_op()
1271 return push_inst(compiler, OR | RD(OTHER_FLAG) | RS1(OTHER_FLAG) | RS2(EQUAL_FLAG)); in emit_single_op()
1275 FAIL_IF(push_inst(compiler, ADDI | RD(TMP_REG2) | RS1(TMP_ZERO) | IMM_I(src2))); in emit_single_op()
1284 FAIL_IF(push_inst(compiler, SLTUI | RD(OTHER_FLAG) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1288 FAIL_IF(push_inst(compiler, SLTI | RD(OTHER_FLAG) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1297 FAIL_IF(push_inst(compiler, ADDI | RD(TMP_REG2) | RS1(TMP_ZERO) | IMM_I(src2))); in emit_single_op()
1305 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1309 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RS1(src2) | RS2(src1))); in emit_single_op()
1313 FAIL_IF(push_inst(compiler, SLT | RD(OTHER_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1317 FAIL_IF(push_inst(compiler, SLT | RD(OTHER_FLAG) | RS1(src2) | RS2(src1))); in emit_single_op()
1325 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(-src2))); in emit_single_op()
1327 return push_inst(compiler, ADDI | WORD | RD(dst) | RS1(src1) | IMM_I(-src2)); in emit_single_op()
1331 FAIL_IF(push_inst(compiler, SUB | WORD | RD(EQUAL_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1333 return push_inst(compiler, SUB | WORD | RD(dst) | RS1(src1) | RS2(src2)); in emit_single_op()
1344 FAIL_IF(push_inst(compiler, ADDI | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(0))); in emit_single_op()
1346 FAIL_IF(push_inst(compiler, XORI | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(-1))); in emit_single_op()
1349 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(-src2))); in emit_single_op()
1352 FAIL_IF(push_inst(compiler, SLTUI | RD(OTHER_FLAG) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1356 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(dst) | RS1(src1) | IMM_I(-src2))); in emit_single_op()
1360 FAIL_IF(push_inst(compiler, XOR | RD(EQUAL_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1362 FAIL_IF(push_inst(compiler, SUB | WORD | RD(EQUAL_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1365 FAIL_IF(push_inst(compiler, SLTU | RD(OTHER_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1369 FAIL_IF(push_inst(compiler, SUB | WORD | RD(dst) | RS1(src1) | RS2(src2))); in emit_single_op()
1375 FAIL_IF(push_inst(compiler, XOR | RD(TMP_REG1) | RS1(dst) | RS2(EQUAL_FLAG))); in emit_single_op()
1377 FAIL_IF(push_inst(compiler, ADDI | RD(EQUAL_FLAG) | RS1(dst) | IMM_I(0))); in emit_single_op()
1378 FAIL_IF(push_inst(compiler, SRLI | WORD | RD(TMP_REG1) | RS1(TMP_REG1) | IMM_EXTEND(31))); in emit_single_op()
1379 return push_inst(compiler, XOR | RD(OTHER_FLAG) | RS1(TMP_REG1) | RS2(OTHER_FLAG)); in emit_single_op()
1383 FAIL_IF(push_inst(compiler, ADDI | RD(TMP_REG2) | RS1(TMP_ZERO) | IMM_I(src2))); in emit_single_op()
1392 FAIL_IF(push_inst(compiler, SLTUI | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1394 FAIL_IF(push_inst(compiler, ADDI | WORD | RD(dst) | RS1(src1) | IMM_I(-src2))); in emit_single_op()
1398 FAIL_IF(push_inst(compiler, SLTU | RD(EQUAL_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1400 FAIL_IF(push_inst(compiler, SUB | WORD | RD(dst) | RS1(src1) | RS2(src2))); in emit_single_op()
1404 FAIL_IF(push_inst(compiler, SLTU | RD(TMP_REG1) | RS1(dst) | RS2(OTHER_FLAG))); in emit_single_op()
1406 FAIL_IF(push_inst(compiler, SUB | WORD | RD(dst) | RS1(dst) | RS2(OTHER_FLAG))); in emit_single_op()
1411 return push_inst(compiler, OR | RD(OTHER_FLAG) | RS1(EQUAL_FLAG) | RS2(TMP_REG1)); in emit_single_op()
1417 return push_inst(compiler, MUL | WORD | RD(dst) | RS1(src1) | RS2(src2)); in emit_single_op()
1421 FAIL_IF(push_inst(compiler, MUL | RD(OTHER_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1422 FAIL_IF(push_inst(compiler, MUL | 0x8 | RD(dst) | RS1(src1) | RS2(src2))); in emit_single_op()
1423 return push_inst(compiler, SUB | RD(OTHER_FLAG) | RS1(dst) | RS2(OTHER_FLAG)); in emit_single_op()
1427 FAIL_IF(push_inst(compiler, MULH | RD(EQUAL_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1428 FAIL_IF(push_inst(compiler, MUL | RD(dst) | RS1(src1) | RS2(src2))); in emit_single_op()
1430 FAIL_IF(push_inst(compiler, SRAI | RD(OTHER_FLAG) | RS1(dst) | IMM_I(31))); in emit_single_op()
1432 FAIL_IF(push_inst(compiler, SRAI | RD(OTHER_FLAG) | RS1(dst) | IMM_I(63))); in emit_single_op()
1434 return push_inst(compiler, SUB | RD(OTHER_FLAG) | RS1(EQUAL_FLAG) | RS2(OTHER_FLAG)); in emit_single_op()
1469 FAIL_IF(push_inst(compiler, op_imm | WORD | RD(OTHER_FLAG) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1477 FAIL_IF(push_inst(compiler, op_imm | WORD | RD(dst) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1478 return push_inst(compiler, OR | RD(dst) | RS1(dst) | RS2(OTHER_FLAG)); in emit_single_op()
1483 return push_inst(compiler, ADDI | WORD | RD(dst) | RS1(src1) | IMM_I(0)); in emit_single_op()
1487 FAIL_IF(push_inst(compiler, SUB | WORD | RD(EQUAL_FLAG) | RS1(TMP_ZERO) | RS2(src2))); in emit_single_op()
1489 FAIL_IF(push_inst(compiler, op_reg | WORD | RD(OTHER_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1491 FAIL_IF(push_inst(compiler, op_reg | WORD | RD(dst) | RS1(src1) | RS2(EQUAL_FLAG))); in emit_single_op()
1492 return push_inst(compiler, OR | RD(dst) | RS1(dst) | RS2(OTHER_FLAG)); in emit_single_op()
1501 FAIL_IF(push_inst(compiler, op_imm | WORD | RD(EQUAL_FLAG) | RS1(src1) | IMM_I(src2))); in emit_single_op()
1505 return push_inst(compiler, op_imm | WORD | RD(dst) | RS1(src1) | IMM_I(src2)); in emit_single_op()
1509 FAIL_IF(push_inst(compiler, op_reg | WORD | RD(EQUAL_FLAG) | RS1(src1) | RS2(src2))); in emit_single_op()
1513 return push_inst(compiler, op_reg | WORD | RD(dst) | RS1(src1) | RS2(src2)); in emit_single_op()
1518 static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags, in emit_op() argument
1533 compiler->cache_arg = 0; in emit_op()
1534 compiler->cache_argw = 0; in emit_op()
1547 else if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, flags | ARG_TEST, TMP_REG1, dst, dstw)) in emit_op()
1574 FAIL_IF(load_immediate(compiler, TMP_REG1, src1w, TMP_REG3)); in emit_op()
1581 if (getput_arg_fast(compiler, flags | LOAD_DATA, TMP_REG1, src1, src1w)) in emit_op()
1582 FAIL_IF(compiler->error); in emit_op()
1598 FAIL_IF(load_immediate(compiler, sugg_src2_r, src2w, TMP_REG3)); in emit_op()
1613 if (getput_arg_fast(compiler, flags | LOAD_DATA, sugg_src2_r, src2, src2w)) in emit_op()
1614 FAIL_IF(compiler->error); in emit_op()
1623 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, TMP_REG2, src2, src2w, src1, src1w)); in emit_op()
1624 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, TMP_REG1, src1, src1w, dst, dstw)); in emit_op()
1627 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, TMP_REG1, src1, src1w, src2, src2w)); in emit_op()
1628 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, TMP_REG2, src2, src2w, dst, dstw)); in emit_op()
1632 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, TMP_REG1, src1, src1w, dst, dstw)); in emit_op()
1634 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, sugg_src2_r, src2, src2w, dst, dstw)); in emit_op()
1636 FAIL_IF(emit_single_op(compiler, op, flags, dst_r, src1_r, src2_r)); in emit_op()
1640 getput_arg_fast(compiler, flags, dst_r, dst, dstw); in emit_op()
1641 return compiler->error; in emit_op()
1643 return getput_arg(compiler, flags, dst_r, dst, dstw, 0, 0); in emit_op()
1649 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op) in sljit_emit_op0() argument
1658 CHECK(check_sljit_emit_op0(compiler, op)); in sljit_emit_op0()
1662 return push_inst(compiler, EBREAK); in sljit_emit_op0()
1664 return push_inst(compiler, ADDI | RD(TMP_ZERO) | RS1(TMP_ZERO) | IMM_I(0)); in sljit_emit_op0()
1666 FAIL_IF(push_inst(compiler, ADDI | RD(TMP_REG1) | RS1(SLJIT_R1) | IMM_I(0))); in sljit_emit_op0()
1667 FAIL_IF(push_inst(compiler, MULHU | RD(SLJIT_R1) | RS1(SLJIT_R0) | RS2(SLJIT_R1))); in sljit_emit_op0()
1668 return push_inst(compiler, MUL | RD(SLJIT_R0) | RS1(SLJIT_R0) | RS2(TMP_REG1)); in sljit_emit_op0()
1670 FAIL_IF(push_inst(compiler, ADDI | RD(TMP_REG1) | RS1(SLJIT_R1) | IMM_I(0))); in sljit_emit_op0()
1671 FAIL_IF(push_inst(compiler, MULH | RD(SLJIT_R1) | RS1(SLJIT_R0) | RS2(SLJIT_R1))); in sljit_emit_op0()
1672 return push_inst(compiler, MUL | RD(SLJIT_R0) | RS1(SLJIT_R0) | RS2(TMP_REG1)); in sljit_emit_op0()
1674 FAIL_IF(push_inst(compiler, ADDI | RD(TMP_REG1) | RS1(SLJIT_R0) | IMM_I(0))); in sljit_emit_op0()
1675 FAIL_IF(push_inst(compiler, DIVU | WORD | RD(SLJIT_R0) | RS1(SLJIT_R0) | RS2(SLJIT_R1))); in sljit_emit_op0()
1676 return push_inst(compiler, REMU | WORD | RD(SLJIT_R1) | RS1(TMP_REG1) | RS2(SLJIT_R1)); in sljit_emit_op0()
1678 FAIL_IF(push_inst(compiler, ADDI | RD(TMP_REG1) | RS1(SLJIT_R0) | IMM_I(0))); in sljit_emit_op0()
1679 FAIL_IF(push_inst(compiler, DIV | WORD | RD(SLJIT_R0) | RS1(SLJIT_R0) | RS2(SLJIT_R1))); in sljit_emit_op0()
1680 return push_inst(compiler, REM | WORD | RD(SLJIT_R1) | RS1(TMP_REG1) | RS2(SLJIT_R1)); in sljit_emit_op0()
1682 return push_inst(compiler, DIVU | WORD | RD(SLJIT_R0) | RS1(SLJIT_R0) | RS2(SLJIT_R1)); in sljit_emit_op0()
1684 return push_inst(compiler, DIV | WORD | RD(SLJIT_R0) | RS1(SLJIT_R0) | RS2(SLJIT_R1)); in sljit_emit_op0()
1693 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op1() argument
1700 CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw)); in sljit_emit_op1()
1717 return emit_op(compiler, SLJIT_MOV, WORD_DATA | MOVE_OP, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1721 …return emit_op(compiler, SLJIT_MOV_U32, INT_DATA | MOVE_OP, dst, dstw, TMP_REG1, 0, src, (src & SL… in sljit_emit_op1()
1726 …return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA | MOVE_OP, dst, dstw, TMP_REG1, 0, … in sljit_emit_op1()
1730 …return emit_op(compiler, op, BYTE_DATA | MOVE_OP, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ?… in sljit_emit_op1()
1733 …return emit_op(compiler, op, BYTE_DATA | SIGNED_DATA | MOVE_OP, dst, dstw, TMP_REG1, 0, src, (src … in sljit_emit_op1()
1736 …return emit_op(compiler, op, HALF_DATA | MOVE_OP, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ?… in sljit_emit_op1()
1739 …return emit_op(compiler, op, HALF_DATA | SIGNED_DATA | MOVE_OP, dst, dstw, TMP_REG1, 0, src, (src … in sljit_emit_op1()
1742 …return emit_op(compiler, SLJIT_XOR | (op & (SLJIT_32 | SLJIT_SET_Z)), flags, dst, dstw, src, srcw,… in sljit_emit_op1()
1746 return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1753 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2() argument
1761 CHECK(check_sljit_emit_op2(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_op2()
1779 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD; in sljit_emit_op2()
1780 return emit_op(compiler, op, flags | CUMULATIVE_OP | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1784 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_SUB; in sljit_emit_op2()
1785 return emit_op(compiler, op, flags | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1788 compiler->status_flags_state = 0; in sljit_emit_op2()
1789 return emit_op(compiler, op, flags | CUMULATIVE_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1794 return emit_op(compiler, op, flags | CUMULATIVE_OP | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1815 return emit_op(compiler, op, flags | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1822 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2u(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2u() argument
1827 CHECK(check_sljit_emit_op2(compiler, op, 1, 0, 0, src1, src1w, src2, src2w)); in sljit_emit_op2u()
1829 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_op2u()
1830 return sljit_emit_op2(compiler, op, TMP_REG2, 0, src1, src1w, src2, src2w); in sljit_emit_op2u()
1833 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_shift_into(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_shift_into() argument
1852 CHECK(check_sljit_emit_shift_into(compiler, op, src_dst, src1, src1w, src2, src2w)); in sljit_emit_shift_into()
1857 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_shift_into()
1858 …return sljit_emit_op2(compiler, (is_left ? SLJIT_ROTL : SLJIT_ROTR) | (op & SLJIT_32), src_dst, 0,… in sljit_emit_shift_into()
1870 FAIL_IF(emit_op_mem(compiler, inp_flags, TMP_REG2, src2, src2w)); in sljit_emit_shift_into()
1875 FAIL_IF(emit_op_mem(compiler, inp_flags, TMP_REG1, src1, src1w)); in sljit_emit_shift_into()
1878 FAIL_IF(load_immediate(compiler, TMP_REG1, src1w, TMP_REG3)); in sljit_emit_shift_into()
1893 FAIL_IF(push_inst(compiler, ins1 | RD(src_dst) | RS1(src_dst))); in sljit_emit_shift_into()
1894 FAIL_IF(push_inst(compiler, ins2 | RD(TMP_REG1) | RS1(src1))); in sljit_emit_shift_into()
1895 return push_inst(compiler, OR | RD(src_dst) | RS1(src_dst) | RS2(TMP_REG1)); in sljit_emit_shift_into()
1908 FAIL_IF(push_inst(compiler, ins1 | WORD | RD(src_dst) | RS1(src_dst) | RS2(src2))); in sljit_emit_shift_into()
1911 FAIL_IF(push_inst(compiler, ins2 | WORD | RD(TMP_REG1) | RS1(src1) | IMM_I(1))); in sljit_emit_shift_into()
1912 FAIL_IF(push_inst(compiler, XORI | RD(TMP_REG2) | RS1(src2) | IMM_I((sljit_ins)bit_length - 1))); in sljit_emit_shift_into()
1915 FAIL_IF(push_inst(compiler, SUB | WORD | RD(TMP_REG2) | RS1(TMP_ZERO) | RS2(src2))); in sljit_emit_shift_into()
1917 FAIL_IF(push_inst(compiler, ins3 | WORD | RD(TMP_REG1) | RS1(src1) | RS2(TMP_REG2))); in sljit_emit_shift_into()
1918 return push_inst(compiler, OR | RD(src_dst) | RS1(src_dst) | RS2(TMP_REG1)); in sljit_emit_shift_into()
1923 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op_src() argument
1927 CHECK(check_sljit_emit_op_src(compiler, op, src, srcw)); in sljit_emit_op_src()
1933 FAIL_IF(push_inst(compiler, ADDI | RD(RETURN_ADDR_REG) | RS1(src) | IMM_I(0))); in sljit_emit_op_src()
1935 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, RETURN_ADDR_REG, src, srcw)); in sljit_emit_op_src()
1937 return push_inst(compiler, JALR | RD(TMP_ZERO) | RS1(RETURN_ADDR_REG) | IMM_I(0)); in sljit_emit_op_src()
1962 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler, in sljit_emit_op_custom() argument
1966 CHECK(check_sljit_emit_op_custom(compiler, instruction, size)); in sljit_emit_op_custom()
1968 return push_inst(compiler, *(sljit_ins*)instruction); in sljit_emit_op_custom()
1978 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
1990 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()
1994 FAIL_IF(push_inst(compiler, FCVT_W_S | FMT(op) | flags | RD(dst_r) | FRS1(src))); in sljit_emit_fop1_conv_sw_from_f64()
1999 return emit_op_mem2(compiler, WORD_DATA, TMP_REG2, dst, dstw, 0, 0); in sljit_emit_fop1_conv_sw_from_f64()
2001 return emit_op_mem2(compiler, flags ? WORD_DATA : INT_DATA, TMP_REG2, dst, dstw, 0, 0); in sljit_emit_fop1_conv_sw_from_f64()
2011 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
2024 FAIL_IF(emit_op_mem2(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw, dst, dstw)); in sljit_emit_fop1_conv_f64_from_sw()
2026 …FAIL_IF(emit_op_mem2(compiler, (flags ? WORD_DATA : INT_DATA) | LOAD_DATA, TMP_REG1, src, srcw, ds… in sljit_emit_fop1_conv_f64_from_sw()
2035 FAIL_IF(load_immediate(compiler, TMP_REG1, srcw, TMP_REG3)); in sljit_emit_fop1_conv_f64_from_sw()
2051 FAIL_IF(push_inst(compiler, inst)); in sljit_emit_fop1_conv_f64_from_sw()
2054 return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0); in sljit_emit_fop1_conv_f64_from_sw()
2058 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1_cmp() argument
2065 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w)); in sljit_emit_fop1_cmp()
2070 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, 0, 0)); in sljit_emit_fop1_cmp()
2103 FAIL_IF(push_inst(compiler, FLT_S | FMT(op) | RD(OTHER_FLAG) | FRS1(src1) | FRS2(src2))); in sljit_emit_fop1_cmp()
2104 FAIL_IF(push_inst(compiler, FLT_S | FMT(op) | RD(TMP_REG1) | FRS1(src2) | FRS2(src1))); in sljit_emit_fop1_cmp()
2108 FAIL_IF(push_inst(compiler, FADD_S | FMT(op) | FRD(TMP_FREG1) | FRS1(src1) | FRS2(src2))); in sljit_emit_fop1_cmp()
2113 return push_inst(compiler, inst); in sljit_emit_fop1_cmp()
2116 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1() argument
2123 compiler->cache_arg = 0; in sljit_emit_fop1()
2124 compiler->cache_argw = 0; in sljit_emit_fop1()
2127 SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw); in sljit_emit_fop1()
2135 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, dst_r, src, srcw, dst, dstw)); in sljit_emit_fop1()
2143 FAIL_IF(push_inst(compiler, FSGNJ_S | FMT(op) | FRD(dst_r) | FRS1(src) | FRS2(src))); in sljit_emit_fop1()
2149 FAIL_IF(push_inst(compiler, FSGNJN_S | FMT(op) | FRD(dst_r) | FRS1(src) | FRS2(src))); in sljit_emit_fop1()
2152 FAIL_IF(push_inst(compiler, FSGNJX_S | FMT(op) | FRD(dst_r) | FRS1(src) | FRS2(src))); in sljit_emit_fop1()
2156 …FAIL_IF(push_inst(compiler, FCVT_S_D | ((op & SLJIT_32) ? (1 << 25) : ((1 << 20) | F3(7))) | FRD(d… in sljit_emit_fop1()
2162 return emit_op_mem2(compiler, FLOAT_DATA(op), dst_r, dst, dstw, 0, 0); in sljit_emit_fop1()
2166 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop2() argument
2174 CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_fop2()
2179 compiler->cache_arg = 0; in sljit_emit_fop2()
2180 compiler->cache_argw = 0; in sljit_emit_fop2()
2185 if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w)) { in sljit_emit_fop2()
2186 FAIL_IF(compiler->error); in sljit_emit_fop2()
2193 if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w)) { in sljit_emit_fop2()
2194 FAIL_IF(compiler->error); in sljit_emit_fop2()
2202 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, src1, src1w)); in sljit_emit_fop2()
2203 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, dst, dstw)); in sljit_emit_fop2()
2206 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w)); in sljit_emit_fop2()
2207 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, dst, dstw)); in sljit_emit_fop2()
2211 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, dst, dstw)); in sljit_emit_fop2()
2213 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, dst, dstw)); in sljit_emit_fop2()
2222 FAIL_IF(push_inst(compiler, FADD_S | FMT(op) | FRD(dst_r) | FRS1(src1) | FRS2(src2))); in sljit_emit_fop2()
2226 FAIL_IF(push_inst(compiler, FSUB_S | FMT(op) | FRD(dst_r) | FRS1(src1) | FRS2(src2))); in sljit_emit_fop2()
2230 FAIL_IF(push_inst(compiler, FMUL_S | FMT(op) | FRD(dst_r) | FRS1(src1) | FRS2(src2))); in sljit_emit_fop2()
2234 FAIL_IF(push_inst(compiler, FDIV_S | FMT(op) | FRD(dst_r) | FRS1(src1) | FRS2(src2))); in sljit_emit_fop2()
2239 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG2, dst, dstw, 0, 0)); in sljit_emit_fop2()
2251 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_fast_enter() argument
2254 CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw)); in sljit_emit_fast_enter()
2258 return push_inst(compiler, ADDI | RD(dst) | RS1(RETURN_ADDR_REG) | IMM_I(0)); in sljit_emit_fast_enter()
2261 return emit_op_mem(compiler, WORD_DATA, RETURN_ADDR_REG, dst, dstw); in sljit_emit_fast_enter()
2268 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler) in sljit_emit_label() argument
2273 CHECK_PTR(check_sljit_emit_label(compiler)); in sljit_emit_label()
2275 if (compiler->last_label && compiler->last_label->size == compiler->size) in sljit_emit_label()
2276 return compiler->last_label; in sljit_emit_label()
2278 label = (struct sljit_label*)ensure_abuf(compiler, sizeof(struct sljit_label)); in sljit_emit_label()
2280 set_label(label, compiler); in sljit_emit_label()
2290 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_… in sljit_emit_jump() argument
2296 CHECK_PTR(check_sljit_emit_jump(compiler, type)); in sljit_emit_jump()
2298 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
2300 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
2353 PTR_FAIL_IF(push_inst(compiler, inst)); in sljit_emit_jump()
2357 jump->addr = compiler->size; in sljit_emit_jump()
2365 PTR_FAIL_IF(push_inst(compiler, inst)); in sljit_emit_jump()
2369 compiler->size += 1; in sljit_emit_jump()
2371 compiler->size += 5; in sljit_emit_jump()
2376 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_… in sljit_emit_call() argument
2381 CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types)); in sljit_emit_call()
2384 PTR_FAIL_IF(emit_stack_frame_release(compiler, 0)); in sljit_emit_call()
2388 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_call()
2389 return sljit_emit_jump(compiler, type); in sljit_emit_call()
2392 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s… in sljit_emit_cmp() argument
2401 CHECK_PTR(check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w)); in sljit_emit_cmp()
2405 compiler->cache_arg = 0; in sljit_emit_cmp()
2406 compiler->cache_argw = 0; in sljit_emit_cmp()
2414 PTR_FAIL_IF(emit_op_mem2(compiler, flags, TMP_REG1, src1, src1w, src2, src2w)); in sljit_emit_cmp()
2419 PTR_FAIL_IF(emit_op_mem2(compiler, flags, TMP_REG2, src2, src2w, 0, 0)); in sljit_emit_cmp()
2425 PTR_FAIL_IF(load_immediate(compiler, TMP_REG1, src1w, TMP_REG3)); in sljit_emit_cmp()
2434 PTR_FAIL_IF(load_immediate(compiler, TMP_REG2, src2w, TMP_REG3)); in sljit_emit_cmp()
2441 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_cmp()
2443 set_jump(jump, compiler, (sljit_u32)((type & SLJIT_REWRITABLE_JUMP) | IS_COND)); in sljit_emit_cmp()
2479 PTR_FAIL_IF(push_inst(compiler, inst)); in sljit_emit_cmp()
2481 jump->addr = compiler->size; in sljit_emit_cmp()
2482 PTR_FAIL_IF(push_inst(compiler, JALR | RD(TMP_ZERO) | RS1(TMP_REG1) | IMM_I(0))); in sljit_emit_cmp()
2486 compiler->size += 1; in sljit_emit_cmp()
2488 compiler->size += 5; in sljit_emit_cmp()
2495 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type… in sljit_emit_ijump() argument
2500 CHECK(check_sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_ijump()
2505 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw)); in sljit_emit_ijump()
2508 …return push_inst(compiler, JALR | RD((type >= SLJIT_FAST_CALL) ? RETURN_ADDR_REG : TMP_ZERO) | RS1… in sljit_emit_ijump()
2512 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
2514 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_CALL : 0)); in sljit_emit_ijump()
2517 jump->addr = compiler->size; in sljit_emit_ijump()
2518 …FAIL_IF(push_inst(compiler, JALR | RD((type >= SLJIT_FAST_CALL) ? RETURN_ADDR_REG : TMP_ZERO) | RS… in sljit_emit_ijump()
2522 compiler->size += 1; in sljit_emit_ijump()
2524 compiler->size += 5; in sljit_emit_ijump()
2529 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_icall() argument
2535 CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw)); in sljit_emit_icall()
2539 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw)); in sljit_emit_icall()
2544 …if (src >= SLJIT_FIRST_SAVED_REG && src <= (SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->options))… in sljit_emit_icall()
2545 FAIL_IF(push_inst(compiler, ADDI | RD(TMP_REG1) | RS1(src) | IMM_I(0))); in sljit_emit_icall()
2549 FAIL_IF(emit_stack_frame_release(compiler, 0)); in sljit_emit_icall()
2553 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_icall()
2554 return sljit_emit_ijump(compiler, type, src, srcw); in sljit_emit_icall()
2557 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 o… in sljit_emit_op_flags() argument
2570 CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type)); in sljit_emit_op_flags()
2576 compiler->cache_arg = 0; in sljit_emit_op_flags()
2577 compiler->cache_argw = 0; in sljit_emit_op_flags()
2580 FAIL_IF(emit_op_mem2(compiler, mem_type | LOAD_DATA, TMP_REG1, dst, dstw, dst, dstw)); in sljit_emit_op_flags()
2589 FAIL_IF(push_inst(compiler, SLTUI | RD(dst_r) | RS1(EQUAL_FLAG) | IMM_I(1))); in sljit_emit_op_flags()
2594 if (compiler->status_flags_state & (SLJIT_CURRENT_FLAGS_ADD | SLJIT_CURRENT_FLAGS_SUB)) { in sljit_emit_op_flags()
2598 FAIL_IF(push_inst(compiler, SLTUI | RD(dst_r) | RS1(OTHER_FLAG) | IMM_I(1))); in sljit_emit_op_flags()
2624 FAIL_IF(push_inst(compiler, XORI | RD(dst_r) | RS1(src_r) | IMM_I(1))); in sljit_emit_op_flags()
2630 return emit_op_mem(compiler, mem_type, src_r, dst, dstw); in sljit_emit_op_flags()
2633 return push_inst(compiler, ADDI | RD(dst_r) | RS1(src_r) | IMM_I(0)); in sljit_emit_op_flags()
2640 return emit_op(compiler, saved_op, mem_type, dst, dstw, TMP_REG1, 0, src_r, 0); in sljit_emit_op_flags()
2641 return emit_op(compiler, saved_op, mem_type, dst, dstw, dst, dstw, src_r, 0); in sljit_emit_op_flags()
2644 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_cmov() argument
2649 CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw)); in sljit_emit_cmov()
2651 return sljit_emit_cmov_generic(compiler, type, dst_reg, src, srcw);; in sljit_emit_cmov()
2654 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_mem() argument
2661 CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw)); in sljit_emit_mem()
2664 return sljit_emit_mem_unaligned(compiler, type, reg, mem, memw); in sljit_emit_mem()
2670 FAIL_IF(push_inst(compiler, SLLI | RD(TMP_REG1) | RS1(OFFS_REG(mem)) | IMM_I(memw))); in sljit_emit_mem()
2671 FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG1) | RS1(TMP_REG1) | RS2(mem & REG_MASK))); in sljit_emit_mem()
2673 FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG1) | RS1(mem & REG_MASK) | RS2(OFFS_REG(mem)))); in sljit_emit_mem()
2679 FAIL_IF(load_immediate(compiler, TMP_REG1, TO_ARGW_HI(memw), TMP_REG3)); in sljit_emit_mem()
2682 FAIL_IF(load_immediate(compiler, TMP_REG1, memw, TMP_REG3)); in sljit_emit_mem()
2687 FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG1) | RS1(TMP_REG1) | RS2(mem & REG_MASK))); in sljit_emit_mem()
2698 …FAIL_IF(push_mem_inst(compiler, WORD_DATA | LOAD_DATA, REG_PAIR_SECOND(reg), mem, (memw + SSIZE_OF… in sljit_emit_mem()
2699 return push_mem_inst(compiler, WORD_DATA | LOAD_DATA, REG_PAIR_FIRST(reg), mem, memw); in sljit_emit_mem()
2704 FAIL_IF(push_mem_inst(compiler, flags, REG_PAIR_FIRST(reg), mem, memw)); in sljit_emit_mem()
2705 return push_mem_inst(compiler, flags, REG_PAIR_SECOND(reg), mem, (memw + SSIZE_OF(sw)) & 0xfff); in sljit_emit_mem()
2710 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, slji… in sljit_emit_const() argument
2716 CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); in sljit_emit_const()
2719 const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const)); in sljit_emit_const()
2721 set_const(const_, compiler); in sljit_emit_const()
2724 PTR_FAIL_IF(emit_const(compiler, dst_r, init_value, ADDI | RD(dst_r))); in sljit_emit_const()
2727 PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw)); in sljit_emit_const()
2732 …UTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, s… in sljit_emit_put_label() argument
2738 CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); in sljit_emit_put_label()
2741 put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); in sljit_emit_put_label()
2743 set_put_label(put_label, compiler, 0); in sljit_emit_put_label()
2746 PTR_FAIL_IF(push_inst(compiler, (sljit_ins)dst_r)); in sljit_emit_put_label()
2748 compiler->size += 1; in sljit_emit_put_label()
2750 compiler->size += 5; in sljit_emit_put_label()
2754 PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw)); in sljit_emit_put_label()