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

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 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 i.InputSimd128Register(1)); 2090 i.InputSimd128Register(1));
2091 break; 2091 break;
2092 } 2092 }
2093 case kMips64S32x4Select: { 2093 case kMips64S32x4Select: {
2094 CpuFeatureScope msa_scope(masm(), MIPS_SIMD); 2094 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2095 DCHECK(i.OutputSimd128Register().is(i.InputSimd128Register(0))); 2095 DCHECK(i.OutputSimd128Register().is(i.InputSimd128Register(0)));
2096 __ bsel_v(i.OutputSimd128Register(), i.InputSimd128Register(2), 2096 __ bsel_v(i.OutputSimd128Register(), i.InputSimd128Register(2),
2097 i.InputSimd128Register(1)); 2097 i.InputSimd128Register(1));
2098 break; 2098 break;
2099 } 2099 }
2100 case kMips64F32x4Abs: {
2101 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2102 __ bclri_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31);
2103 break;
2104 }
2105 case kMips64F32x4Neg: {
2106 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2107 __ bnegi_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31);
2108 break;
2109 }
2110 case kMips64F32x4RecipApprox: {
2111 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2112 __ frcp_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
2113 break;
2114 }
2115 case kMips64F32x4RecipRefine: {
2116 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2117 Simd128Register dst = i.OutputSimd128Register();
2118 // Emulate with 2.0f - a * b
2119 __ ldi_w(kSimd128ScratchReg, 2);
2120 __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg);
2121 __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1));
2122 __ fsub_w(dst, kSimd128ScratchReg, dst);
2123 break;
2124 }
2125 case kMips64F32x4RecipSqrtApprox: {
2126 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2127 __ frsqrt_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
2128 break;
2129 }
2130 case kMips64F32x4RecipSqrtRefine: {
2131 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2132 Simd128Register dst = i.OutputSimd128Register();
2133 // Emulate with (3.0f - a * b) * 0.5f;
2134 __ ldi_w(kSimd128ScratchReg, 3);
2135 __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg);
2136 __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1));
2137 __ fsub_w(dst, kSimd128ScratchReg, dst);
2138 __ ldi_w(kSimd128ScratchReg, 0x3f);
2139 __ slli_w(kSimd128ScratchReg, kSimd128ScratchReg, 24);
2140 __ fmul_w(dst, dst, kSimd128ScratchReg);
2141 break;
2142 }
2143 case kMips64F32x4Add: {
2144 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2145 __ fadd_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2146 i.InputSimd128Register(1));
2147 break;
2148 }
2149 case kMips64F32x4Sub: {
2150 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2151 __ fsub_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2152 i.InputSimd128Register(1));
2153 break;
2154 }
2155 case kMips64F32x4Mul: {
2156 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2157 __ fmul_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2158 i.InputSimd128Register(1));
2159 break;
2160 }
2161 case kMips64F32x4Max: {
2162 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2163 __ fmax_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2164 i.InputSimd128Register(1));
2165 break;
2166 }
2167 case kMips64F32x4Min: {
2168 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2169 __ fmin_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2170 i.InputSimd128Register(1));
2171 break;
2172 }
2173 case kMips64F32x4Eq: {
2174 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2175 __ fceq_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2176 i.InputSimd128Register(1));
2177 break;
2178 }
2179 case kMips64F32x4Ne: {
2180 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2181 __ fcne_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2182 i.InputSimd128Register(1));
2183 break;
2184 }
2185 case kMips64F32x4Lt: {
2186 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2187 __ fclt_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2188 i.InputSimd128Register(1));
2189 break;
2190 }
2191 case kMips64F32x4Le: {
2192 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2193 __ fcle_w(i.OutputSimd128Register(), i.InputSimd128Register(0),
2194 i.InputSimd128Register(1));
2195 break;
2196 }
2197 case kMips64I32x4SConvertF32x4: {
2198 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2199 __ ftrunc_s_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
2200 break;
2201 }
2202 case kMips64I32x4UConvertF32x4: {
2203 CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
2204 __ ftrunc_u_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
2205 break;
2206 }
2100 } 2207 }
2101 return kSuccess; 2208 return kSuccess;
2102 } // NOLINT(readability/fn_size) 2209 } // NOLINT(readability/fn_size)
2103 2210
2104 2211
2105 #define UNSUPPORTED_COND(opcode, condition) \ 2212 #define UNSUPPORTED_COND(opcode, condition) \
2106 OFStream out(stdout); \ 2213 OFStream out(stdout); \
2107 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \ 2214 out << "Unsupported " << #opcode << " condition: \"" << condition << "\""; \
2108 UNIMPLEMENTED(); 2215 UNIMPLEMENTED();
2109 2216
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 padding_size -= v8::internal::Assembler::kInstrSize; 2963 padding_size -= v8::internal::Assembler::kInstrSize;
2857 } 2964 }
2858 } 2965 }
2859 } 2966 }
2860 2967
2861 #undef __ 2968 #undef __
2862 2969
2863 } // namespace compiler 2970 } // namespace compiler
2864 } // namespace internal 2971 } // namespace internal
2865 } // namespace v8 2972 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/instruction-selector-mips.cc ('k') | src/compiler/mips64/instruction-codes-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698