OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 } else { | 1550 } else { |
1551 // Be careful to always use shifted_branch_offset only just before the | 1551 // Be careful to always use shifted_branch_offset only just before the |
1552 // branch instruction, as the location will be remember for patching the | 1552 // branch instruction, as the location will be remember for patching the |
1553 // target. | 1553 // target. |
1554 switch (cond) { | 1554 switch (cond) { |
1555 case cc_always: | 1555 case cc_always: |
1556 offset = shifted_branch_offset(L, false); | 1556 offset = shifted_branch_offset(L, false); |
1557 b(offset); | 1557 b(offset); |
1558 break; | 1558 break; |
1559 case eq: | 1559 case eq: |
| 1560 ASSERT(!scratch.is(rs)); |
1560 r2 = scratch; | 1561 r2 = scratch; |
1561 li(r2, rt); | 1562 li(r2, rt); |
1562 offset = shifted_branch_offset(L, false); | 1563 offset = shifted_branch_offset(L, false); |
1563 beq(rs, r2, offset); | 1564 beq(rs, r2, offset); |
1564 break; | 1565 break; |
1565 case ne: | 1566 case ne: |
| 1567 ASSERT(!scratch.is(rs)); |
1566 r2 = scratch; | 1568 r2 = scratch; |
1567 li(r2, rt); | 1569 li(r2, rt); |
1568 offset = shifted_branch_offset(L, false); | 1570 offset = shifted_branch_offset(L, false); |
1569 bne(rs, r2, offset); | 1571 bne(rs, r2, offset); |
1570 break; | 1572 break; |
1571 // Signed comparison. | 1573 // Signed comparison. |
1572 case greater: | 1574 case greater: |
1573 if (rt.imm32_ == 0) { | 1575 if (rt.imm32_ == 0) { |
1574 offset = shifted_branch_offset(L, false); | 1576 offset = shifted_branch_offset(L, false); |
1575 bgtz(rs, offset); | 1577 bgtz(rs, offset); |
1576 } else { | 1578 } else { |
| 1579 ASSERT(!scratch.is(rs)); |
1577 r2 = scratch; | 1580 r2 = scratch; |
1578 li(r2, rt); | 1581 li(r2, rt); |
1579 slt(scratch, r2, rs); | 1582 slt(scratch, r2, rs); |
1580 offset = shifted_branch_offset(L, false); | 1583 offset = shifted_branch_offset(L, false); |
1581 bne(scratch, zero_reg, offset); | 1584 bne(scratch, zero_reg, offset); |
1582 } | 1585 } |
1583 break; | 1586 break; |
1584 case greater_equal: | 1587 case greater_equal: |
1585 if (rt.imm32_ == 0) { | 1588 if (rt.imm32_ == 0) { |
1586 offset = shifted_branch_offset(L, false); | 1589 offset = shifted_branch_offset(L, false); |
1587 bgez(rs, offset); | 1590 bgez(rs, offset); |
1588 } else if (is_int16(rt.imm32_)) { | 1591 } else if (is_int16(rt.imm32_)) { |
1589 slti(scratch, rs, rt.imm32_); | 1592 slti(scratch, rs, rt.imm32_); |
1590 offset = shifted_branch_offset(L, false); | 1593 offset = shifted_branch_offset(L, false); |
1591 beq(scratch, zero_reg, offset); | 1594 beq(scratch, zero_reg, offset); |
1592 } else { | 1595 } else { |
| 1596 ASSERT(!scratch.is(rs)); |
1593 r2 = scratch; | 1597 r2 = scratch; |
1594 li(r2, rt); | 1598 li(r2, rt); |
1595 slt(scratch, rs, r2); | 1599 slt(scratch, rs, r2); |
1596 offset = shifted_branch_offset(L, false); | 1600 offset = shifted_branch_offset(L, false); |
1597 beq(scratch, zero_reg, offset); | 1601 beq(scratch, zero_reg, offset); |
1598 } | 1602 } |
1599 break; | 1603 break; |
1600 case less: | 1604 case less: |
1601 if (rt.imm32_ == 0) { | 1605 if (rt.imm32_ == 0) { |
1602 offset = shifted_branch_offset(L, false); | 1606 offset = shifted_branch_offset(L, false); |
1603 bltz(rs, offset); | 1607 bltz(rs, offset); |
1604 } else if (is_int16(rt.imm32_)) { | 1608 } else if (is_int16(rt.imm32_)) { |
1605 slti(scratch, rs, rt.imm32_); | 1609 slti(scratch, rs, rt.imm32_); |
1606 offset = shifted_branch_offset(L, false); | 1610 offset = shifted_branch_offset(L, false); |
1607 bne(scratch, zero_reg, offset); | 1611 bne(scratch, zero_reg, offset); |
1608 } else { | 1612 } else { |
| 1613 ASSERT(!scratch.is(rs)); |
1609 r2 = scratch; | 1614 r2 = scratch; |
1610 li(r2, rt); | 1615 li(r2, rt); |
1611 slt(scratch, rs, r2); | 1616 slt(scratch, rs, r2); |
1612 offset = shifted_branch_offset(L, false); | 1617 offset = shifted_branch_offset(L, false); |
1613 bne(scratch, zero_reg, offset); | 1618 bne(scratch, zero_reg, offset); |
1614 } | 1619 } |
1615 break; | 1620 break; |
1616 case less_equal: | 1621 case less_equal: |
1617 if (rt.imm32_ == 0) { | 1622 if (rt.imm32_ == 0) { |
1618 offset = shifted_branch_offset(L, false); | 1623 offset = shifted_branch_offset(L, false); |
1619 blez(rs, offset); | 1624 blez(rs, offset); |
1620 } else { | 1625 } else { |
| 1626 ASSERT(!scratch.is(rs)); |
1621 r2 = scratch; | 1627 r2 = scratch; |
1622 li(r2, rt); | 1628 li(r2, rt); |
1623 slt(scratch, r2, rs); | 1629 slt(scratch, r2, rs); |
1624 offset = shifted_branch_offset(L, false); | 1630 offset = shifted_branch_offset(L, false); |
1625 beq(scratch, zero_reg, offset); | 1631 beq(scratch, zero_reg, offset); |
1626 } | 1632 } |
1627 break; | 1633 break; |
1628 // Unsigned comparison. | 1634 // Unsigned comparison. |
1629 case Ugreater: | 1635 case Ugreater: |
1630 if (rt.imm32_ == 0) { | 1636 if (rt.imm32_ == 0) { |
1631 offset = shifted_branch_offset(L, false); | 1637 offset = shifted_branch_offset(L, false); |
1632 bgtz(rs, offset); | 1638 bgtz(rs, offset); |
1633 } else { | 1639 } else { |
| 1640 ASSERT(!scratch.is(rs)); |
1634 r2 = scratch; | 1641 r2 = scratch; |
1635 li(r2, rt); | 1642 li(r2, rt); |
1636 sltu(scratch, r2, rs); | 1643 sltu(scratch, r2, rs); |
1637 offset = shifted_branch_offset(L, false); | 1644 offset = shifted_branch_offset(L, false); |
1638 bne(scratch, zero_reg, offset); | 1645 bne(scratch, zero_reg, offset); |
1639 } | 1646 } |
1640 break; | 1647 break; |
1641 case Ugreater_equal: | 1648 case Ugreater_equal: |
1642 if (rt.imm32_ == 0) { | 1649 if (rt.imm32_ == 0) { |
1643 offset = shifted_branch_offset(L, false); | 1650 offset = shifted_branch_offset(L, false); |
1644 bgez(rs, offset); | 1651 bgez(rs, offset); |
1645 } else if (is_int16(rt.imm32_)) { | 1652 } else if (is_int16(rt.imm32_)) { |
1646 sltiu(scratch, rs, rt.imm32_); | 1653 sltiu(scratch, rs, rt.imm32_); |
1647 offset = shifted_branch_offset(L, false); | 1654 offset = shifted_branch_offset(L, false); |
1648 beq(scratch, zero_reg, offset); | 1655 beq(scratch, zero_reg, offset); |
1649 } else { | 1656 } else { |
| 1657 ASSERT(!scratch.is(rs)); |
1650 r2 = scratch; | 1658 r2 = scratch; |
1651 li(r2, rt); | 1659 li(r2, rt); |
1652 sltu(scratch, rs, r2); | 1660 sltu(scratch, rs, r2); |
1653 offset = shifted_branch_offset(L, false); | 1661 offset = shifted_branch_offset(L, false); |
1654 beq(scratch, zero_reg, offset); | 1662 beq(scratch, zero_reg, offset); |
1655 } | 1663 } |
1656 break; | 1664 break; |
1657 case Uless: | 1665 case Uless: |
1658 if (rt.imm32_ == 0) { | 1666 if (rt.imm32_ == 0) { |
1659 // No code needs to be emitted. | 1667 // No code needs to be emitted. |
1660 return; | 1668 return; |
1661 } else if (is_int16(rt.imm32_)) { | 1669 } else if (is_int16(rt.imm32_)) { |
1662 sltiu(scratch, rs, rt.imm32_); | 1670 sltiu(scratch, rs, rt.imm32_); |
1663 offset = shifted_branch_offset(L, false); | 1671 offset = shifted_branch_offset(L, false); |
1664 bne(scratch, zero_reg, offset); | 1672 bne(scratch, zero_reg, offset); |
1665 } else { | 1673 } else { |
| 1674 ASSERT(!scratch.is(rs)); |
1666 r2 = scratch; | 1675 r2 = scratch; |
1667 li(r2, rt); | 1676 li(r2, rt); |
1668 sltu(scratch, rs, r2); | 1677 sltu(scratch, rs, r2); |
1669 offset = shifted_branch_offset(L, false); | 1678 offset = shifted_branch_offset(L, false); |
1670 bne(scratch, zero_reg, offset); | 1679 bne(scratch, zero_reg, offset); |
1671 } | 1680 } |
1672 break; | 1681 break; |
1673 case Uless_equal: | 1682 case Uless_equal: |
1674 if (rt.imm32_ == 0) { | 1683 if (rt.imm32_ == 0) { |
1675 offset = shifted_branch_offset(L, false); | 1684 offset = shifted_branch_offset(L, false); |
1676 b(offset); | 1685 b(offset); |
1677 } else { | 1686 } else { |
| 1687 ASSERT(!scratch.is(rs)); |
1678 r2 = scratch; | 1688 r2 = scratch; |
1679 li(r2, rt); | 1689 li(r2, rt); |
1680 sltu(scratch, r2, rs); | 1690 sltu(scratch, r2, rs); |
1681 offset = shifted_branch_offset(L, false); | 1691 offset = shifted_branch_offset(L, false); |
1682 beq(scratch, zero_reg, offset); | 1692 beq(scratch, zero_reg, offset); |
1683 } | 1693 } |
1684 break; | 1694 break; |
1685 default: | 1695 default: |
1686 UNREACHABLE(); | 1696 UNREACHABLE(); |
1687 } | 1697 } |
(...skipping 2607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4295 opcode == BGTZL); | 4305 opcode == BGTZL); |
4296 opcode = (cond == eq) ? BEQ : BNE; | 4306 opcode = (cond == eq) ? BEQ : BNE; |
4297 instr = (instr & ~kOpcodeMask) | opcode; | 4307 instr = (instr & ~kOpcodeMask) | opcode; |
4298 masm_.emit(instr); | 4308 masm_.emit(instr); |
4299 } | 4309 } |
4300 | 4310 |
4301 | 4311 |
4302 } } // namespace v8::internal | 4312 } } // namespace v8::internal |
4303 | 4313 |
4304 #endif // V8_TARGET_ARCH_MIPS | 4314 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |