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

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

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

revision 860 by zherczeg, Mon Jan 9 20:12:58 2012 UTC revision 867 by zherczeg, Fri Jan 13 13:34:07 2012 UTC
# Line 109  typedef sljit_ui sljit_ins; Line 109  typedef sljit_ui sljit_ins;
109  #define BREAK           (HI(0) | LO(13))  #define BREAK           (HI(0) | LO(13))
110  #define C_UN_D          (HI(17) | FMT_D | LO(49))  #define C_UN_D          (HI(17) | FMT_D | LO(49))
111  #define C_UEQ_D         (HI(17) | FMT_D | LO(51))  #define C_UEQ_D         (HI(17) | FMT_D | LO(51))
112    #define C_ULE_D         (HI(17) | FMT_D | LO(55))
113  #define C_ULT_D         (HI(17) | FMT_D | LO(53))  #define C_ULT_D         (HI(17) | FMT_D | LO(53))
114  #define DIV             (HI(0) | LO(26))  #define DIV             (HI(0) | LO(26))
115  #define DIVU            (HI(0) | LO(27))  #define DIVU            (HI(0) | LO(27))
# Line 1588  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1589  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1589  #undef RESOLVE_IMM1  #undef RESOLVE_IMM1
1590  #undef RESOLVE_IMM2  #undef RESOLVE_IMM2
1591    
1592    SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, int type,
1593            int src1, sljit_w src1w,
1594            int src2, sljit_w src2w)
1595    {
1596            struct sljit_jump *jump;
1597            sljit_ins inst;
1598            int if_true;
1599    
1600            CHECK_ERROR_PTR();
1601            check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);
1602    
1603            compiler->cache_arg = 0;
1604            compiler->cache_argw = 0;
1605    
1606            if (src1 > SLJIT_FLOAT_REG4) {
1607                    PTR_FAIL_IF(emit_fpu_data_transfer(compiler, TMP_FREG1, 1, src1, src1w));
1608                    src1 = TMP_FREG1;
1609            }
1610            if (src2 > SLJIT_FLOAT_REG4) {
1611                    PTR_FAIL_IF(emit_fpu_data_transfer(compiler, TMP_FREG2, 1, src2, src2w));
1612                    src2 = TMP_FREG2;
1613            }
1614    
1615            jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
1616            PTR_FAIL_IF(!jump);
1617            set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP);
1618            jump->flags |= IS_BIT16_COND;
1619            type &= 0xff;
1620    
1621            switch (type) {
1622            case SLJIT_C_FLOAT_EQUAL:
1623                    inst = C_UEQ_D;
1624                    if_true = 1;
1625                    break;
1626            case SLJIT_C_FLOAT_NOT_EQUAL:
1627                    inst = C_UEQ_D;
1628                    if_true = 0;
1629                    break;
1630            case SLJIT_C_FLOAT_LESS:
1631                    inst = C_ULT_D;
1632                    if_true = 1;
1633                    break;
1634            case SLJIT_C_FLOAT_GREATER_EQUAL:
1635                    inst = C_ULT_D;
1636                    if_true = 0;
1637                    break;
1638            case SLJIT_C_FLOAT_GREATER:
1639                    inst = C_ULE_D;
1640                    if_true = 0;
1641                    break;
1642            case SLJIT_C_FLOAT_LESS_EQUAL:
1643                    inst = C_ULE_D;
1644                    if_true = 1;
1645                    break;
1646            case SLJIT_C_FLOAT_NAN:
1647                    inst = C_UN_D;
1648                    if_true = 1;
1649                    break;
1650            case SLJIT_C_FLOAT_NOT_NAN:
1651            default: /* Make compilers happy. */
1652                    inst = C_UN_D;
1653                    if_true = 0;
1654                    break;
1655            }
1656    
1657            PTR_FAIL_IF(push_inst(compiler, inst | FT(src2) | FS(src1), UNMOVABLE_INS));
1658            /* Intentionally the other opcode. */
1659            PTR_FAIL_IF(push_inst(compiler, (if_true ? BC1F : BC1T) | JUMP_LENGTH, UNMOVABLE_INS));
1660            PTR_FAIL_IF(emit_const(compiler, TMP_REG2, 0));
1661            PTR_FAIL_IF(push_inst(compiler, JR | S(TMP_REG2), UNMOVABLE_INS));
1662            jump->addr = compiler->size;
1663            PTR_FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
1664            return jump;
1665    }
1666    
1667  #undef JUMP_LENGTH  #undef JUMP_LENGTH
1668  #undef BR_Z  #undef BR_Z
1669  #undef BR_NZ  #undef BR_NZ

Legend:
Removed from v.860  
changed lines
  Added in v.867

  ViewVC Help
Powered by ViewVC 1.1.5