Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

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

Issue 2778203002: MIPS[64]: Support for some SIMD operations (4) (Closed)
Patch Set: rebased Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« 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 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 i.InputSimd128Register(1)); 1760 i.InputSimd128Register(1));
1761 break; 1761 break;
1762 } 1762 }
1763 case kMipsS32x4Select: { 1763 case kMipsS32x4Select: {
1764 CpuFeatureScope msa_scope(masm(), MIPS_SIMD); 1764 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1765 DCHECK(i.OutputSimd128Register().is(i.InputSimd128Register(0))); 1765 DCHECK(i.OutputSimd128Register().is(i.InputSimd128Register(0)));
1766 __ bsel_v(i.OutputSimd128Register(), i.InputSimd128Register(2), 1766 __ bsel_v(i.OutputSimd128Register(), i.InputSimd128Register(2),
1767 i.InputSimd128Register(1)); 1767 i.InputSimd128Register(1));
1768 break; 1768 break;
1769 } 1769 }
1770 case kMipsF32x4Abs: {
1771 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1772 __ bclri_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31);
1773 break;
1774 }
1775 case kMipsF32x4Neg: {
1776 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1777 __ bnegi_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31);
1778 break;
1779 }
1780 case kMipsF32x4RecipApprox: {
1781 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1782 __ frcp_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
1783 break;
1784 }
1785 case kMipsF32x4RecipRefine: {
1786 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1787 Simd128Register dst = i.OutputSimd128Register();
1788 // Emulate with 2.0f - a * b
1789 __ ldi_w(kSimd128ScratchReg, 2);
1790 __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg);
1791 __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1));
1792 __ fsub_w(dst, kSimd128ScratchReg, dst);
1793 break;
1794 }
1795 case kMipsF32x4RecipSqrtApprox: {
1796 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1797 __ frsqrt_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
1798 break;
1799 }
1800 case kMipsF32x4RecipSqrtRefine: {
1801 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1802 Simd128Register dst = i.OutputSimd128Register();
1803 // Emulate with (3.0f - a * b) * 0.5f;
1804 __ ldi_w(kSimd128ScratchReg, 3);
1805 __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg);
1806 __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1));
1807 __ fsub_w(dst, kSimd128ScratchReg, dst);
1808 __ ldi_w(kSimd128ScratchReg, 0x3f);
1809 __ slli_w(kSimd128ScratchReg, kSimd128ScratchReg, 24);
1810 __ fmul_w(dst, dst, kSimd128ScratchReg);
1811 break;
1812 }
1813 case kMipsF32x4Add: {
1814 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1815 __ fadd_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1816 i.InputSimd128Register(1));
1817 break;
1818 }
1819 case kMipsF32x4Sub: {
1820 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1821 __ fsub_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1822 i.InputSimd128Register(1));
1823 break;
1824 }
1825 case kMipsF32x4Mul: {
1826 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1827 __ fmul_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1828 i.InputSimd128Register(1));
1829 break;
1830 }
1831 case kMipsF32x4Max: {
1832 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1833 __ fmax_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1834 i.InputSimd128Register(1));
1835 break;
1836 }
1837 case kMipsF32x4Min: {
1838 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1839 __ fmin_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1840 i.InputSimd128Register(1));
1841 break;
1842 }
1843 case kMipsF32x4Eq: {
1844 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1845 __ fceq_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1846 i.InputSimd128Register(1));
1847 break;
1848 }
1849 case kMipsF32x4Ne: {
1850 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1851 __ fcne_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1852 i.InputSimd128Register(1));
1853 break;
1854 }
1855 case kMipsF32x4Lt: {
1856 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1857 __ fclt_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1858 i.InputSimd128Register(1));
1859 break;
1860 }
1861 case kMipsF32x4Le: {
1862 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1863 __ fcle_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1864 i.InputSimd128Register(1));
1865 break;
1866 }
1867 case kMipsI32x4SConvertF32x4: {
1868 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1869 __ ftrunc_s_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
1870 break;
1871 }
1872 case kMipsI32x4UConvertF32x4: {
1873 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1874 __ ftrunc_u_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
1875 break;
1876 }
1770 } 1877 }
1771 return kSuccess; 1878 return kSuccess;
1772 } // NOLINT(readability/fn_size) 1879 } // NOLINT(readability/fn_size)
1773 1880
1774 1881
1775 #define UNSUPPORTED_COND(opcode, condition) \ 1882 #define UNSUPPORTED_COND(opcode, condition) \
1776 OFStream out(stdout); \ 1883 OFStream out(stdout); \
1777 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \ 1884 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \
1778 UNIMPLEMENTED(); 1885 UNIMPLEMENTED();
1779 1886
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 padding_size -= v8::internal::Assembler::kInstrSize; 2663 padding_size -= v8::internal::Assembler::kInstrSize;
2557 } 2664 }
2558 } 2665 }
2559 } 2666 }
2560 2667
2561 #undef __ 2668 #undef __
2562 2669
2563 } // namespace compiler 2670 } // namespace compiler
2564 } // namespace internal 2671 } // namespace internal
2565 } // namespace v8 2672 } // 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
This is Rietveld 408576698