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

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

Issue 2719953002: Add Int32x4 Wasm Simd Binops, compare ops, select (Closed)
Patch Set: Add Int32x4 shift ops Created 3 years, 9 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/code-generator-impl.h" 10 #include "src/compiler/code-generator-impl.h"
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 __ xchgw(i.InputRegister(index), operand); 2148 __ xchgw(i.InputRegister(index), operand);
2149 break; 2149 break;
2150 } 2150 }
2151 case kX64Xchgl: { 2151 case kX64Xchgl: {
2152 size_t index = 0; 2152 size_t index = 0;
2153 Operand operand = i.MemoryOperand(&index); 2153 Operand operand = i.MemoryOperand(&index);
2154 __ xchgl(i.InputRegister(index), operand); 2154 __ xchgl(i.InputRegister(index), operand);
2155 break; 2155 break;
2156 } 2156 }
2157 case kX64Int32x4Splat: { 2157 case kX64Int32x4Splat: {
2158 CpuFeatureScope sse_scope(masm(), SSE4_1);
2159 XMMRegister dst = i.OutputSimd128Register(); 2158 XMMRegister dst = i.OutputSimd128Register();
2160 __ Movd(dst, i.InputRegister(0)); 2159 __ Movd(dst, i.InputRegister(0));
bbudge 2017/02/28 19:34:39 Still might use AVX.
gdeepti 2017/03/13 20:37:52 Fixed now.
2161 __ shufps(dst, dst, 0x0); 2160 __ pshufd(dst, dst, 0x0);
2162 break; 2161 break;
2163 } 2162 }
2164 case kX64Int32x4ExtractLane: { 2163 case kX64Int32x4ExtractLane: {
2165 CpuFeatureScope sse_scope(masm(), SSE4_1); 2164 CpuFeatureScope sse_scope(masm(), SSE4_1);
2166 __ Pextrd(i.OutputRegister(), i.InputSimd128Register(0), i.InputInt8(1)); 2165 __ Pextrd(i.OutputRegister(), i.InputSimd128Register(0), i.InputInt8(1));
2167 break; 2166 break;
2168 } 2167 }
2169 case kX64Int32x4ReplaceLane: { 2168 case kX64Int32x4ReplaceLane: {
2170 CpuFeatureScope sse_scope(masm(), SSE4_1); 2169 CpuFeatureScope sse_scope(masm(), SSE4_1);
2171 if (instr->InputAt(2)->IsRegister()) { 2170 if (instr->InputAt(2)->IsRegister()) {
2172 __ Pinsrd(i.OutputSimd128Register(), i.InputRegister(2), 2171 __ Pinsrd(i.OutputSimd128Register(), i.InputRegister(2),
2173 i.InputInt8(1)); 2172 i.InputInt8(1));
2174 } else { 2173 } else {
2175 __ Pinsrd(i.OutputSimd128Register(), i.InputOperand(2), i.InputInt8(1)); 2174 __ Pinsrd(i.OutputSimd128Register(), i.InputOperand(2), i.InputInt8(1));
2176 } 2175 }
2177 break; 2176 break;
2178 } 2177 }
2179 case kX64Int32x4Add: { 2178 case kX64Int32x4Add: {
2180 CpuFeatureScope sse_scope(masm(), SSE4_1);
2181 __ paddd(i.OutputSimd128Register(), i.InputSimd128Register(1)); 2179 __ paddd(i.OutputSimd128Register(), i.InputSimd128Register(1));
2182 break; 2180 break;
2183 } 2181 }
2184 case kX64Int32x4Sub: { 2182 case kX64Int32x4Sub: {
2185 CpuFeatureScope sse_scope(masm(), SSE4_1);
2186 __ psubd(i.OutputSimd128Register(), i.InputSimd128Register(1)); 2183 __ psubd(i.OutputSimd128Register(), i.InputSimd128Register(1));
2187 break; 2184 break;
2188 } 2185 }
2186 case kX64Int32x4Mul: {
2187 CpuFeatureScope sse_scope(masm(), SSE4_1);
2188 __ pmulld(i.OutputSimd128Register(), i.InputSimd128Register(1));
2189 break;
2190 }
2191 case kX64Int32x4Min: {
2192 CpuFeatureScope sse_scope(masm(), SSE4_1);
2193 __ pminsd(i.OutputSimd128Register(), i.InputSimd128Register(1));
2194 break;
2195 }
2196 case kX64Int32x4Max: {
2197 CpuFeatureScope sse_scope(masm(), SSE4_1);
2198 __ pmaxsd(i.OutputSimd128Register(), i.InputSimd128Register(1));
2199 break;
2200 }
2201 case kX64Uint32x4Min: {
2202 CpuFeatureScope sse_scope(masm(), SSE4_1);
2203 __ pminud(i.OutputSimd128Register(), i.InputSimd128Register(1));
2204 break;
2205 }
2206 case kX64Uint32x4Max: {
2207 CpuFeatureScope sse_scope(masm(), SSE4_1);
2208 __ pmaxud(i.OutputSimd128Register(), i.InputSimd128Register(1));
2209 break;
2210 }
2211 case kX64Int32x4Equal: {
2212 __ pcmpeqd(i.OutputSimd128Register(), i.InputSimd128Register(1));
2213 break;
2214 }
2215 case kX64Int32x4NotEqual: {
2216 __ pcmpeqd(i.OutputSimd128Register(), i.InputSimd128Register(1));
2217 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
2218 __ pxor(i.OutputSimd128Register(), kScratchDoubleReg);
2219 break;
2220 }
2221 case kX64Int32x4ShiftLeftByScalar: {
2222 __ pslld(i.OutputSimd128Register(), i.InputInt8(1));
2223 break;
2224 }
2225 case kX64Int32x4ShiftRightByScalar: {
2226 __ psrad(i.OutputSimd128Register(), i.InputInt8(1));
2227 break;
2228 }
2229 case kX64Uint32x4ShiftRightByScalar: {
2230 __ psrld(i.OutputSimd128Register(), i.InputInt8(1));
2231 break;
2232 }
2233 case kX64Simd32x4Select: {
2234 XMMRegister dst = i.OutputSimd128Register();
bbudge 2017/02/28 19:34:39 A comment here that dst contains the mask initiall
gdeepti 2017/03/13 20:37:52 Done.
2235 __ xorps(i.InputSimd128Register(1), i.InputSimd128Register(2));
bbudge 2017/02/28 19:34:39 Maybe use the scratch FP register for this? Otherw
gdeepti 2017/03/13 20:37:52 Done.
2236 __ andps(dst, i.InputSimd128Register(1));
2237 __ xorps(dst, i.InputSimd128Register(2));
2238 break;
2239 }
2189 case kX64Simd128Zero: { 2240 case kX64Simd128Zero: {
2190 CpuFeatureScope sse_scope(masm(), SSE4_1);
2191 XMMRegister dst = i.OutputSimd128Register(); 2241 XMMRegister dst = i.OutputSimd128Register();
2192 __ xorps(dst, dst); 2242 __ xorps(dst, dst);
2193 break; 2243 break;
2194 } 2244 }
2195 case kCheckedLoadInt8: 2245 case kCheckedLoadInt8:
2196 ASSEMBLE_CHECKED_LOAD_INTEGER(movsxbl); 2246 ASSEMBLE_CHECKED_LOAD_INTEGER(movsxbl);
2197 break; 2247 break;
2198 case kCheckedLoadUint8: 2248 case kCheckedLoadUint8:
2199 ASSEMBLE_CHECKED_LOAD_INTEGER(movzxbl); 2249 ASSEMBLE_CHECKED_LOAD_INTEGER(movzxbl);
2200 break; 2250 break;
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2867 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2917 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2868 __ Nop(padding_size); 2918 __ Nop(padding_size);
2869 } 2919 }
2870 } 2920 }
2871 2921
2872 #undef __ 2922 #undef __
2873 2923
2874 } // namespace compiler 2924 } // namespace compiler
2875 } // namespace internal 2925 } // namespace internal
2876 } // namespace v8 2926 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698