/[pcre]/code/trunk/sljit/sljitNativeMIPS_32.c
ViewVC logotype

Diff of /code/trunk/sljit/sljitNativeMIPS_32.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 662 by ph10, Mon Aug 22 14:35:22 2011 UTC revision 740 by zherczeg, Mon Oct 31 06:10:14 2011 UTC
# Line 256  static SLJIT_INLINE int emit_single_op(s Line 256  static SLJIT_INLINE int emit_single_op(s
256    
257          case SLJIT_MUL:          case SLJIT_MUL:
258                  SLJIT_ASSERT(!(flags & SRC2_IMM));                  SLJIT_ASSERT(!(flags & SRC2_IMM));
259                  if (!(op & SLJIT_SET_O))                  if (!(op & SLJIT_SET_O)) {
260    #if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64)
261                          return push_inst(compiler, MUL | S(src1) | T(src2) | D(dst), DR(dst));                          return push_inst(compiler, MUL | S(src1) | T(src2) | D(dst), DR(dst));
262    #else
263                            FAIL_IF(push_inst(compiler, MULT | S(src1) | T(src2), MOVABLE_INS));
264                            return push_inst(compiler, MFLO | D(dst), DR(dst));
265    #endif
266                    }
267                  FAIL_IF(push_inst(compiler, MULT | S(src1) | T(src2), MOVABLE_INS));                  FAIL_IF(push_inst(compiler, MULT | S(src1) | T(src2), MOVABLE_INS));
268                  FAIL_IF(push_inst(compiler, MFHI | DA(TMP_EREG1), TMP_EREG1));                  FAIL_IF(push_inst(compiler, MFHI | DA(TMP_EREG1), TMP_EREG1));
269                  FAIL_IF(push_inst(compiler, MFLO | D(dst), DR(dst)));                  FAIL_IF(push_inst(compiler, MFLO | D(dst), DR(dst)));
# Line 300  static SLJIT_INLINE int emit_single_op(s Line 306  static SLJIT_INLINE int emit_single_op(s
306          case SLJIT_MOV_SB:          case SLJIT_MOV_SB:
307                  SLJIT_ASSERT(src1 == TMP_REG1);                  SLJIT_ASSERT(src1 == TMP_REG1);
308                  if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {                  if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
309                          if (op == SLJIT_MOV_SB)                          if (op == SLJIT_MOV_SB) {
310    #if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64)
311                                  return push_inst(compiler, SEB | T(src2) | D(dst), DR(dst));                                  return push_inst(compiler, SEB | T(src2) | D(dst), DR(dst));
312    #else
313                                    FAIL_IF(push_inst(compiler, SLL | T(src2) | D(dst) | SH_IMM(24), DR(dst)));
314                                    return push_inst(compiler, SRA | T(dst) | D(dst) | SH_IMM(24), DR(dst));
315    #endif
316                            }
317                          return push_inst(compiler, ANDI | S(src2) | T(dst) | IMM(0xff), DR(dst));                          return push_inst(compiler, ANDI | S(src2) | T(dst) | IMM(0xff), DR(dst));
318                  }                  }
319                  else if (dst != src2)                  else if (dst != src2)
# Line 312  static SLJIT_INLINE int emit_single_op(s Line 324  static SLJIT_INLINE int emit_single_op(s
324          case SLJIT_MOV_SH:          case SLJIT_MOV_SH:
325                  SLJIT_ASSERT(src1 == TMP_REG1);                  SLJIT_ASSERT(src1 == TMP_REG1);
326                  if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {                  if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
327                          if (op == SLJIT_MOV_SH)                          if (op == SLJIT_MOV_SH) {
328    #if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64)
329                                  return push_inst(compiler, SEH | T(src2) | D(dst), DR(dst));                                  return push_inst(compiler, SEH | T(src2) | D(dst), DR(dst));
330    #else
331                                    FAIL_IF(push_inst(compiler, SLL | T(src2) | D(dst) | SH_IMM(16), DR(dst)));
332                                    return push_inst(compiler, SRA | T(dst) | D(dst) | SH_IMM(16), DR(dst));
333    #endif
334                            }
335                          return push_inst(compiler, ANDI | S(src2) | T(dst) | IMM(0xffff), DR(dst));                          return push_inst(compiler, ANDI | S(src2) | T(dst) | IMM(0xffff), DR(dst));
336                  }                  }
337                  else if (dst != src2)                  else if (dst != src2)
# Line 330  static SLJIT_INLINE int emit_single_op(s Line 348  static SLJIT_INLINE int emit_single_op(s
348    
349          case SLJIT_CLZ:          case SLJIT_CLZ:
350                  SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));                  SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
351    #if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64)
352                  if (op & SLJIT_SET_E)                  if (op & SLJIT_SET_E)
353                          FAIL_IF(push_inst(compiler, CLZ | S(src2) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));                          FAIL_IF(push_inst(compiler, CLZ | S(src2) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
354                  if (CHECK_FLAGS(SLJIT_SET_E))                  if (CHECK_FLAGS(SLJIT_SET_E))
355                          FAIL_IF(push_inst(compiler, CLZ | S(src2) | T(dst) | D(dst), DR(dst)));                          FAIL_IF(push_inst(compiler, CLZ | S(src2) | T(dst) | D(dst), DR(dst)));
356    #else
357                    if (SLJIT_UNLIKELY(flags & UNUSED_DEST)) {
358                            FAIL_IF(push_inst(compiler, SRL | T(src2) | DA(EQUAL_FLAG) | SH_IMM(31), EQUAL_FLAG));
359                            return push_inst(compiler, XORI | SA(EQUAL_FLAG) | TA(EQUAL_FLAG) | IMM(1), EQUAL_FLAG);
360                    }
361                    /* Nearly all instructions are unmovable in the following sequence. */
362                    FAIL_IF(push_inst(compiler, ADDU_W | S(src2) | TA(0) | D(TMP_REG1), DR(TMP_REG1)));
363                    /* Check zero. */
364                    FAIL_IF(push_inst(compiler, BEQ | S(TMP_REG1) | TA(0) | IMM(6), UNMOVABLE_INS));
365                    FAIL_IF(push_inst(compiler, ORI | SA(0) | T(dst) | IMM(32), UNMOVABLE_INS));
366                    /* Check sign bit. */
367                    FAIL_IF(push_inst(compiler, BLTZ | S(TMP_REG1) | IMM(4), UNMOVABLE_INS));
368                    FAIL_IF(push_inst(compiler, ORI | SA(0) | T(dst) | IMM(0), UNMOVABLE_INS));
369                    /* Loop for searching the highest bit. */
370                    FAIL_IF(push_inst(compiler, SLL | T(TMP_REG1) | D(TMP_REG1) | SH_IMM(1), DR(TMP_REG1)));
371                    FAIL_IF(push_inst(compiler, BGEZ | S(TMP_REG1) | IMM(-2), UNMOVABLE_INS));
372                    FAIL_IF(push_inst(compiler, ADDIU_W | S(dst) | T(dst) | IMM(1), UNMOVABLE_INS));
373                    if (op & SLJIT_SET_E)
374                            return push_inst(compiler, ADDU_W | S(dst) | TA(0) | DA(EQUAL_FLAG), EQUAL_FLAG);
375    #endif
376                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
377          }          }
378    
# Line 347  static SLJIT_INLINE int emit_const(struc Line 386  static SLJIT_INLINE int emit_const(struc
386          return push_inst(compiler, ORI | S(reg) | T(reg) | IMM(init_value), DR(reg));          return push_inst(compiler, ORI | S(reg) | T(reg) | IMM(init_value), DR(reg));
387  }  }
388    
389  void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_addr)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_addr)
390  {  {
391          sljit_ins *inst = (sljit_ins*)addr;          sljit_ins *inst = (sljit_ins*)addr;
392    
# Line 356  void sljit_set_jump_addr(sljit_uw addr, Line 395  void sljit_set_jump_addr(sljit_uw addr,
395          SLJIT_CACHE_FLUSH(inst, inst + 2);          SLJIT_CACHE_FLUSH(inst, inst + 2);
396  }  }
397    
398  void sljit_set_const(sljit_uw addr, sljit_w new_constant)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_w new_constant)
399  {  {
400          sljit_ins *inst = (sljit_ins*)addr;          sljit_ins *inst = (sljit_ins*)addr;
401    

Legend:
Removed from v.662  
changed lines
  Added in v.740

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12