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

Side by Side Diff: src/compiler/mips64/code-generator-mips64.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
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 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 __ addv_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 1964 __ addv_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1965 i.InputSimd128Register(1)); 1965 i.InputSimd128Register(1));
1966 break; 1966 break;
1967 } 1967 }
1968 case kMips64I32x4Sub: { 1968 case kMips64I32x4Sub: {
1969 CpuFeatureScope msa_scope(masm(), MIPS_SIMD); 1969 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1970 __ subv_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 1970 __ subv_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
1971 i.InputSimd128Register(1)); 1971 i.InputSimd128Register(1));
1972 break; 1972 break;
1973 } 1973 }
1974 case kMips64F32x4Abs: {
1975 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1976 __ bclri_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31);
1977 break;
1978 }
1979 case kMips64F32x4Neg: {
1980 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1981 __ bnegi_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31);
1982 break;
1983 }
1984 case kMips64F32x4RecipApprox: {
1985 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1986 __ frcp_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
1987 break;
1988 }
1989 case kMips64F32x4RecipRefine: {
1990 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
1991 Simd128Register dst = i.OutputSimd128Register();
1992 // Emulate with 2.0f - a * b
1993 __ ldi_w(kSimd128ScratchReg, 2);
1994 __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg);
1995 __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1));
1996 __ fsub_w(dst, kSimd128ScratchReg, dst);
1997 break;
1998 }
1999 case kMips64F32x4RecipSqrtApprox: {
2000 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2001 __ frsqrt_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
2002 break;
2003 }
2004 case kMips64F32x4RecipSqrtRefine: {
2005 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2006 Simd128Register dst = i.OutputSimd128Register();
2007 // Emulate with (3.0f - a * b) * 0.5f;
2008 __ ldi_w(kSimd128ScratchReg, 3);
2009 __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg);
2010 __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1));
2011 __ fsub_w(dst, kSimd128ScratchReg, dst);
2012 __ ldi_w(kSimd128ScratchReg, 0x3f);
2013 __ slli_w(kSimd128ScratchReg, kSimd128ScratchReg, 24);
2014 __ fmul_w(dst, dst, kSimd128ScratchReg);
2015 break;
2016 }
2017 case kMips64F32x4Add: {
2018 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2019 __ fadd_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2020 i.InputSimd128Register(1));
2021 break;
2022 }
2023 case kMips64F32x4Sub: {
2024 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2025 __ fsub_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2026 i.InputSimd128Register(1));
2027 break;
2028 }
2029 case kMips64F32x4Mul: {
2030 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2031 __ fmul_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2032 i.InputSimd128Register(1));
2033 break;
2034 }
2035 case kMips64F32x4Max: {
2036 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2037 __ fmax_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2038 i.InputSimd128Register(1));
2039 break;
2040 }
2041 case kMips64F32x4Min: {
2042 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2043 __ fmin_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2044 i.InputSimd128Register(1));
2045 break;
2046 }
2047 case kMips64F32x4Eq: {
2048 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2049 __ fceq_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2050 i.InputSimd128Register(1));
2051 break;
2052 }
2053 case kMips64F32x4Ne: {
2054 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2055 __ fcne_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2056 i.InputSimd128Register(1));
2057 break;
2058 }
2059 case kMips64F32x4Lt: {
2060 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2061 __ fclt_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2062 i.InputSimd128Register(1));
2063 break;
2064 }
2065 case kMips64F32x4Le: {
2066 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2067 __ fcle_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2068 i.InputSimd128Register(1));
2069 break;
2070 }
2071 case kMips64I32x4SConvertF32x4: {
2072 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2073 __ ftrunc_s_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
2074 break;
2075 }
2076 case kMips64I32x4UConvertF32x4: {
2077 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2078 __ ftrunc_u_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
2079 break;
2080 }
1974 } 2081 }
1975 return kSuccess; 2082 return kSuccess;
1976 } // NOLINT(readability/fn_size) 2083 } // NOLINT(readability/fn_size)
1977 2084
1978 2085
1979 #define UNSUPPORTED_COND(opcode, condition) \ 2086 #define UNSUPPORTED_COND(opcode, condition) \
1980 OFStream out(stdout); \ 2087 OFStream out(stdout); \
1981 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \ 2088 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \
1982 UNIMPLEMENTED(); 2089 UNIMPLEMENTED();
1983 2090
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 padding_size -= v8::internal::Assembler::kInstrSize; 2837 padding_size -= v8::internal::Assembler::kInstrSize;
2731 } 2838 }
2732 } 2839 }
2733 } 2840 }
2734 2841
2735 #undef __ 2842 #undef __
2736 2843
2737 } // namespace compiler 2844 } // namespace compiler
2738 } // namespace internal 2845 } // namespace internal
2739 } // namespace v8 2846 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698