29 return "LOONGARCH" SLJIT_CPUINFO;
34#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
35#define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3)
36#define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4)
40#define EQUAL_FLAG (SLJIT_NUMBER_OF_REGISTERS + 5)
41#define RETURN_ADDR_REG TMP_REG2
42#define OTHER_FLAG (SLJIT_NUMBER_OF_REGISTERS + 6)
44#define TMP_FREG1 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
45#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2)
47static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 7] = {
48 0, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 20, 22, 31, 30, 29, 28, 27, 26, 25, 24, 23, 3, 13, 1, 14, 12, 15
51static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = {
52 0, 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 31, 30, 29, 28, 27, 26, 25, 24, 8, 9
77#define RD(rd) ((sljit_ins)reg_map[rd])
78#define RJ(rj) ((sljit_ins)reg_map[rj] << 5)
79#define RK(rk) ((sljit_ins)reg_map[rk] << 10)
80#define RA(ra) ((sljit_ins)reg_map[ra] << 15)
82#define FD(fd) ((sljit_ins)reg_map[fd])
83#define FRD(fd) ((sljit_ins)freg_map[fd])
84#define FRJ(fj) ((sljit_ins)freg_map[fj] << 5)
85#define FRK(fk) ((sljit_ins)freg_map[fk] << 10)
86#define FRA(fa) ((sljit_ins)freg_map[fa] << 15)
88#define IMM_V(imm) ((sljit_ins)(imm) << 10)
89#define IMM_I8(imm) (((sljit_ins)(imm)&0xff) << 10)
90#define IMM_I12(imm) (((sljit_ins)(imm)&0xfff) << 10)
91#define IMM_I14(imm) (((sljit_ins)(imm)&0xfff3) << 10)
92#define IMM_I16(imm) (((sljit_ins)(imm)&0xffff) << 10)
93#define IMM_I20(imm) (((sljit_ins)(imm)&0xffffffff) >> 12 << 5)
94#define IMM_I21(imm) ((((sljit_ins)(imm)&0xffff) << 10) | (((sljit_ins)(imm) >> 16) & 0x1f))
95#define IMM_I26(imm) ((((sljit_ins)(imm)&0xffff) << 10) | (((sljit_ins)(imm) >> 16) & 0x3ff))
97#define OPC_I26(opc) ((sljit_ins)(opc) << 26)
98#define OPC_1RI21(opc) ((sljit_ins)(opc) << 26)
99#define OPC_2RI16(opc) ((sljit_ins)(opc) << 26)
100#define OPC_2RI14(opc) ((sljit_ins)(opc) << 24)
101#define OPC_2RI12(opc) ((sljit_ins)(opc) << 22)
102#define OPC_2RI8(opc) ((sljit_ins)(opc) << 18)
103#define OPC_4R(opc) ((sljit_ins)(opc) << 20)
104#define OPC_3R(opc) ((sljit_ins)(opc) << 15)
105#define OPC_2R(opc) ((sljit_ins)(opc) << 10)
106#define OPC_1RI20(opc) ((sljit_ins)(opc) << 25)
109#define ADD_W OPC_3R(0x20)
110#define ADD_D OPC_3R(0x21)
111#define SUB_W OPC_3R(0x22)
112#define SUB_D OPC_3R(0x23)
113#define ADDI_W OPC_2RI12(0xa)
114#define ADDI_D OPC_2RI12(0xb)
115#define ANDI OPC_2RI12(0xd)
116#define ORI OPC_2RI12(0xe)
117#define XORI OPC_2RI12(0xf)
118#define ADDU16I_D OPC_2RI16(0x4)
119#define LU12I_W OPC_1RI20(0xa)
120#define LU32I_D OPC_1RI20(0xb)
121#define LU52I_D OPC_2RI12(0xc)
122#define SLT OPC_3R(0x24)
123#define SLTU OPC_3R(0x25)
124#define SLTI OPC_2RI12(0x8)
125#define SLTUI OPC_2RI12(0x9)
126#define PCADDI OPC_1RI20(0xc)
127#define PCALAU12I OPC_1RI20(0xd)
128#define PCADDU12I OPC_1RI20(0xe)
129#define PCADDU18I OPC_1RI20(0xf)
130#define NOR OPC_3R(0x28)
131#define AND OPC_3R(0x29)
132#define OR OPC_3R(0x2a)
133#define XOR OPC_3R(0x2b)
134#define ORN OPC_3R(0x2c)
135#define ANDN OPC_3R(0x2d)
136#define MUL_W OPC_3R(0x38)
137#define MULH_W OPC_3R(0x39)
138#define MULH_WU OPC_3R(0x3a)
139#define MUL_D OPC_3R(0x3b)
140#define MULH_D OPC_3R(0x3c)
141#define MULH_DU OPC_3R(0x3d)
142#define MULW_D_W OPC_3R(0x3e)
143#define MULW_D_WU OPC_3R(0x3f)
144#define DIV_W OPC_3R(0x40)
145#define MOD_W OPC_3R(0x41)
146#define DIV_WU OPC_3R(0x42)
147#define MOD_WU OPC_3R(0x43)
148#define DIV_D OPC_3R(0x44)
149#define MOD_D OPC_3R(0x45)
150#define DIV_DU OPC_3R(0x46)
151#define MOD_DU OPC_3R(0x47)
154#define SLL_W OPC_3R(0x2e)
155#define SRL_W OPC_3R(0x2f)
156#define SRA_W OPC_3R(0x30)
157#define SLL_D OPC_3R(0x31)
158#define SRL_D OPC_3R(0x32)
159#define SRA_D OPC_3R(0x33)
160#define ROTR_W OPC_3R(0x36)
161#define ROTR_D OPC_3R(0x37)
162#define SLLI_W OPC_3R(0x81)
163#define SLLI_D ((sljit_ins)(0x41) << 16)
164#define SRLI_W OPC_3R(0x89)
165#define SRLI_D ((sljit_ins)(0x45) << 16)
166#define SRAI_W OPC_3R(0x91)
167#define SRAI_D ((sljit_ins)(0x49) << 16)
168#define ROTRI_W OPC_3R(0x99)
169#define ROTRI_D ((sljit_ins)(0x4d) << 16)
172#define CLO_W OPC_2R(0x4)
173#define CLZ_W OPC_2R(0x5)
174#define CTO_W OPC_2R(0x6)
175#define CTZ_W OPC_2R(0x7)
176#define CLO_D OPC_2R(0x8)
177#define CLZ_D OPC_2R(0x9)
178#define CTO_D OPC_2R(0xa)
179#define CTZ_D OPC_2R(0xb)
180#define REVB_2H OPC_2R(0xc)
181#define REVB_4H OPC_2R(0xd)
182#define REVB_2W OPC_2R(0xe)
183#define REVB_D OPC_2R(0xf)
184#define REVH_2W OPC_2R(0x10)
185#define REVH_D OPC_2R(0x11)
186#define BITREV_4B OPC_2R(0x12)
187#define BITREV_8B OPC_2R(0x13)
188#define BITREV_W OPC_2R(0x14)
189#define BITREV_D OPC_2R(0x15)
190#define EXT_W_H OPC_2R(0x16)
191#define EXT_W_B OPC_2R(0x17)
192#define BSTRINS_W (0x1 << 22 | 1 << 21)
193#define BSTRPICK_W (0x1 << 22 | 1 << 21 | 1 << 15)
194#define BSTRINS_D (0x2 << 22)
195#define BSTRPICK_D (0x3 << 22)
198#define BEQZ OPC_1RI21(0x10)
199#define BNEZ OPC_1RI21(0x11)
200#define JIRL OPC_2RI16(0x13)
201#define B OPC_I26(0x14)
202#define BL OPC_I26(0x15)
203#define BEQ OPC_2RI16(0x16)
204#define BNE OPC_2RI16(0x17)
205#define BLT OPC_2RI16(0x18)
206#define BGE OPC_2RI16(0x19)
207#define BLTU OPC_2RI16(0x1a)
208#define BGEU OPC_2RI16(0x1b)
211#define LD_B OPC_2RI12(0xa0)
212#define LD_H OPC_2RI12(0xa1)
213#define LD_W OPC_2RI12(0xa2)
214#define LD_D OPC_2RI12(0xa3)
216#define ST_B OPC_2RI12(0xa4)
217#define ST_H OPC_2RI12(0xa5)
218#define ST_W OPC_2RI12(0xa6)
219#define ST_D OPC_2RI12(0xa7)
221#define LD_BU OPC_2RI12(0xa8)
222#define LD_HU OPC_2RI12(0xa9)
223#define LD_WU OPC_2RI12(0xaa)
225#define LDX_B OPC_3R(0x7000)
226#define LDX_H OPC_3R(0x7008)
227#define LDX_W OPC_3R(0x7010)
228#define LDX_D OPC_3R(0x7018)
230#define STX_B OPC_3R(0x7020)
231#define STX_H OPC_3R(0x7028)
232#define STX_W OPC_3R(0x7030)
233#define STX_D OPC_3R(0x7038)
235#define LDX_BU OPC_3R(0x7040)
236#define LDX_HU OPC_3R(0x7048)
237#define LDX_WU OPC_3R(0x7050)
239#define PRELD OPC_2RI12(0xab)
242#define LL_W OPC_2RI14(0x20)
243#define SC_W OPC_2RI14(0x21)
244#define LL_D OPC_2RI14(0x22)
245#define SC_D OPC_2RI14(0x23)
248#define AMCAS_B OPC_3R(0x70B0)
249#define AMCAS_H OPC_3R(0x70B1)
250#define AMCAS_W OPC_3R(0x70B2)
251#define AMCAS_D OPC_3R(0x70B3)
254#define BREAK OPC_3R(0x54)
255#define DBGCALL OPC_3R(0x55)
256#define SYSCALL OPC_3R(0x56)
260#define FADD_S OPC_3R(0x201)
261#define FADD_D OPC_3R(0x202)
262#define FSUB_S OPC_3R(0x205)
263#define FSUB_D OPC_3R(0x206)
264#define FMUL_S OPC_3R(0x209)
265#define FMUL_D OPC_3R(0x20a)
266#define FDIV_S OPC_3R(0x20d)
267#define FDIV_D OPC_3R(0x20e)
268#define FCMP_COND_S OPC_4R(0xc1)
269#define FCMP_COND_D OPC_4R(0xc2)
270#define FCOPYSIGN_S OPC_3R(0x225)
271#define FCOPYSIGN_D OPC_3R(0x226)
272#define FSEL OPC_4R(0xd0)
273#define FABS_S OPC_2R(0x4501)
274#define FABS_D OPC_2R(0x4502)
275#define FNEG_S OPC_2R(0x4505)
276#define FNEG_D OPC_2R(0x4506)
277#define FMOV_S OPC_2R(0x4525)
278#define FMOV_D OPC_2R(0x4526)
281#define FCVT_S_D OPC_2R(0x4646)
282#define FCVT_D_S OPC_2R(0x4649)
283#define FTINTRZ_W_S OPC_2R(0x46a1)
284#define FTINTRZ_W_D OPC_2R(0x46a2)
285#define FTINTRZ_L_S OPC_2R(0x46a9)
286#define FTINTRZ_L_D OPC_2R(0x46aa)
287#define FFINT_S_W OPC_2R(0x4744)
288#define FFINT_S_L OPC_2R(0x4746)
289#define FFINT_D_W OPC_2R(0x4748)
290#define FFINT_D_L OPC_2R(0x474a)
293#define FMOV_S OPC_2R(0x4525)
294#define FMOV_D OPC_2R(0x4526)
295#define MOVGR2FR_W OPC_2R(0x4529)
296#define MOVGR2FR_D OPC_2R(0x452a)
297#define MOVGR2FRH_W OPC_2R(0x452b)
298#define MOVFR2GR_S OPC_2R(0x452d)
299#define MOVFR2GR_D OPC_2R(0x452e)
300#define MOVFRH2GR_S OPC_2R(0x452f)
301#define MOVGR2FCSR OPC_2R(0x4530)
302#define MOVFCSR2GR OPC_2R(0x4532)
303#define MOVFR2CF OPC_2R(0x4534)
304#define MOVCF2FR OPC_2R(0x4535)
305#define MOVGR2CF OPC_2R(0x4536)
306#define MOVCF2GR OPC_2R(0x4537)
309#define BCEQZ OPC_I26(0x12)
310#define BCNEZ OPC_I26(0x12)
313#define FLD_S OPC_2RI12(0xac)
314#define FLD_D OPC_2RI12(0xae)
315#define FST_S OPC_2RI12(0xad)
316#define FST_D OPC_2RI12(0xaf)
318#define FLDX_S OPC_3R(0x7060)
319#define FLDX_D OPC_3R(0x7068)
320#define FSTX_S OPC_3R(0x7070)
321#define FSTX_D OPC_3R(0x7078)
326#define VOR_V OPC_3R(0xe24d)
327#define VXOR_V OPC_3R(0xe24e)
328#define VAND_V OPC_3R(0xe24c)
329#define VMSKLTZ OPC_2R(0x1ca710)
332#define VLD OPC_2RI12(0xb0)
333#define VST OPC_2RI12(0xb1)
334#define XVLD OPC_2RI12(0xb2)
335#define XVST OPC_2RI12(0xb3)
336#define VSTELM OPC_2RI8(0xc40)
339#define VFCVTL_D_S OPC_2R(0x1ca77c)
342#define VSLLWIL OPC_2R(0x1cc200)
345#define VLDREPL OPC_2R(0xc0000)
346#define VINSGR2VR OPC_2R(0x1cbac0)
347#define VPICKVE2GR_U OPC_2R(0x1cbce0)
348#define VREPLGR2VR OPC_2R(0x1ca7c0)
349#define VREPLVE OPC_3R(0xe244)
350#define VREPLVEI OPC_2R(0x1cbde0)
351#define XVPERMI OPC_2RI8(0x1dfa)
353#define I12_MAX (0x7ff)
354#define I12_MIN (-0x800)
355#define BRANCH16_MAX (0x7fff << 2)
356#define BRANCH16_MIN (-(0x8000 << 2))
357#define BRANCH21_MAX (0xfffff << 2)
358#define BRANCH21_MIN (-(0x100000 << 2))
359#define JUMP_MAX (0x1ffffff << 2)
360#define JUMP_MIN (-(0x2000000 << 2))
361#define JIRL_MAX (0x7fff << 2)
362#define JIRL_MIN (-(0x8000 << 2))
364#define S32_MAX (0x7fffffffl)
365#define S32_MIN (-0x80000000l)
366#define S52_MAX (0x7ffffffffffffl)
368#define INST(inst, type) ((sljit_ins)((type & SLJIT_32) ? inst##_W : inst##_D))
371#define LOONGARCH_CFG2 0x02
372#define LOONGARCH_CFG2_LAMCAS (1 << 28)
380#define LOONGARCH_HWCAP_LSX (1 << 4)
381#define LOONGARCH_HWCAP_LASX (1 << 5)
391 if (cfg2_feature_list == 0)
392 __asm__ (
"cpucfg %0, %1" :
"+&r"(cfg2_feature_list) :
"r"(
LOONGARCH_CFG2));
393 if (hwcap_feature_list == 0)
394 hwcap_feature_list = (
sljit_u32)getauxval(AT_HWCAP);
396 return feature_type ? hwcap_feature_list : cfg2_feature_list;
419 if (jump->flags & JUMP_ADDR)
420 target_addr = jump->u.target;
423 target_addr = (
sljit_uw)(code + jump->u.label->size) + (
sljit_uw)executable_offset;
428 if (jump->flags & IS_COND) {
429 diff += SSIZE_OF(ins);
433 inst[0] = (inst[0] & 0xfc0003ff) ^ 0x4000000;
434 jump->flags |= PATCH_B;
439 diff -= SSIZE_OF(ins);
443 if (jump->flags & IS_COND) {
447 jump->flags |= PATCH_J;
452 if (jump->flags & IS_COND)
455 jump->flags |= PATCH_REL32;
461 if (jump->flags & IS_COND)
464 jump->flags |= PATCH_ABS32;
470 if (jump->flags & IS_COND)
473 jump->flags |= PATCH_ABS52;
479 if (jump->flags & IS_COND)
492 if (jump->flags & JUMP_ADDR)
493 addr = jump->u.target;
495 addr = (
sljit_uw)SLJIT_ADD_EXEC_OFFSET(code + jump->u.label->size, executable_offset);
501 jump->flags |= PATCH_REL32;
507 jump->flags |= PATCH_ABS32;
513 jump->flags |= PATCH_ABS52;
529 if (
flags & PATCH_REL32) {
530 addr -= (
sljit_uw)SLJIT_ADD_EXEC_OFFSET(ins, executable_offset);
534 if ((
addr & 0x800) != 0)
539 if (!(
flags & JUMP_MOV_ADDR)) {
547 if (
flags & PATCH_ABS32) {
550 }
else if (
flags & PATCH_ABS52) {
561 if (!(
flags & JUMP_MOV_ADDR)) {
573 SLJIT_NEXT_DEFINE_TYPES;
579 jump = compiler->
jumps;
580 const_ = compiler->
consts;
582 SLJIT_NEXT_INIT_TYPES();
585 SLJIT_GET_NEXT_MIN();
587 if (next_min_addr == SLJIT_MAX_ADDRESS)
590 if (next_min_addr == next_label_size) {
591 label->
size -= size_reduce;
594 next_label_size = SLJIT_GET_NEXT_SIZE(label);
597 if (next_min_addr == next_const_addr) {
598 const_->
addr -= size_reduce;
599 const_ = const_->
next;
600 next_const_addr = SLJIT_GET_NEXT_ADDRESS(const_);
604 if (next_min_addr != next_jump_addr)
607 jump->addr -= size_reduce;
608 if (!(jump->flags & JUMP_MOV_ADDR)) {
609 total_size = JUMP_MAX_SIZE;
612 if (jump->flags & JUMP_ADDR) {
615 else if (jump->u.target <=
S52_MAX)
621 if ((jump->flags & IS_COND) && (diff + 1) <= (
BRANCH16_MAX / SSIZE_OF(ins)) && (diff + 1) >= (
BRANCH16_MIN / SSIZE_OF(ins)))
623 else if (diff >= (
JUMP_MIN / SSIZE_OF(ins)) && diff <= (
JUMP_MAX / SSIZE_OF(ins)))
625 else if (diff >= (
S32_MIN / SSIZE_OF(ins)) && diff <= (
S32_MAX / SSIZE_OF(ins)))
630 size_reduce += JUMP_MAX_SIZE - total_size;
631 jump->flags |= total_size << JUMP_SIZE_SHIFT;
635 if (!(jump->flags & JUMP_ADDR)) {
639 if (diff >= (
S32_MIN / SSIZE_OF(ins)) && diff <= (
S32_MAX / SSIZE_OF(ins)))
641 }
else if (jump->u.target <
S32_MAX)
643 else if (jump->u.target <=
S52_MAX)
646 size_reduce += 3 - total_size;
647 jump->flags |= total_size << JUMP_SIZE_SHIFT;
651 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump);
654 compiler->
size -= size_reduce;
665 SLJIT_NEXT_DEFINE_TYPES;
674 CHECK_PTR(check_sljit_generate_code(compiler));
676 reduce_code_size(compiler);
681 reverse_buf(compiler);
687 jump = compiler->
jumps;
688 const_ = compiler->
consts;
689 SLJIT_NEXT_INIT_TYPES();
690 SLJIT_GET_NEXT_MIN();
694 buf_end = buf_ptr + (
buf->used_size >> 2);
696 *code_ptr = *buf_ptr++;
697 if (next_min_addr == word_count) {
703 if (next_min_addr == next_label_size) {
704 label->
u.
addr = (
sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
707 next_label_size = SLJIT_GET_NEXT_SIZE(label);
710 if (next_min_addr == next_jump_addr) {
711 if (!(jump->flags & JUMP_MOV_ADDR)) {
712 word_count = word_count - 1 + (jump->flags >> JUMP_SIZE_SHIFT);
714 code_ptr = detect_jump_type(jump, code, executable_offset);
717 word_count += jump->flags >> JUMP_SIZE_SHIFT;
719 code_ptr += mov_addr_get_length(jump, code_ptr, code, executable_offset);
723 next_jump_addr = SLJIT_GET_NEXT_ADDRESS(jump);
724 }
else if (next_min_addr == next_const_addr) {
726 const_ = const_->
next;
727 next_const_addr = SLJIT_GET_NEXT_ADDRESS(const_);
730 SLJIT_GET_NEXT_MIN();
734 }
while (buf_ptr < buf_end);
739 if (label && label->
size == word_count) {
750 jump = compiler->
jumps;
753 if (!(jump->flags & (PATCH_B | PATCH_J)) || (jump->flags & JUMP_MOV_ADDR)) {
754 load_addr_to_reg(jump, executable_offset);
758 addr = (jump->flags & JUMP_ADDR) ? jump->u.target : jump->u.label->u.addr;
760 addr -= (
sljit_uw)SLJIT_ADD_EXEC_OFFSET(buf_ptr, executable_offset);
762 if (jump->flags & PATCH_B) {
769 if (jump->flags & IS_CALL)
781 code = (
sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code, executable_offset);
782 code_ptr = (
sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
791 switch (feature_type)
794#ifdef SLJIT_IS_FPU_AVAILABLE
836#define LOAD_DATA 0x01
837#define WORD_DATA 0x00
838#define BYTE_DATA 0x02
839#define HALF_DATA 0x04
841#define SIGNED_DATA 0x08
844#define DOUBLE_DATA 0x10
845#define SINGLE_DATA 0x12
849#define ARG_TEST 0x00020
850#define ALT_KEEP_CACHE 0x00040
851#define CUMULATIVE_OP 0x00080
852#define IMM_OP 0x00100
853#define MOVE_OP 0x00200
854#define SRC2_IMM 0x00400
856#define UNUSED_DEST 0x00800
857#define REG_DEST 0x01000
858#define REG1_SOURCE 0x02000
859#define REG2_SOURCE 0x04000
860#define SLOW_SRC1 0x08000
861#define SLOW_SRC2 0x10000
862#define SLOW_DEST 0x20000
863#define MEM_USE_TMP2 0x40000
865#define STACK_STORE ST_D
866#define STACK_LOAD LD_D
870 if (imm <= I12_MAX && imm >=
I12_MIN)
873 if (imm <= 0x7fffffffl && imm >= -0x80000000l) {
875 return push_inst(compiler,
ORI |
RD(dst_r) |
RJ(dst_r) |
IMM_I12(imm));
876 }
else if (imm <= 0x7ffffffffffffl && imm >= -0x8000000000000l) {
879 return push_inst(compiler,
LU32I_D |
RD(dst_r) | (
sljit_ins)(((imm >> 32) & 0xfffff) << 5));
887#define STACK_MAX_DISTANCE (-I12_MIN)
899 CHECK(check_sljit_emit_enter(compiler,
options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
900 set_emit_enter(compiler,
options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
902 local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds - saved_arg_count, 1);
903 local_size += GET_SAVED_FLOAT_REGISTERS_SIZE(fscratches, fsaveds, f64);
911 offset = local_size - SSIZE_OF(sw);
925 for (i =
SLJIT_S0 - saved_arg_count; i > tmp; i--) {
948 else if (local_size > 0)
958 while (arg_types > 0) {
973#undef STACK_MAX_DISTANCE
980 CHECK(check_sljit_set_context(compiler,
options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
981 set_set_context(compiler,
options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
983 local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds - SLJIT_KEPT_SAVEDS_COUNT(
options), 1);
984 local_size += GET_SAVED_FLOAT_REGISTERS_SIZE(fscratches, fsaveds, f64);
991#define STACK_MAX_DISTANCE (-I12_MIN - 16)
1012 offset = local_size - SSIZE_OF(sw);
1017 for (i =
SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->
options); i > tmp; i--) {
1041#undef STACK_MAX_DISTANCE
1046 CHECK(check_sljit_emit_return_void(compiler));
1048 FAIL_IF(emit_stack_frame_release(compiler, 0));
1056 CHECK(check_sljit_emit_return_to(compiler, src, srcw));
1059 ADJUST_LOCAL_OFFSET(src, srcw);
1069 FAIL_IF(emit_stack_frame_release(compiler, 1));
1071 SLJIT_SKIP_CHECKS(compiler);
1079static const sljit_ins data_transfer_insts[16 + 4] = {
1104static const sljit_ins data_transfer_insts_x[16 + 4] = {
1136 if (
arg & OFFS_REG_MASK) {
1142 RJ(base) |
RK(offs);
1150 return push_inst(compiler, ins);
1160 if (!argw || (!(
arg & OFFS_REG_MASK) && (argw <= I12_MAX && argw >=
I12_MIN))) {
1171#define TO_ARGW_HI(argw) (((argw) & ~0xfff) + (((argw) & 0x800) ? 0x1000 : 0))
1179 if (
arg & OFFS_REG_MASK)
1182 if (
arg == next_arg) {
1183 if (((next_argw - argw) <=
I12_MAX && (next_argw - argw) >=
I12_MIN)
1213 if (compiler->cache_arg ==
arg && argw - compiler->cache_argw <=
I12_MAX && argw - compiler->cache_argw >=
I12_MIN)
1216 if (compiler->cache_arg ==
SLJIT_MEM && (argw - compiler->cache_argw <=
I12_MAX) && (argw - compiler->cache_argw >=
I12_MIN)) {
1217 offset = argw - compiler->cache_argw;
1222 if (next_arg && next_argw - argw <= I12_MAX && next_argw - argw >=
I12_MIN && argw_hi !=
TO_ARGW_HI(next_argw)) {
1224 compiler->cache_argw = argw;
1228 compiler->cache_argw = argw_hi;
1237 if (
arg == next_arg && next_argw - argw <= I12_MAX && next_argw - argw >=
I12_MIN) {
1238 compiler->cache_arg =
arg;
1255 if (getput_arg_fast(compiler,
flags, reg,
arg, argw))
1256 return compiler->
error;
1266 return push_mem_inst(compiler,
flags, reg,
SLJIT_MEM2(base, tmp_r), 0);
1268 FAIL_IF(load_immediate(compiler, tmp_r, argw));
1271 return push_mem_inst(compiler,
flags, reg,
SLJIT_MEM2(base, tmp_r), 0);
1278 if (getput_arg_fast(compiler,
flags, reg,
arg1, arg1w))
1279 return compiler->
error;
1280 return getput_arg(compiler,
flags, reg,
arg1, arg1w,
arg2, arg2w);
1283#define IMM_EXTEND(v) (IMM_I12((op & SLJIT_32) ? (v) : (32 + (v))))
1286#define EMIT_LOGICAL(op_imm, op_reg) \
1287 if (flags & SRC2_IMM) { \
1288 if (op & SLJIT_SET_Z) {\
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))); \
1292 if (!(flags & UNUSED_DEST)) { \
1293 if (dst == src1) { \
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))); \
1302 if (op & SLJIT_SET_Z) \
1303 FAIL_IF(push_inst(compiler, op_reg | RD(EQUAL_FLAG) | RJ(src1) | RK(src2))); \
1304 if (!(flags & UNUSED_DEST)) \
1305 FAIL_IF(push_inst(compiler, op_reg | RD(dst) | RJ(src1) | RK(src2))); \
1309#define EMIT_SHIFT(imm, reg) \
1316 sljit_s32 is_overflow, is_carry, carry_src_r, is_handled, reg;
1330 return push_inst(compiler,
ANDI |
RD(dst) |
RJ(src2) |
IMM_I12(0xff));
1337 return push_inst(compiler,
EXT_W_B |
RD(dst) |
RJ(src2));
1344 return push_inst(compiler,
INST(BSTRPICK, op) |
RD(dst) |
RJ(src2) | (15 << 16));
1351 return push_inst(compiler,
EXT_W_H |
RD(dst) |
RJ(src2));
1358 return push_inst(compiler,
BSTRPICK_D |
RD(dst) |
RJ(src2) | (31 << 16));
1371 return push_inst(compiler,
INST(
CLZ, op) |
RD(dst) |
RJ(src2));
1375 return push_inst(compiler,
INST(CTZ, op) |
RD(dst) |
RJ(src2));
1384 return push_inst(compiler,
EXT_W_H |
RD(dst) |
RJ(dst));
1389 return push_inst(compiler,
INST(BSTRPICK, op) |
RD(dst) |
RJ(dst) | (15 << 16));
1399 return push_inst(compiler,
BSTRPICK_D |
RD(dst) |
RJ(dst) | (31 << 16));
1426 if (is_overflow || carry_src_r != 0) {
1429 else if (src2 != dst)
1443 if (is_overflow || carry_src_r != 0) {
1465 if (carry_src_r != 0) {
1468 else if (src2 != dst)
1480 if (carry_src_r != 0) {
1489 if (carry_src_r == 0)
1526 switch (GET_FLAG_TYPE(op)) {
1552 return push_inst(compiler,
INST(
SUB, op) |
RD(dst) |
RJ(src1) |
RK(src2));
1571 if (is_overflow || is_carry)
1583 if (is_overflow || is_carry)
1635 return push_inst(compiler,
INST(
MUL, op) |
RD(dst) |
RJ(src1) |
RK(src2));
1693 src2 = word_size - src2;
1694 return push_inst(compiler,
INST(ROTRI, op) |
RD(dst) |
RJ(src1) |
IMM_I12(src2));
1707 return push_inst(compiler,
INST(
ROTR, op) |
RD(dst) |
RJ(src1) |
RK(src2));
1720 return push_inst(compiler, op_imm |
RD(dst) |
RJ(src1) |
IMM_I12(src2));
1728 return push_inst(compiler, op_reg |
RD(dst) |
RJ(src1) |
RK(src2));
1748 compiler->cache_arg = 0;
1749 compiler->cache_argw = 0;
1756 }
else if (FAST_IS_REG(dst)) {
1760 src2_tmp_reg = dst_r;
1765 if (src2 ==
SLJIT_IMM && src2w != 0 && src2w <= I12_MAX && src2w >=
I12_MIN) {
1781 if (FAST_IS_REG(src1)) {
1800 if (FAST_IS_REG(src2)) {
1808 FAIL_IF(load_immediate(compiler, src2_tmp_reg, src2w));
1809 src2_r = src2_tmp_reg;
1821 if (getput_arg_fast(compiler,
flags |
LOAD_DATA, src2_tmp_reg, src2, src2w))
1826 src2_r = src2_tmp_reg;
1831 if ((
flags &
SLOW_DEST) && !can_cache(src2, src2w, src1, src1w) && can_cache(src2, src2w, dst, dstw)) {
1844 FAIL_IF(emit_single_op(compiler, op,
flags, dst_r, src1_r, src2_r));
1848 getput_arg_fast(compiler,
flags, dst_r, dst, dstw);
1849 return compiler->
error;
1851 return getput_arg(compiler,
flags, dst_r, dst, dstw, 0, 0);
1860 CHECK(check_sljit_emit_op0(compiler, op));
1864 return push_inst(compiler,
BREAK);
1903 CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw));
1904 ADJUST_LOCAL_OFFSET(dst, dstw);
1905 ADJUST_LOCAL_OFFSET(src, srcw);
1938 return emit_op(compiler, op,
flags, dst, dstw,
TMP_ZERO, 0, src, srcw);
1961 CHECK(check_sljit_emit_op2(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w));
1962 ADJUST_LOCAL_OFFSET(dst, dstw);
1963 ADJUST_LOCAL_OFFSET(src1, src1w);
1964 ADJUST_LOCAL_OFFSET(src2, src2w);
1984 return emit_op(compiler, op,
flags |
IMM_OP, dst, dstw, src1, src1w, src2, src2w);
1987 compiler->status_flags_state = 0;
1988 return emit_op(compiler, op,
flags |
CUMULATIVE_OP, dst, dstw, src1, src1w, src2, src2w);
2010 return emit_op(compiler, op,
flags |
IMM_OP, dst, dstw, src1, src1w, src2, src2w);
2022 CHECK(check_sljit_emit_op2(compiler, op, 1, 0, 0, src1, src1w, src2, src2w));
2024 SLJIT_SKIP_CHECKS(compiler);
2025 return sljit_emit_op2(compiler, op, 0, 0, src1, src1w, src2, src2w);
2034 CHECK(check_sljit_emit_op2r(compiler, op, dst_reg, src1, src1w, src2, src2w));
2038 SLJIT_SKIP_CHECKS(compiler);
2059 CHECK(check_sljit_emit_shift_into(compiler, op, dst_reg, src1_reg, src2_reg, src3, src3w));
2063 if (src1_reg == src2_reg) {
2064 SLJIT_SKIP_CHECKS(compiler);
2068 ADJUST_LOCAL_OFFSET(src3, src3w);
2071 src3w &= bit_length - 1;
2078 src3w = bit_length - src3w;
2082 src3w = bit_length - src3w;
2086 FAIL_IF(push_inst(compiler, ins1 |
RD(dst_reg) |
RJ(src1_reg)));
2094 }
else if (dst_reg == src3) {
2109 FAIL_IF(push_inst(compiler, ins1 |
RD(dst_reg) |
RJ(src1_reg) |
RK(src3)));
2128 CHECK(check_sljit_emit_op_src(compiler, op, src, srcw));
2129 ADJUST_LOCAL_OFFSET(src, srcw);
2133 if (FAST_IS_REG(src))
2151 if (base && srcw <= I12_MAX && srcw >=
I12_MIN)
2169 CHECK(check_sljit_emit_op_dst(compiler, op, dst, dstw));
2170 ADJUST_LOCAL_OFFSET(dst, dstw);
2174 if (FAST_IS_REG(dst))
2180 dst_r = FAST_IS_REG(dst) ? dst :
TMP_REG2;
2193 CHECK_REG_INDEX(check_sljit_get_register_index(
type, reg));
2196 return reg_map[reg];
2201 return freg_map[reg];
2209 CHECK(check_sljit_emit_op_custom(compiler, instruction,
size));
2211 return push_inst(compiler, *(
sljit_ins*)instruction);
2217#define SET_COND(cond) (sljit_ins)(cond << 15)
2219#define COND_CUN SET_COND(0x8)
2220#define COND_CEQ SET_COND(0x4)
2221#define COND_CUEQ SET_COND(0xc)
2222#define COND_CLT SET_COND(0x2)
2223#define COND_CULT SET_COND(0xa)
2224#define COND_CLE SET_COND(0x6)
2225#define COND_CULE SET_COND(0xe)
2226#define COND_CNE SET_COND(0x10)
2227#define COND_CUNE SET_COND(0x18)
2228#define COND_COR SET_COND(0x14)
2230#define FINST(inst, type) (sljit_ins)((type & SLJIT_32) ? inst##_S : inst##_D)
2231#define FCD(cd) (sljit_ins)(cd & 0x7)
2232#define FCJ(cj) (sljit_ins)((cj & 0x7) << 5)
2233#define FCA(ca) (sljit_ins)((ca & 0x7) << 15)
2234#define F_OTHER_FLAG 1
2236#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_32) >> 7))
2251 inst =
FINST(FTINTRZ_L, op);
2254 inst =
FINST(FTINTRZ_W, op);
2307 FAIL_IF(push_inst(compiler, inst |
FRD(dst_r) |
FRJ(dst_r)));
2318 return sljit_emit_fop1_conv_f64_from_w(compiler, op, dst, dstw, src, srcw);
2360 FAIL_IF(push_inst(compiler, inst |
FRD(dst_r) |
FRJ(dst_r)));
2367 FAIL_IF(push_inst(compiler, inst |
FRD(dst_r) |
FRJ(dst_r)));
2391 switch (GET_FLAG_TYPE(op)) {
2426 compiler->cache_arg = 0;
2427 compiler->cache_argw = 0;
2430 SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
2435 dst_r = FAST_IS_REG(dst) ? dst :
TMP_FREG1;
2465 return emit_op_mem2(compiler,
FLOAT_DATA(op), dst_r, dst, dstw, 0, 0);
2477 CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
2478 ADJUST_LOCAL_OFFSET(dst, dstw);
2479 ADJUST_LOCAL_OFFSET(src1, src1w);
2480 ADJUST_LOCAL_OFFSET(src2, src2w);
2482 compiler->cache_arg = 0;
2483 compiler->cache_argw = 0;
2485 dst_r = FAST_IS_REG(dst) ? dst :
TMP_FREG2;
2504 if ((dst &
SLJIT_MEM) && !can_cache(src1, src1w, src2, src2w) && can_cache(src1, src1w, dst, dstw)) {
2550 CHECK(check_sljit_emit_fop2r(compiler, op, dst_freg, src1, src1w, src2, src2w));
2551 ADJUST_LOCAL_OFFSET(src1, src1w);
2552 ADJUST_LOCAL_OFFSET(src2, src2w);
2560 reg = (dst_freg == src2) ?
TMP_FREG1 : dst_freg;
2565 return push_inst(compiler,
FINST(FCOPYSIGN, op) |
FRD(dst_freg) |
FRJ(src1) |
FRK(src2));
2577 CHECK(check_sljit_emit_fset32(compiler, freg,
value));
2597 CHECK(check_sljit_emit_fset64(compiler, freg,
value));
2614 CHECK(check_sljit_emit_fcopy(compiler, op, freg, reg));
2620 return push_inst(compiler, inst);
2632 CHECK_PTR(check_sljit_emit_label(compiler));
2639 set_label(label, compiler);
2700 CHECK_PTR(check_sljit_emit_jump(compiler,
type));
2707 inst = get_jump_instruction(
type);
2711 jump->flags |= IS_COND;
2714 jump->addr = compiler->
size;
2718 jump->flags |= IS_CALL;
2725 compiler->
size += JUMP_MAX_SIZE - 1;
2734 CHECK_PTR(check_sljit_emit_call(compiler,
type, arg_types));
2737 PTR_FAIL_IF(emit_stack_frame_release(compiler, 0));
2741 SLJIT_SKIP_CHECKS(compiler);
2755 CHECK_PTR(check_sljit_emit_cmp(compiler,
type, src1, src1w, src2, src2w));
2756 ADJUST_LOCAL_OFFSET(src1, src1w);
2757 ADJUST_LOCAL_OFFSET(src2, src2w);
2759 compiler->cache_arg = 0;
2760 compiler->cache_argw = 0;
2770 PTR_FAIL_IF(emit_op_mem2(compiler,
flags, src2_tmp_reg, src2, src2w, 0, 0));
2771 src2 = src2_tmp_reg;
2785 PTR_FAIL_IF(load_immediate(compiler, src2_tmp_reg, src2w));
2786 src2 = src2_tmp_reg;
2799 inst =
BNE |
RJ(src1) |
RD(src2);
2802 inst =
BEQ |
RJ(src1) |
RD(src2);
2817 inst =
BGE |
RJ(src1) |
RD(src2);
2820 inst =
BLT |
RJ(src1) |
RD(src2);
2823 inst =
BGE |
RJ(src2) |
RD(src1);
2826 inst =
BLT |
RJ(src2) |
RD(src1);
2835 jump->addr = compiler->
size;
2839 compiler->
size += JUMP_MAX_SIZE - 1;
2849 CHECK(check_sljit_emit_ijump(compiler,
type, src, srcw));
2853 ADJUST_LOCAL_OFFSET(src, srcw);
2866 jump->addr = compiler->
size;
2870 compiler->
size += JUMP_MAX_SIZE - 1;
2881 CHECK(check_sljit_emit_icall(compiler,
type, arg_types, src, srcw));
2884 ADJUST_LOCAL_OFFSET(src, srcw);
2895 FAIL_IF(emit_stack_frame_release(compiler, 0));
2899 SLJIT_SKIP_CHECKS(compiler);
2912 CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw,
type));
2913 ADJUST_LOCAL_OFFSET(dst, dstw);
2918 compiler->cache_arg = 0;
2919 compiler->cache_argw = 0;
2926 invert =
type & 0x1;
2978 return emit_op_mem(compiler, mem_type, src_r, dst, dstw);
2988 return emit_op(compiler, saved_op, mem_type, dst, dstw,
TMP_REG1, 0, src_r, 0);
2989 return emit_op(compiler, saved_op, mem_type, dst, dstw, dst, dstw, src_r, 0);
3002 CHECK(check_sljit_emit_select(compiler,
type, dst_reg, src1, src1w, src2_reg));
3003 ADJUST_LOCAL_OFFSET(src1, src1w);
3005 if (dst_reg != src2_reg) {
3006 if (dst_reg == src1) {
3011 if (ADDRESSING_DEPENDS_ON(src1, dst_reg)) {
3014 if ((src1 & REG_MASK) == dst_reg)
3015 src1 = (src1 & ~REG_MASK) |
TMP_REG1;
3017 if (OFFS_REG(src1) == dst_reg)
3018 src1 = (src1 & ~OFFS_REG_MASK) | TO_OFFS_REG(
TMP_REG1);
3032 FAIL_IF(emit_op_mem(compiler, inp_flags, dst_reg, src1, src1w));
3036 FAIL_IF(load_immediate(compiler, dst_reg, src1w));
3052 CHECK(check_sljit_emit_fselect(compiler,
type, dst_freg, src1, src1w, src2_freg));
3054 ADJUST_LOCAL_OFFSET(src1, src1w);
3087 CHECK(check_sljit_emit_mem(compiler,
type, reg, mem, memw));
3089 if (!(reg & REG_PAIR_MASK))
3090 return sljit_emit_mem_unaligned(compiler,
type, reg, mem, memw);
3104 if (((memw + 0x800) & 0xfff) <= 0xfff - SSIZE_OF(sw)) {
3131 return push_mem_inst(compiler,
flags, REG_PAIR_SECOND(reg),
SLJIT_MEM1(mem), (memw + SSIZE_OF(sw)) & 0xfff);
3146 if (!(mem & REG_MASK)) {
3148 return load_immediate(compiler,
TMP_REG3, memw);
3172 CHECK(check_sljit_emit_simd_mov(compiler,
type, freg, srcdst, srcdstw));
3174 ADJUST_LOCAL_OFFSET(srcdst, srcdstw);
3176 if (reg_size != 5 && reg_size != 4)
3187 ins =
FRD(srcdst) |
FRJ(freg) |
FRK(freg);
3189 ins =
FRD(freg) |
FRJ(srcdst) |
FRK(srcdst);
3196 return push_inst(compiler, ins);
3204 if (FAST_IS_REG(srcdst) && srcdst >= 0 && (srcdstw >=
I12_MIN && srcdstw <=
I12_MAX))
3207 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &srcdst, srcdstw));
3208 return push_inst(compiler, ins |
FRD(freg) |
RJ(srcdst) |
IMM_I12(0));
3221 CHECK(check_sljit_emit_simd_replicate(compiler,
type, freg, src, srcw));
3223 ADJUST_LOCAL_OFFSET(src, srcw);
3225 if (reg_size != 5 && reg_size != 4)
3235 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &src, srcw));
3252 if (reg_size == 5) {
3254 return push_inst(compiler,
XVPERMI | ins |
FRD(freg) |
FRJ(freg));
3267 return push_inst(compiler, ins |
FRD(freg) |
RJ(src));
3279 CHECK(check_sljit_emit_simd_lane_mov(compiler,
type, freg, lane_index, srcdst, srcdstw));
3281 ADJUST_LOCAL_OFFSET(srcdst, srcdstw);
3283 if (reg_size != 5 && reg_size != 4)
3299 ins = (reg_size == 5) ? ((
sljit_ins)1 << 26) : 0;
3311 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &srcdst, srcdstw));
3318 return push_inst(compiler,
VSTELM | ins |
FRD(freg) |
RJ(srcdst));
3322 ins = (
sljit_ins)(0x3f ^ (0x1f >> elem_size)) << 10;
3324 if (reg_size == 5) {
3325 if (elem_size < 2) {
3327 if (lane_index >= (2 << (3 - elem_size))) {
3344 ins = (reg_size == 5) ? (
sljit_ins)(0x3f ^ (0x3f >> elem_size)) << 10 | (
sljit_ins)1 << 26 : (
sljit_ins)(0x3f ^ (0x1f >> elem_size)) << 10;
3361 ins = (
sljit_ins)(0x3f ^ (0x1f >> elem_size)) << 10;
3368 if (reg_size == 5) {
3369 if (elem_size < 2) {
3370 if (lane_index >= (2 << (3 - elem_size))) {
3378 return push_inst(compiler, ins |
RD(srcdst) |
FRJ(
TMP_FREG1) |
IMM_V(lane_index % (2 << (3 - elem_size))));
3381 ins ^= (
sljit_ins)1 << (15 - elem_size);
3386 return push_inst(compiler, ins |
RD(srcdst) |
FRJ(freg) |
IMM_V(lane_index));
3388 ins = (
sljit_ins)(0x3f ^ (0x1f >> elem_size)) << 10;
3390 if (reg_size == 5) {
3391 if (elem_size < 2) {
3393 if (lane_index >= (2 << (3 - elem_size))) {
3420 CHECK(check_sljit_emit_simd_lane_replicate(compiler,
type, freg, src, src_lane_index));
3422 if (reg_size != 5 && reg_size != 4)
3431 ins = (
sljit_ins)(0x3f ^ (0x1f >> elem_size)) << 10;
3433 if (reg_size == 5) {
3436 ins = (src_lane_index < (2 << (3 - elem_size))) ? (
sljit_ins)(0x44 << 10) : (
sljit_ins)(0xee << 10);
3438 return push_inst(compiler,
XVPERMI | ins |
FRD(freg) |
FRJ(freg));
3441 return push_inst(compiler,
VREPLVEI | ins |
FRD(freg) |
FRJ(src) |
IMM_V(src_lane_index));
3454 CHECK(check_sljit_emit_simd_extend(compiler,
type, freg, src, srcw));
3456 ADJUST_LOCAL_OFFSET(src, srcw);
3458 if (reg_size != 5 && reg_size != 4)
3473 if (FAST_IS_REG(src) && src >= 0 && (srcw >=
I12_MIN && srcw <=
I12_MAX))
3476 FAIL_IF(sljit_emit_simd_mem_offset(compiler, &src, srcw));
3483 if (elem_size != 2 || elem2_size != 3)
3487 if (reg_size == 5) {
3506 }
while (++elem_size < elem2_size);
3521 CHECK(check_sljit_emit_simd_sign(compiler,
type, freg, dst, dstw));
3523 ADJUST_LOCAL_OFFSET(dst, dstw);
3525 if (reg_size != 5 && reg_size != 4)
3537 dst_r = FAST_IS_REG(dst) ? dst :
TMP_REG2;
3546 if (reg_size == 5) {
3566 CHECK(check_sljit_emit_simd_op2(compiler,
type, dst_freg, src1_freg, src2_freg));
3568 if (reg_size != 5 && reg_size != 4)
3580 switch (SLJIT_SIMD_GET_OPCODE(
type)) {
3595 return push_inst(compiler, ins |
FRD(dst_freg) |
FRJ(src1_freg) |
FRK(src2_freg));
3606 CHECK(check_sljit_emit_atomic_load(compiler, op, dst_reg, mem_reg));
3626 return push_inst(compiler, ins |
RD(dst_reg) |
RJ(mem_reg) |
IMM_I12(0));
3640 CHECK(check_sljit_emit_atomic_store(compiler, op, src_reg, mem_reg, temp_reg));
3667 FAIL_IF(push_inst(compiler, ins |
RD(tmp) |
RJ(mem_reg) |
RK(src_reg)));
3672 FAIL_IF(push_inst(compiler, unsign |
RD(tmp) |
RJ(tmp)));
3685 return push_inst(compiler,
ORI |
RD(dst) |
RJ(dst) |
IMM_I12(init_value));
3696 inst[0] = (inst[0] & (
OPC_1RI20(0x7f) | 0x1f)) | (
sljit_ins)(((new_target & 0xffffffff) >> 12) << 5);
3702 inst[2] = (inst[2] & (
OPC_2RI12(0x3ff) | 0x3ff)) |
IMM_I12(new_target >> 52);
3708 inst[3] = (inst[3] & (
OPC_2RI16(0x3f) | 0x3ff)) |
IMM_I12((new_target & 0xfff) >> 2);
3712 inst = (
sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
3722 CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
3723 ADJUST_LOCAL_OFFSET(dst, dstw);
3727 set_const(const_, compiler);
3729 dst_r = FAST_IS_REG(dst) ? dst :
TMP_REG2;
3730 PTR_FAIL_IF(emit_const(compiler, dst_r, init_value, 0));
3744 CHECK_PTR(check_sljit_emit_mov_addr(compiler, dst, dstw));
3745 ADJUST_LOCAL_OFFSET(dst, dstw);
3749 set_mov_addr(jump, compiler, 0);
3751 dst_r = FAST_IS_REG(dst) ? dst :
TMP_REG2;
3754 compiler->
size += JUMP_MAX_SIZE - 1;
zend_ffi_ctype_name_buf buf
PHP_JSON_API size_t int options
#define SLJIT_UNREACHABLE()
unsigned short int sljit_u16
signed short int sljit_s16
#define SLJIT_UNLIKELY(x)
#define SLJIT_LOCALS_OFFSET
#define SLJIT_API_FUNC_ATTRIBUTE
#define SLJIT_COMPILE_ASSERT(x, description)
#define SLJIT_UNUSED_ARG(arg)
#define SLJIT_CACHE_FLUSH(from, to)
#define SLJIT_UPDATE_WX_FLAGS(from, to, enable_exec)
#define PTR_FAIL_IF(expr)
#define PTR_FAIL_WITH_EXEC_IF(ptr)
#define CHECK_ERROR_PTR()
#define SLJIT_UNORDERED_OR_LESS_EQUAL
#define SLJIT_SKIP_FRAMES_BEFORE_FAST_RETURN
#define SLJIT_ARG_TYPE_SCRATCH_REG
#define SLJIT_SIMD_OP2_AND
#define SLJIT_ORDERED_LESS_EQUAL
#define SLJIT_CONV_F64_FROM_S32
#define SLJIT_CONV_S32_FROM_F64
#define SLJIT_FAST_RETURN
#define SLJIT_ATOMIC_NOT_STORED
#define SLJIT_FIRST_SAVED_REG
#define SLJIT_CONV_F64_FROM_U32
#define SLJIT_UNORDERED_OR_GREATER
#define SLJIT_MEM2(r1, r2)
#define SLJIT_ORDERED_GREATER_EQUAL
#define SLJIT_PREFETCH_L3
#define SLJIT_SIG_GREATER_EQUAL
#define SLJIT_UNORDERED_OR_NOT_EQUAL
#define SLJIT_ARG_TYPE_F64
#define SLJIT_SIMD_EXTEND_SIGNED
#define SLJIT_PREFETCH_L1
#define SLJIT_SIMD_OP2_XOR
#define SLJIT_ORDERED_EQUAL
#define SLJIT_ERR_UNSUPPORTED
#define SLJIT_UNORDERED_OR_LESS
#define SLJIT_ORDERED_GREATER
#define SLJIT_SIG_LESS_EQUAL
#define SLJIT_UNORDERED_OR_EQUAL
#define SLJIT_CALL_RETURN
#define SLJIT_REWRITABLE_JUMP
#define SLJIT_NOT_OVERFLOW
#define SLJIT_F_NOT_EQUAL
#define SLJIT_F_GREATER_EQUAL
#define SLJIT_CONV_SW_FROM_F64
#define SLJIT_CURRENT_FLAGS_ADD
#define SLJIT_HAS_PREFETCH
#define SLJIT_ENTER_REG_ARG
#define SLJIT_SIG_GREATER
#define SLJIT_SIMD_LANE_ZERO
#define SLJIT_FLOAT_REGISTER
#define SLJIT_ATOMIC_STORED
#define SLJIT_GET_RETURN_ADDRESS
#define SLJIT_FIRST_SAVED_FLOAT_REG
#define SLJIT_SIMD_OP2_OR
#define SLJIT_CONV_F64_FROM_SW
#define SLJIT_SHIFT_INTO_NON_ZERO
#define SLJIT_SIMD_LANE_SIGNED
#define SLJIT_GREATER_EQUAL
#define SLJIT_GP_REGISTER
#define SLJIT_SKIP_FRAMES_BEFORE_RETURN
#define SLJIT_SIMD_REG_256
#define SLJIT_ERR_COMPILED
#define SLJIT_HAS_COPY_F64
#define SLJIT_SIMD_REG_128
#define SLJIT_F_LESS_EQUAL
#define SLJIT_ORDERED_LESS
#define SLJIT_HAS_COPY_F32
#define SLJIT_CONV_F64_FROM_F32
#define SLJIT_COPY_TO_F64
#define SLJIT_PREFETCH_L2
#define SLJIT_SET_ATOMIC_STORED
#define SLJIT_CURRENT_FLAGS_SUB
#define SLJIT_PREFETCH_ONCE
#define SLJIT_ORDERED_NOT_EQUAL
#define SLJIT_CONV_F64_FROM_UW
#define SLJIT_UNORDERED_OR_GREATER_EQUAL
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 type)
SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
#define FINST(inst, type)
SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 arg_types)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2r(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst_reg, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_select(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 dst_reg, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2_reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 reg, sljit_s32 mem, sljit_sw memw)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_to(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
SLJIT_API_FUNC_ATTRIBUTE const char * sljit_get_platform_name(void)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
SLJIT_API_FUNC_ATTRIBUTE void * sljit_generate_code(struct sljit_compiler *compiler, sljit_s32 options, void *exec_allocator_data)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2u(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
#define LOONGARCH_HWCAP_LASX
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_cmp_info(sljit_s32 type)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_atomic_load(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst_reg, sljit_s32 mem_reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 type, sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const * sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_replicate(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 freg, sljit_s32 src, sljit_sw srcw)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_op2(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 dst_freg, sljit_s32 src1_freg, sljit_s32 src2_freg)
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_constant, sljit_sw executable_offset)
SLJIT_API_FUNC_ATTRIBUTE struct sljit_label * sljit_emit_label(struct sljit_compiler *compiler)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
#define EMIT_SHIFT(imm, reg)
#define EMIT_LOGICAL(op_imm, op_reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fset32(struct sljit_compiler *compiler, sljit_s32 freg, sljit_f32 value)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fcopy(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 freg, sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2r(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst_freg, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_void(struct sljit_compiler *compiler)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds, sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_lane_mov(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 freg, sljit_s32 lane_index, sljit_s32 srcdst, sljit_sw srcdstw)
SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_mov_addr(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src, sljit_sw srcw)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_shift_into(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst_reg, sljit_s32 src1_reg, sljit_s32 src2_reg, sljit_s32 src3, sljit_sw src3w)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_extend(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 freg, sljit_s32 src, sljit_sw srcw)
#define LOONGARCH_HWCAP_LSX
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds, sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
#define LOONGARCH_CFG2_LAMCAS
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_mov(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 freg, sljit_s32 srcdst, sljit_sw srcdstw)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fset64(struct sljit_compiler *compiler, sljit_s32 freg, sljit_f64 value)
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_dst(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw)
#define STACK_MAX_DISTANCE
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_atomic_store(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src_reg, sljit_s32 mem_reg, sljit_s32 temp_reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fselect(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 dst_freg, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2_freg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_sign(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 freg, sljit_s32 dst, sljit_sw dstw)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler, void *instruction, sljit_u32 size)
SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 arg_types, sljit_s32 src, sljit_sw srcw)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src, sljit_sw srcw)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_simd_lane_replicate(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 freg, sljit_s32 src, sljit_s32 src_lane_index)
#define SLJIT_IS_FPU_AVAILABLE
struct sljit_const * consts
sljit_sw executable_offset
struct sljit_jump * jumps
struct sljit_label * last_label
struct sljit_memory_fragment * buf
struct sljit_label * labels
struct sljit_const * next
struct sljit_label * next
union sljit_label::@034003116150245300057154161307153110213245130244 u
exit(string|int $status=0)