"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "sljit/sljitNativeMIPS_common.c" between
pcre-8.43.tar.bz2 and pcre-8.44.tar.bz2

About: The PCRE library implements Perl compatible regular expression pattern matching.

sljitNativeMIPS_common.c  (pcre-8.43.tar.bz2):sljitNativeMIPS_common.c  (pcre-8.44.tar.bz2)
skipping to change at line 30 skipping to change at line 30
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFIT S; OR * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFIT S; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISI NG IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISI NG IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O F SUCH DAMAGE. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O F SUCH DAMAGE.
*/ */
/* Latest MIPS architecture. */ /* Latest MIPS architecture. */
/* Automatically detect SLJIT_MIPS_R1 */ /* Automatically detect SLJIT_MIPS_R1 */
#if (defined __mips_isa_rev) && (__mips_isa_rev >= 6)
#define SLJIT_MIPS_R6 1
#endif
SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void) SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
{ {
#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) #if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
return "MIPS32-R6" SLJIT_CPUINFO;
#else /* !SLJIT_CONFIG_MIPS_32 */
return "MIPS64-R6" SLJIT_CPUINFO;
#endif /* SLJIT_CONFIG_MIPS_32 */
#elif (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
return "MIPS32-R1" SLJIT_CPUINFO; return "MIPS32-R1" SLJIT_CPUINFO;
#else #else /* !SLJIT_CONFIG_MIPS_32 */
return "MIPS64-R1" SLJIT_CPUINFO; return "MIPS64-R1" SLJIT_CPUINFO;
#endif #endif /* SLJIT_CONFIG_MIPS_32 */
#else /* SLJIT_MIPS_R1 */ #else /* SLJIT_MIPS_R1 */
return "MIPS III" SLJIT_CPUINFO; return "MIPS III" SLJIT_CPUINFO;
#endif #endif /* SLJIT_MIPS_R6 */
} }
/* Length of an instruction word /* Length of an instruction word
Both for mips-32 and mips-64 */ Both for mips-32 and mips-64 */
typedef sljit_u32 sljit_ins; typedef sljit_u32 sljit_ins;
#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2) #define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
#define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3) #define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3)
#define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4) #define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4)
skipping to change at line 65 skipping to change at line 79
#define FCSR_REG 31 #define FCSR_REG 31
/* Return address register. */ /* Return address register. */
#define RETURN_ADDR_REG 31 #define RETURN_ADDR_REG 31
/* Flags are kept in volatile registers. */ /* Flags are kept in volatile registers. */
#define EQUAL_FLAG 3 #define EQUAL_FLAG 3
#define OTHER_FLAG 1 #define OTHER_FLAG 1
#define TMP_FREG1 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1) #define TMP_FREG1 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2) #define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2)
#define TMP_FREG3 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3)
static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = { static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
0, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 24, 23, 22, 21, 20, 19, 18, 17, 16, 29, 4, 25, 31 0, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 24, 23, 22, 21, 20, 19, 18, 17, 16, 29, 4, 25, 31
}; };
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = { static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 4] = {
0, 0, 14, 2, 4, 6, 8, 12, 10 0, 0, 14, 2, 4, 6, 8, 12, 10, 16
}; };
#else #else
static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = { static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 4] = {
0, 0, 13, 14, 15, 16, 17, 12, 18 0, 0, 13, 14, 15, 16, 17, 12, 18, 10
}; };
#endif #endif
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* Instrucion forms */ /* Instrucion forms */
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
#define S(s) (reg_map[s] << 21) #define S(s) (reg_map[s] << 21)
#define T(t) (reg_map[t] << 16) #define T(t) (reg_map[t] << 16)
skipping to change at line 105 skipping to change at line 120
#define SA(s) ((s) << 21) #define SA(s) ((s) << 21)
#define TA(t) ((t) << 16) #define TA(t) ((t) << 16)
#define DA(d) ((d) << 11) #define DA(d) ((d) << 11)
#define IMM(imm) ((imm) & 0xffff) #define IMM(imm) ((imm) & 0xffff)
#define SH_IMM(imm) ((imm) << 6) #define SH_IMM(imm) ((imm) << 6)
#define DR(dr) (reg_map[dr]) #define DR(dr) (reg_map[dr])
#define FR(dr) (freg_map[dr]) #define FR(dr) (freg_map[dr])
#define HI(opcode) ((opcode) << 26) #define HI(opcode) ((opcode) << 26)
#define LO(opcode) (opcode) #define LO(opcode) (opcode)
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
/* CMP.cond.fmt */
/* S = (20 << 21) D = (21 << 21) */
#define CMP_FMT_S (20 << 21)
#endif /* SLJIT_MIPS_R6 */
/* S = (16 << 21) D = (17 << 21) */ /* S = (16 << 21) D = (17 << 21) */
#define FMT_S (16 << 21) #define FMT_S (16 << 21)
#define FMT_D (17 << 21) #define FMT_D (17 << 21)
#define ABS_S (HI(17) | FMT_S | LO(5)) #define ABS_S (HI(17) | FMT_S | LO(5))
#define ADD_S (HI(17) | FMT_S | LO(0)) #define ADD_S (HI(17) | FMT_S | LO(0))
#define ADDIU (HI(9)) #define ADDIU (HI(9))
#define ADDU (HI(0) | LO(33)) #define ADDU (HI(0) | LO(33))
#define AND (HI(0) | LO(36)) #define AND (HI(0) | LO(36))
#define ANDI (HI(12)) #define ANDI (HI(12))
#define B (HI(4)) #define B (HI(4))
#define BAL (HI(1) | (17 << 16)) #define BAL (HI(1) | (17 << 16))
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#define BC1EQZ (HI(17) | (9 << 21) | FT(TMP_FREG3))
#define BC1NEZ (HI(17) | (13 << 21) | FT(TMP_FREG3))
#else /* !SLJIT_MIPS_R6 */
#define BC1F (HI(17) | (8 << 21)) #define BC1F (HI(17) | (8 << 21))
#define BC1T (HI(17) | (8 << 21) | (1 << 16)) #define BC1T (HI(17) | (8 << 21) | (1 << 16))
#endif /* SLJIT_MIPS_R6 */
#define BEQ (HI(4)) #define BEQ (HI(4))
#define BGEZ (HI(1) | (1 << 16)) #define BGEZ (HI(1) | (1 << 16))
#define BGTZ (HI(7)) #define BGTZ (HI(7))
#define BLEZ (HI(6)) #define BLEZ (HI(6))
#define BLTZ (HI(1) | (0 << 16)) #define BLTZ (HI(1) | (0 << 16))
#define BNE (HI(5)) #define BNE (HI(5))
#define BREAK (HI(0) | LO(13)) #define BREAK (HI(0) | LO(13))
#define CFC1 (HI(17) | (2 << 21)) #define CFC1 (HI(17) | (2 << 21))
#define C_UN_S (HI(17) | FMT_S | LO(49)) #if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#define C_UEQ_S (HI(17) | CMP_FMT_S | LO(3))
#define C_ULE_S (HI(17) | CMP_FMT_S | LO(7))
#define C_ULT_S (HI(17) | CMP_FMT_S | LO(5))
#define C_UN_S (HI(17) | CMP_FMT_S | LO(1))
#define C_FD (FD(TMP_FREG3))
#else /* !SLJIT_MIPS_R6 */
#define C_UEQ_S (HI(17) | FMT_S | LO(51)) #define C_UEQ_S (HI(17) | FMT_S | LO(51))
#define C_ULE_S (HI(17) | FMT_S | LO(55)) #define C_ULE_S (HI(17) | FMT_S | LO(55))
#define C_ULT_S (HI(17) | FMT_S | LO(53)) #define C_ULT_S (HI(17) | FMT_S | LO(53))
#define C_UN_S (HI(17) | FMT_S | LO(49))
#define C_FD (0)
#endif /* SLJIT_MIPS_R6 */
#define CVT_S_S (HI(17) | FMT_S | LO(32)) #define CVT_S_S (HI(17) | FMT_S | LO(32))
#define DADDIU (HI(25)) #define DADDIU (HI(25))
#define DADDU (HI(0) | LO(45)) #define DADDU (HI(0) | LO(45))
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#define DDIV (HI(0) | (2 << 6) | LO(30))
#define DDIVU (HI(0) | (2 << 6) | LO(31))
#define DMOD (HI(0) | (3 << 6) | LO(30))
#define DMODU (HI(0) | (3 << 6) | LO(31))
#define DIV (HI(0) | (2 << 6) | LO(26))
#define DIVU (HI(0) | (2 << 6) | LO(27))
#define DMUH (HI(0) | (3 << 6) | LO(28))
#define DMUHU (HI(0) | (3 << 6) | LO(29))
#define DMUL (HI(0) | (2 << 6) | LO(28))
#define DMULU (HI(0) | (2 << 6) | LO(29))
#else /* !SLJIT_MIPS_R6 */
#define DDIV (HI(0) | LO(30)) #define DDIV (HI(0) | LO(30))
#define DDIVU (HI(0) | LO(31)) #define DDIVU (HI(0) | LO(31))
#define DIV (HI(0) | LO(26)) #define DIV (HI(0) | LO(26))
#define DIVU (HI(0) | LO(27)) #define DIVU (HI(0) | LO(27))
#define DIV_S (HI(17) | FMT_S | LO(3))
#define DMULT (HI(0) | LO(28)) #define DMULT (HI(0) | LO(28))
#define DMULTU (HI(0) | LO(29)) #define DMULTU (HI(0) | LO(29))
#endif /* SLJIT_MIPS_R6 */
#define DIV_S (HI(17) | FMT_S | LO(3))
#define DSLL (HI(0) | LO(56)) #define DSLL (HI(0) | LO(56))
#define DSLL32 (HI(0) | LO(60)) #define DSLL32 (HI(0) | LO(60))
#define DSLLV (HI(0) | LO(20)) #define DSLLV (HI(0) | LO(20))
#define DSRA (HI(0) | LO(59)) #define DSRA (HI(0) | LO(59))
#define DSRA32 (HI(0) | LO(63)) #define DSRA32 (HI(0) | LO(63))
#define DSRAV (HI(0) | LO(23)) #define DSRAV (HI(0) | LO(23))
#define DSRL (HI(0) | LO(58)) #define DSRL (HI(0) | LO(58))
#define DSRL32 (HI(0) | LO(62)) #define DSRL32 (HI(0) | LO(62))
#define DSRLV (HI(0) | LO(22)) #define DSRLV (HI(0) | LO(22))
#define DSUBU (HI(0) | LO(47)) #define DSUBU (HI(0) | LO(47))
#define J (HI(2)) #define J (HI(2))
#define JAL (HI(3)) #define JAL (HI(3))
#define JALR (HI(0) | LO(9)) #define JALR (HI(0) | LO(9))
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#define JR (HI(0) | LO(9))
#else /* !SLJIT_MIPS_R6 */
#define JR (HI(0) | LO(8)) #define JR (HI(0) | LO(8))
#endif /* SLJIT_MIPS_R6 */
#define LD (HI(55)) #define LD (HI(55))
#define LUI (HI(15)) #define LUI (HI(15))
#define LW (HI(35)) #define LW (HI(35))
#define MFC1 (HI(17)) #define MFC1 (HI(17))
#if !(defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#define MFHI (HI(0) | LO(16)) #define MFHI (HI(0) | LO(16))
#define MFLO (HI(0) | LO(18)) #define MFLO (HI(0) | LO(18))
#else /* SLJIT_MIPS_R6 */
#define MOD (HI(0) | (3 << 6) | LO(26))
#define MODU (HI(0) | (3 << 6) | LO(27))
#endif /* !SLJIT_MIPS_R6 */
#define MOV_S (HI(17) | FMT_S | LO(6)) #define MOV_S (HI(17) | FMT_S | LO(6))
#define MTC1 (HI(17) | (4 << 21)) #define MTC1 (HI(17) | (4 << 21))
#define MUL_S (HI(17) | FMT_S | LO(2)) #if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#define MUH (HI(0) | (3 << 6) | LO(24))
#define MUHU (HI(0) | (3 << 6) | LO(25))
#define MUL (HI(0) | (2 << 6) | LO(24))
#define MULU (HI(0) | (2 << 6) | LO(25))
#else /* !SLJIT_MIPS_R6 */
#define MULT (HI(0) | LO(24)) #define MULT (HI(0) | LO(24))
#define MULTU (HI(0) | LO(25)) #define MULTU (HI(0) | LO(25))
#endif /* SLJIT_MIPS_R6 */
#define MUL_S (HI(17) | FMT_S | LO(2))
#define NEG_S (HI(17) | FMT_S | LO(7)) #define NEG_S (HI(17) | FMT_S | LO(7))
#define NOP (HI(0) | LO(0)) #define NOP (HI(0) | LO(0))
#define NOR (HI(0) | LO(39)) #define NOR (HI(0) | LO(39))
#define OR (HI(0) | LO(37)) #define OR (HI(0) | LO(37))
#define ORI (HI(13)) #define ORI (HI(13))
#define SD (HI(63)) #define SD (HI(63))
#define SDC1 (HI(61)) #define SDC1 (HI(61))
#define SLT (HI(0) | LO(42)) #define SLT (HI(0) | LO(42))
#define SLTI (HI(10)) #define SLTI (HI(10))
#define SLTIU (HI(11)) #define SLTIU (HI(11))
skipping to change at line 191 skipping to change at line 254
#define SRA (HI(0) | LO(3)) #define SRA (HI(0) | LO(3))
#define SRAV (HI(0) | LO(7)) #define SRAV (HI(0) | LO(7))
#define SUB_S (HI(17) | FMT_S | LO(1)) #define SUB_S (HI(17) | FMT_S | LO(1))
#define SUBU (HI(0) | LO(35)) #define SUBU (HI(0) | LO(35))
#define SW (HI(43)) #define SW (HI(43))
#define SWC1 (HI(57)) #define SWC1 (HI(57))
#define TRUNC_W_S (HI(17) | FMT_S | LO(13)) #define TRUNC_W_S (HI(17) | FMT_S | LO(13))
#define XOR (HI(0) | LO(38)) #define XOR (HI(0) | LO(38))
#define XORI (HI(14)) #define XORI (HI(14))
#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) #if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) || (defined SLJIT_MIPS_R6 && SLJIT_ MIPS_R6)
#define CLZ (HI(28) | LO(32)) #define CLZ (HI(28) | LO(32))
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#define DCLZ (LO(18))
#else /* !SLJIT_MIPS_R6 */
#define DCLZ (HI(28) | LO(36)) #define DCLZ (HI(28) | LO(36))
#define MOVF (HI(0) | (0 << 16) | LO(1)) #define MOVF (HI(0) | (0 << 16) | LO(1))
#define MOVN (HI(0) | LO(11)) #define MOVN (HI(0) | LO(11))
#define MOVT (HI(0) | (1 << 16) | LO(1)) #define MOVT (HI(0) | (1 << 16) | LO(1))
#define MOVZ (HI(0) | LO(10)) #define MOVZ (HI(0) | LO(10))
#define MUL (HI(28) | LO(2)) #define MUL (HI(28) | LO(2))
#endif /* SLJIT_MIPS_R6 */
#define PREF (HI(51)) #define PREF (HI(51))
#define PREFX (HI(19) | LO(15)) #define PREFX (HI(19) | LO(15))
#define SEB (HI(31) | (16 << 6) | LO(32)) #define SEB (HI(31) | (16 << 6) | LO(32))
#define SEH (HI(31) | (24 << 6) | LO(32)) #define SEH (HI(31) | (24 << 6) | LO(32))
#endif #endif
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
#define ADDU_W ADDU #define ADDU_W ADDU
#define ADDIU_W ADDIU #define ADDIU_W ADDIU
#define SLL_W SLL #define SLL_W SLL
skipping to change at line 237 skipping to change at line 304
sljit_ins *ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); sljit_ins *ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins));
FAIL_IF(!ptr); FAIL_IF(!ptr);
*ptr = ins; *ptr = ins;
compiler->size++; compiler->size++;
compiler->delay_slot = delay_slot; compiler->delay_slot = delay_slot;
return SLJIT_SUCCESS; return SLJIT_SUCCESS;
} }
static SLJIT_INLINE sljit_ins invert_branch(sljit_s32 flags) static SLJIT_INLINE sljit_ins invert_branch(sljit_s32 flags)
{ {
return (flags & IS_BIT26_COND) ? (1 << 26) : (1 << 16); if (flags & IS_BIT26_COND)
return (1 << 26);
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
if (flags & IS_BIT23_COND)
return (1 << 23);
#endif /* SLJIT_MIPS_R6 */
return (1 << 16);
} }
static SLJIT_INLINE sljit_ins* detect_jump_type(struct sljit_jump *jump, sljit_i ns *code_ptr, sljit_ins *code, sljit_sw executable_offset) static SLJIT_INLINE sljit_ins* detect_jump_type(struct sljit_jump *jump, sljit_i ns *code_ptr, sljit_ins *code, sljit_sw executable_offset)
{ {
sljit_sw diff; sljit_sw diff;
sljit_uw target_addr; sljit_uw target_addr;
sljit_ins *inst; sljit_ins *inst;
sljit_ins saved_inst; sljit_ins saved_inst;
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
skipping to change at line 379 skipping to change at line 452
return code_ptr; return code_ptr;
} }
#ifdef __GNUC__ #ifdef __GNUC__
static __attribute__ ((noinline)) void sljit_cache_flush(void* code, void* code_ ptr) static __attribute__ ((noinline)) void sljit_cache_flush(void* code, void* code_ ptr)
{ {
SLJIT_CACHE_FLUSH(code, code_ptr); SLJIT_CACHE_FLUSH(code, code_ptr);
} }
#endif #endif
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
static SLJIT_INLINE sljit_sw put_label_get_length(struct sljit_put_label *put_la
bel, sljit_uw max_label)
{
if (max_label < 0x80000000l) {
put_label->flags = 0;
return 1;
}
if (max_label < 0x800000000000l) {
put_label->flags = 1;
return 3;
}
put_label->flags = 2;
return 5;
}
static SLJIT_INLINE void put_label_set(struct sljit_put_label *put_label)
{
sljit_uw addr = put_label->label->addr;
sljit_ins *inst = (sljit_ins *)put_label->addr;
sljit_s32 reg = *inst;
if (put_label->flags == 0) {
SLJIT_ASSERT(addr < 0x80000000l);
inst[0] = LUI | T(reg) | IMM(addr >> 16);
}
else if (put_label->flags == 1) {
SLJIT_ASSERT(addr < 0x800000000000l);
inst[0] = LUI | T(reg) | IMM(addr >> 32);
inst[1] = ORI | S(reg) | T(reg) | IMM((addr >> 16) & 0xffff);
inst[2] = DSLL | T(reg) | D(reg) | SH_IMM(16);
inst += 2;
}
else {
inst[0] = LUI | T(reg) | IMM(addr >> 48);
inst[1] = ORI | S(reg) | T(reg) | IMM((addr >> 32) & 0xffff);
inst[2] = DSLL | T(reg) | D(reg) | SH_IMM(16);
inst[3] = ORI | S(reg) | T(reg) | IMM((addr >> 16) & 0xffff);
inst[4] = DSLL | T(reg) | D(reg) | SH_IMM(16);
inst += 4;
}
inst[1] = ORI | S(reg) | T(reg) | IMM(addr & 0xffff);
}
#endif
SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil er) SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil er)
{ {
struct sljit_memory_fragment *buf; struct sljit_memory_fragment *buf;
sljit_ins *code; sljit_ins *code;
sljit_ins *code_ptr; sljit_ins *code_ptr;
sljit_ins *buf_ptr; sljit_ins *buf_ptr;
sljit_ins *buf_end; sljit_ins *buf_end;
sljit_uw word_count; sljit_uw word_count;
sljit_uw next_addr;
sljit_sw executable_offset; sljit_sw executable_offset;
sljit_uw addr; sljit_uw addr;
struct sljit_label *label; struct sljit_label *label;
struct sljit_jump *jump; struct sljit_jump *jump;
struct sljit_const *const_; struct sljit_const *const_;
struct sljit_put_label *put_label;
CHECK_ERROR_PTR(); CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_generate_code(compiler)); CHECK_PTR(check_sljit_generate_code(compiler));
reverse_buf(compiler); reverse_buf(compiler);
code = (sljit_ins*)SLJIT_MALLOC_EXEC(compiler->size * sizeof(sljit_ins)); code = (sljit_ins*)SLJIT_MALLOC_EXEC(compiler->size * sizeof(sljit_ins));
PTR_FAIL_WITH_EXEC_IF(code); PTR_FAIL_WITH_EXEC_IF(code);
buf = compiler->buf; buf = compiler->buf;
code_ptr = code; code_ptr = code;
word_count = 0; word_count = 0;
next_addr = 0;
executable_offset = SLJIT_EXEC_OFFSET(code); executable_offset = SLJIT_EXEC_OFFSET(code);
label = compiler->labels; label = compiler->labels;
jump = compiler->jumps; jump = compiler->jumps;
const_ = compiler->consts; const_ = compiler->consts;
put_label = compiler->put_labels;
do { do {
buf_ptr = (sljit_ins*)buf->memory; buf_ptr = (sljit_ins*)buf->memory;
buf_end = buf_ptr + (buf->used_size >> 2); buf_end = buf_ptr + (buf->used_size >> 2);
do { do {
*code_ptr = *buf_ptr++; *code_ptr = *buf_ptr++;
SLJIT_ASSERT(!label || label->size >= word_count); if (next_addr == word_count) {
SLJIT_ASSERT(!jump || jump->addr >= word_count); SLJIT_ASSERT(!label || label->size >= word_count)
SLJIT_ASSERT(!const_ || const_->addr >= word_count); ;
/* These structures are ordered by their address. */ SLJIT_ASSERT(!jump || jump->addr >= word_count);
if (label && label->size == word_count) { SLJIT_ASSERT(!const_ || const_->addr >= word_coun
label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(cod t);
e_ptr, executable_offset); SLJIT_ASSERT(!put_label || put_label->addr >= wor
label->size = code_ptr - code; d_count);
label = label->next;
} /* These structures are ordered by their address.
if (jump && jump->addr == word_count) { */
if (label && label->size == word_count) {
label->addr = (sljit_uw)SLJIT_ADD_EXEC_OF
FSET(code_ptr, executable_offset);
label->size = code_ptr - code;
label = label->next;
}
if (jump && jump->addr == word_count) {
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
jump->addr = (sljit_uw)(code_ptr - 3); jump->addr = (sljit_uw)(code_ptr - 3);
#else #else
jump->addr = (sljit_uw)(code_ptr - 7); jump->addr = (sljit_uw)(code_ptr - 7);
#endif #endif
code_ptr = detect_jump_type(jump, code_ptr, code, code_ptr = detect_jump_type(jump, code_pt
executable_offset); r, code, executable_offset);
jump = jump->next; jump = jump->next;
} }
if (const_ && const_->addr == word_count) { if (const_ && const_->addr == word_count) {
/* Just recording the address. */ const_->addr = (sljit_uw)code_ptr;
const_->addr = (sljit_uw)code_ptr; const_ = const_->next;
const_ = const_->next; }
if (put_label && put_label->addr == word_count) {
SLJIT_ASSERT(put_label->label);
put_label->addr = (sljit_uw)code_ptr;
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
code_ptr += put_label_get_length(put_labe
l, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label-
>size));
word_count += 5;
#endif
put_label = put_label->next;
}
next_addr = compute_next_addr(label, jump, const_
, put_label);
} }
code_ptr ++; code_ptr ++;
word_count ++; word_count ++;
} while (buf_ptr < buf_end); } while (buf_ptr < buf_end);
buf = buf->next; buf = buf->next;
} while (buf); } while (buf);
if (label && label->size == word_count) { if (label && label->size == word_count) {
label->addr = (sljit_uw)code_ptr; label->addr = (sljit_uw)code_ptr;
label->size = code_ptr - code; label->size = code_ptr - code;
label = label->next; label = label->next;
} }
SLJIT_ASSERT(!label); SLJIT_ASSERT(!label);
SLJIT_ASSERT(!jump); SLJIT_ASSERT(!jump);
SLJIT_ASSERT(!const_); SLJIT_ASSERT(!const_);
SLJIT_ASSERT(!put_label);
SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size); SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size);
jump = compiler->jumps; jump = compiler->jumps;
while (jump) { while (jump) {
do { do {
addr = (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target; addr = (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target;
buf_ptr = (sljit_ins *)jump->addr; buf_ptr = (sljit_ins *)jump->addr;
if (jump->flags & PATCH_B) { if (jump->flags & PATCH_B) {
addr = (sljit_sw)(addr - ((sljit_uw)SLJIT_ADD_EXE C_OFFSET(buf_ptr, executable_offset) + sizeof(sljit_ins))) >> 2; addr = (sljit_sw)(addr - ((sljit_uw)SLJIT_ADD_EXE C_OFFSET(buf_ptr, executable_offset) + sizeof(sljit_ins))) >> 2;
skipping to change at line 501 skipping to change at line 641
buf_ptr[0] = (buf_ptr[0] & 0xffff0000) | ((addr > > 48) & 0xffff); buf_ptr[0] = (buf_ptr[0] & 0xffff0000) | ((addr > > 48) & 0xffff);
buf_ptr[1] = (buf_ptr[1] & 0xffff0000) | ((addr > > 32) & 0xffff); buf_ptr[1] = (buf_ptr[1] & 0xffff0000) | ((addr > > 32) & 0xffff);
buf_ptr[3] = (buf_ptr[3] & 0xffff0000) | ((addr > > 16) & 0xffff); buf_ptr[3] = (buf_ptr[3] & 0xffff0000) | ((addr > > 16) & 0xffff);
buf_ptr[5] = (buf_ptr[5] & 0xffff0000) | (addr & 0xffff); buf_ptr[5] = (buf_ptr[5] & 0xffff0000) | (addr & 0xffff);
} }
#endif #endif
} while (0); } while (0);
jump = jump->next; jump = jump->next;
} }
put_label = compiler->put_labels;
while (put_label) {
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
addr = put_label->label->addr;
buf_ptr = (sljit_ins *)put_label->addr;
SLJIT_ASSERT((buf_ptr[0] & 0xffe00000) == LUI && (buf_ptr[1] & 0x
fc000000) == ORI);
buf_ptr[0] |= (addr >> 16) & 0xffff;
buf_ptr[1] |= addr & 0xffff;
#else
put_label_set(put_label);
#endif
put_label = put_label->next;
}
compiler->error = SLJIT_ERR_COMPILED; compiler->error = SLJIT_ERR_COMPILED;
compiler->executable_offset = executable_offset; compiler->executable_offset = executable_offset;
compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins); compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins);
code = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code, executable_offset); code = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code, executable_offset);
code_ptr = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset ); code_ptr = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset );
#ifndef __GNUC__ #ifndef __GNUC__
SLJIT_CACHE_FLUSH(code, code_ptr); SLJIT_CACHE_FLUSH(code, code_ptr);
#else #else
skipping to change at line 1078 skipping to change at line 1233
CHECK(check_sljit_emit_op0(compiler, op)); CHECK(check_sljit_emit_op0(compiler, op));
op = GET_OPCODE(op); op = GET_OPCODE(op);
switch (op) { switch (op) {
case SLJIT_BREAKPOINT: case SLJIT_BREAKPOINT:
return push_inst(compiler, BREAK, UNMOVABLE_INS); return push_inst(compiler, BREAK, UNMOVABLE_INS);
case SLJIT_NOP: case SLJIT_NOP:
return push_inst(compiler, NOP, UNMOVABLE_INS); return push_inst(compiler, NOP, UNMOVABLE_INS);
case SLJIT_LMUL_UW: case SLJIT_LMUL_UW:
case SLJIT_LMUL_SW: case SLJIT_LMUL_SW:
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? DMULU : DMUL)
| S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG3), DR(TMP_REG3)));
FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? DMUHU : DMUH)
| S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG1), DR(TMP_REG1)));
#else /* !SLJIT_CONFIG_MIPS_64 */
FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? MULU : MUL) |
S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG3), DR(TMP_REG3)));
FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? MUHU : MUH) |
S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG1), DR(TMP_REG1)));
#endif /* SLJIT_CONFIG_MIPS_64 */
FAIL_IF(push_inst(compiler, ADDU_W | S(TMP_REG3) | TA(0) | D(SLJI
T_R0), DR(SLJIT_R0)));
return push_inst(compiler, ADDU_W | S(TMP_REG1) | TA(0) | D(SLJIT
_R1), DR(SLJIT_R1));
#else /* !SLJIT_MIPS_R6 */
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? DMULTU : DMULT ) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS)); FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? DMULTU : DMULT ) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
#else #else /* !SLJIT_CONFIG_MIPS_64 */
FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? MULTU : MULT) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS)); FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? MULTU : MULT) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
#endif #endif /* SLJIT_CONFIG_MIPS_64 */
FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0))); FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0)));
return push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1)); return push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1));
#endif /* SLJIT_MIPS_R6 */
case SLJIT_DIVMOD_UW: case SLJIT_DIVMOD_UW:
case SLJIT_DIVMOD_SW: case SLJIT_DIVMOD_SW:
case SLJIT_DIV_UW: case SLJIT_DIV_UW:
case SLJIT_DIV_SW: case SLJIT_DIV_SW:
SLJIT_COMPILE_ASSERT((SLJIT_DIVMOD_UW & 0x2) == 0 && SLJIT_DIV_UW - 0x2 == SLJIT_DIVMOD_UW, bad_div_opcode_assignments); SLJIT_COMPILE_ASSERT((SLJIT_DIVMOD_UW & 0x2) == 0 && SLJIT_DIV_UW - 0x2 == SLJIT_DIVMOD_UW, bad_div_opcode_assignments);
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
if (int_op) {
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ?
DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG3), DR(TMP_REG3)));
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ?
MODU : MOD) | S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG1), DR(TMP_REG1)));
}
else {
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ?
DDIVU : DDIV) | S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG3), DR(TMP_REG3)));
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ?
DMODU : DMOD) | S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG1), DR(TMP_REG1)));
}
#else /* !SLJIT_CONFIG_MIPS_64 */
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU :
DIV) | S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG3), DR(TMP_REG3)));
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? MODU :
MOD) | S(SLJIT_R0) | T(SLJIT_R1) | D(TMP_REG1), DR(TMP_REG1)));
#endif /* SLJIT_CONFIG_MIPS_64 */
FAIL_IF(push_inst(compiler, ADDU_W | S(TMP_REG3) | TA(0) | D(SLJI
T_R0), DR(SLJIT_R0)));
return (op >= SLJIT_DIV_UW) ? SLJIT_SUCCESS : push_inst(compiler,
ADDU_W | S(TMP_REG1) | TA(0) | D(SLJIT_R1), DR(SLJIT_R1));
#else /* !SLJIT_MIPS_R6 */
#if !(defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) #if !(defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS)); FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS)); FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
#endif #endif /* !SLJIT_MIPS_R1 */
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
if (int_op) if (int_op)
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS)); FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
else else
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DDIVU : DDIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS)); FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DDIVU : DDIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
#else #else /* !SLJIT_CONFIG_MIPS_64 */
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS)); FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
#endif #endif /* SLJIT_CONFIG_MIPS_64 */
FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0))); FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0)));
return (op >= SLJIT_DIV_UW) ? SLJIT_SUCCESS : push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1)); return (op >= SLJIT_DIV_UW) ? SLJIT_SUCCESS : push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1));
#endif /* SLJIT_MIPS_R6 */
} }
return SLJIT_SUCCESS; return SLJIT_SUCCESS;
} }
#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) #if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
static sljit_s32 emit_prefetch(struct sljit_compiler *compiler, static sljit_s32 emit_prefetch(struct sljit_compiler *compiler,
sljit_s32 src, sljit_sw srcw) sljit_s32 src, sljit_sw srcw)
{ {
if (!(src & OFFS_REG_MASK)) { if (!(src & OFFS_REG_MASK)) {
skipping to change at line 1411 skipping to change at line 1594
break; break;
case SLJIT_GREATER_F64: case SLJIT_GREATER_F64:
case SLJIT_LESS_EQUAL_F64: case SLJIT_LESS_EQUAL_F64:
inst = C_ULE_S; inst = C_ULE_S;
break; break;
default: default:
SLJIT_ASSERT(GET_FLAG_TYPE(op) == SLJIT_UNORDERED_F64 || GET_FLAG _TYPE(op) == SLJIT_ORDERED_F64); SLJIT_ASSERT(GET_FLAG_TYPE(op) == SLJIT_UNORDERED_F64 || GET_FLAG _TYPE(op) == SLJIT_ORDERED_F64);
inst = C_UN_S; inst = C_UN_S;
break; break;
} }
return push_inst(compiler, inst | FMT(op) | FT(src2) | FS(src1) | C_FD, U
return push_inst(compiler, inst | FMT(op) | FT(src2) | FS(src1), UNMOVABL NMOVABLE_INS);
E_INS);
} }
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil er, sljit_s32 op, SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil er, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw, sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw) sljit_s32 src, sljit_sw srcw)
{ {
sljit_s32 dst_r; sljit_s32 dst_r;
CHECK_ERROR(); CHECK_ERROR();
compiler->cache_arg = 0; compiler->cache_arg = 0;
skipping to change at line 1611 skipping to change at line 1793
#define BR_Z(src) \ #define BR_Z(src) \
inst = BEQ | SA(src) | TA(0) | JUMP_LENGTH; \ inst = BEQ | SA(src) | TA(0) | JUMP_LENGTH; \
flags = IS_BIT26_COND; \ flags = IS_BIT26_COND; \
delay_check = src; delay_check = src;
#define BR_NZ(src) \ #define BR_NZ(src) \
inst = BNE | SA(src) | TA(0) | JUMP_LENGTH; \ inst = BNE | SA(src) | TA(0) | JUMP_LENGTH; \
flags = IS_BIT26_COND; \ flags = IS_BIT26_COND; \
delay_check = src; delay_check = src;
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
#define BR_T() \
inst = BC1NEZ; \
flags = IS_BIT23_COND; \
delay_check = FCSR_FCC;
#define BR_F() \
inst = BC1EQZ; \
flags = IS_BIT23_COND; \
delay_check = FCSR_FCC;
#else /* !SLJIT_MIPS_R6 */
#define BR_T() \ #define BR_T() \
inst = BC1T | JUMP_LENGTH; \ inst = BC1T | JUMP_LENGTH; \
flags = IS_BIT16_COND; \ flags = IS_BIT16_COND; \
delay_check = FCSR_FCC; delay_check = FCSR_FCC;
#define BR_F() \ #define BR_F() \
inst = BC1F | JUMP_LENGTH; \ inst = BC1F | JUMP_LENGTH; \
flags = IS_BIT16_COND; \ flags = IS_BIT16_COND; \
delay_check = FCSR_FCC; delay_check = FCSR_FCC;
#endif /* SLJIT_MIPS_R6 */
SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile r *compiler, sljit_s32 type) SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile r *compiler, sljit_s32 type)
{ {
struct sljit_jump *jump; struct sljit_jump *jump;
sljit_ins inst; sljit_ins inst;
sljit_s32 flags = 0; sljit_s32 flags = 0;
sljit_s32 delay_check = UNMOVABLE_INS; sljit_s32 delay_check = UNMOVABLE_INS;
CHECK_ERROR_PTR(); CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_jump(compiler, type)); CHECK_PTR(check_sljit_emit_jump(compiler, type));
skipping to change at line 1930 skipping to change at line 2126
break; break;
case SLJIT_GREATER_F64: case SLJIT_GREATER_F64:
case SLJIT_LESS_EQUAL_F64: case SLJIT_LESS_EQUAL_F64:
type ^= 0x1; /* Flip type bit for the XORI below. */ type ^= 0x1; /* Flip type bit for the XORI below. */
case SLJIT_EQUAL_F64: case SLJIT_EQUAL_F64:
case SLJIT_NOT_EQUAL_F64: case SLJIT_NOT_EQUAL_F64:
case SLJIT_LESS_F64: case SLJIT_LESS_F64:
case SLJIT_GREATER_EQUAL_F64: case SLJIT_GREATER_EQUAL_F64:
case SLJIT_UNORDERED_F64: case SLJIT_UNORDERED_F64:
case SLJIT_ORDERED_F64: case SLJIT_ORDERED_F64:
#if (defined SLJIT_MIPS_R6 && SLJIT_MIPS_R6)
FAIL_IF(push_inst(compiler, MFC1 | TA(dst_ar) | FS(TMP_FREG3), ds
t_ar));
#else /* !SLJIT_MIPS_R6 */
FAIL_IF(push_inst(compiler, CFC1 | TA(dst_ar) | DA(FCSR_REG), dst _ar)); FAIL_IF(push_inst(compiler, CFC1 | TA(dst_ar) | DA(FCSR_REG), dst _ar));
#endif /* SLJIT_MIPS_R6 */
FAIL_IF(push_inst(compiler, SRL | TA(dst_ar) | DA(dst_ar) | SH_IM M(23), dst_ar)); FAIL_IF(push_inst(compiler, SRL | TA(dst_ar) | DA(dst_ar) | SH_IM M(23), dst_ar));
FAIL_IF(push_inst(compiler, ANDI | SA(dst_ar) | TA(dst_ar) | IMM( 1), dst_ar)); FAIL_IF(push_inst(compiler, ANDI | SA(dst_ar) | TA(dst_ar) | IMM( 1), dst_ar));
src_ar = dst_ar; src_ar = dst_ar;
break; break;
default: default:
src_ar = OTHER_FLAG; src_ar = OTHER_FLAG;
break; break;
} }
skipping to change at line 2042 skipping to change at line 2242
return push_inst(compiler, ins | S(src) | D(dst_reg), DR(dst_reg)); return push_inst(compiler, ins | S(src) | D(dst_reg), DR(dst_reg));
#else #else
return sljit_emit_cmov_generic(compiler, type, dst_reg, src, srcw); return sljit_emit_cmov_generic(compiler, type, dst_reg, src, srcw);
#endif #endif
} }
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi ler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value) SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi ler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
{ {
struct sljit_const *const_; struct sljit_const *const_;
sljit_s32 reg; sljit_s32 dst_r;
CHECK_ERROR_PTR(); CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
ADJUST_LOCAL_OFFSET(dst, dstw); ADJUST_LOCAL_OFFSET(dst, dstw);
const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_c onst)); const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_c onst));
PTR_FAIL_IF(!const_); PTR_FAIL_IF(!const_);
set_const(const_, compiler); set_const(const_, compiler);
reg = FAST_IS_REG(dst) ? dst : TMP_REG2; dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
PTR_FAIL_IF(emit_const(compiler, dst_r, init_value));
PTR_FAIL_IF(emit_const(compiler, reg, init_value));
if (dst & SLJIT_MEM) if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TM P_REG1, 0, TMP_REG2, 0)); PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TM P_REG1, 0, TMP_REG2, 0));
return const_; return const_;
} }
SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct slj
it_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
{
struct sljit_put_label *put_label;
sljit_s32 dst_r;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw));
ADJUST_LOCAL_OFFSET(dst, dstw);
put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct
sljit_put_label));
PTR_FAIL_IF(!put_label);
set_put_label(put_label, compiler, 0);
dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
PTR_FAIL_IF(emit_const(compiler, dst_r, 0));
#else
PTR_FAIL_IF(push_inst(compiler, dst_r, UNMOVABLE_INS));
compiler->size += 5;
#endif
if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TM
P_REG1, 0, TMP_REG2, 0));
return put_label;
}
 End of changes. 56 change blocks. 
49 lines changed or deleted 273 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)