Chromium Code Reviews

Side by Side Diff: src/compiler/mips/code-generator-mips.cc

Issue 2778203002: MIPS[64]: Support for some SIMD operations (4) (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/mips/instruction-codes-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 #include "src/compilation-info.h" 6 #include "src/compilation-info.h"
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/osr.h" 10 #include "src/compiler/osr.h"
(...skipping 1584 matching lines...)
1595 case kAtomicExchangeInt16: 1595 case kAtomicExchangeInt16:
1596 case kAtomicExchangeUint16: 1596 case kAtomicExchangeUint16:
1597 case kAtomicExchangeWord32: 1597 case kAtomicExchangeWord32:
1598 case kAtomicCompareExchangeInt8: 1598 case kAtomicCompareExchangeInt8:
1599 case kAtomicCompareExchangeUint8: 1599 case kAtomicCompareExchangeUint8:
1600 case kAtomicCompareExchangeInt16: 1600 case kAtomicCompareExchangeInt16:
1601 case kAtomicCompareExchangeUint16: 1601 case kAtomicCompareExchangeUint16:
1602 case kAtomicCompareExchangeWord32: 1602 case kAtomicCompareExchangeWord32:
1603 UNREACHABLE(); 1603 UNREACHABLE();
1604 break; 1604 break;
1605 case kMipsFloat32x4Abs: {
1606 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1607 __ bclri_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31);
1608 break;
1609 }
1610 case kMipsFloat32x4Neg: {
1611 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1612 __ bnegi_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31);
1613 break;
1614 }
1615 case kMipsFloat32x4RecipApprox: {
1616 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1617 __ frcp_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
1618 break;
1619 }
1620 case kMipsFloat32x4RecipRefine: {
1621 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1622 Simd128Register dst = i.OutputSimd128Register();
1623 // Emulate with 2.0f - a * b
1624 __ ldi_w(kSimd128ScratchReg, 2);
1625 __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg);
1626 __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1));
1627 __ fsub_w(dst, kSimd128ScratchReg, dst);
bbudge 2017/03/28 17:21:40 I didn't realize until now that only ARM has refin
dusan.simicic 2017/03/29 12:19:33 From MIPS perspective, it is better not to impleme
1628 break;
1629 }
1630 case kMipsFloat32x4RecipSqrtApprox: {
1631 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1632 __ frsqrt_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
1633 break;
1634 }
1635 case kMipsFloat32x4RecipSqrtRefine: {
1636 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1637 Simd128Register dst = i.OutputSimd128Register();
1638 // Emulate with (3.0f - a * b) * 0.5f;
1639 __ ldi_w(kSimd128ScratchReg, 3);
1640 __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg);
1641 __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1));
1642 __ fsub_w(dst, kSimd128ScratchReg, dst);
1643 __ ldi_w(kSimd128ScratchReg, 0x3f);
1644 __ slli_w(kSimd128ScratchReg, kSimd128ScratchReg, 24);
1645 __ fmul_w(dst, dst, kSimd128ScratchReg);
bbudge 2017/03/28 17:21:40 Same comment here, and for MIPS64.
1646 break;
1647 }
1648 case kMipsFloat32x4Add: {
1649 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1650 __ fadd_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1651 i.InputSimd128Register(1));
1652 break;
1653 }
1654 case kMipsFloat32x4Sub: {
1655 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1656 __ fsub_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1657 i.InputSimd128Register(1));
1658 break;
1659 }
1660 case kMipsFloat32x4Mul: {
1661 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1662 __ fmul_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1663 i.InputSimd128Register(1));
1664 break;
1665 }
1666 case kMipsFloat32x4Max: {
1667 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1668 __ fmax_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1669 i.InputSimd128Register(1));
1670 break;
1671 }
1672 case kMipsFloat32x4Min: {
1673 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1674 __ fmin_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1675 i.InputSimd128Register(1));
1676 break;
1677 }
1678 case kMipsFloat32xEqual: {
1679 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1680 __ fceq_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1681 i.InputSimd128Register(1));
1682 break;
1683 }
1684 case kMipsFloat32x4NotEqual: {
1685 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1686 __ fcne_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1687 i.InputSimd128Register(1));
1688 break;
1689 }
1690 case kMipsFloat32xLessThan: {
1691 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1692 __ fclt_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1693 i.InputSimd128Register(1));
1694 break;
1695 }
1696 case kMipsFloat32xLessThanOrEqual: {
1697 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1698 __ fcle_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1699 i.InputSimd128Register(1));
1700 break;
1701 }
1702 case kMipsInt32x4FromFloat32x4: {
1703 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1704 __ ftrunc_s_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
1705 break;
1706 }
1707 case kMipsUint32x4FromFloat32x4: {
1708 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1709 __ ftrunc_u_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
1710 break;
1711 }
1605 } 1712 }
1606 return kSuccess; 1713 return kSuccess;
1607 } // NOLINT(readability/fn_size) 1714 } // NOLINT(readability/fn_size)
1608 1715
1609 1716
1610 #define UNSUPPORTED_COND(opcode, condition) \ 1717 #define UNSUPPORTED_COND(opcode, condition) \
1611 OFStream out(stdout); \ 1718 OFStream out(stdout); \
1612 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \ 1719 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \
1613 UNIMPLEMENTED(); 1720 UNIMPLEMENTED();
1614 1721
(...skipping 776 matching lines...)
2391 padding_size -= v8::internal::Assembler::kInstrSize; 2498 padding_size -= v8::internal::Assembler::kInstrSize;
2392 } 2499 }
2393 } 2500 }
2394 } 2501 }
2395 2502
2396 #undef __ 2503 #undef __
2397 2504
2398 } // namespace compiler 2505 } // namespace compiler
2399 } // namespace internal 2506 } // namespace internal
2400 } // namespace v8 2507 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/mips/instruction-codes-mips.h » ('j') | no next file with comments »

Powered by Google App Engine