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

Side by Side Diff: src/compiler/machine-operator.cc

Issue 2638133002: [Turbofan] Add other integer SIMD types, add more integer ops. (Closed)
Patch Set: Fix name of static fields. Created 3 years, 10 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/machine-operator.h ('k') | src/compiler/wasm-compiler.cc » ('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/machine-operator.h" 5 #include "src/compiler/machine-operator.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1) \ 214 V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1) \
215 V(LoadFramePointer, Operator::kNoProperties, 0, 0, 1) \ 215 V(LoadFramePointer, Operator::kNoProperties, 0, 0, 1) \
216 V(LoadParentFramePointer, Operator::kNoProperties, 0, 0, 1) \ 216 V(LoadParentFramePointer, Operator::kNoProperties, 0, 0, 1) \
217 V(Int32PairAdd, Operator::kNoProperties, 4, 0, 2) \ 217 V(Int32PairAdd, Operator::kNoProperties, 4, 0, 2) \
218 V(Int32PairSub, Operator::kNoProperties, 4, 0, 2) \ 218 V(Int32PairSub, Operator::kNoProperties, 4, 0, 2) \
219 V(Int32PairMul, Operator::kNoProperties, 4, 0, 2) \ 219 V(Int32PairMul, Operator::kNoProperties, 4, 0, 2) \
220 V(Word32PairShl, Operator::kNoProperties, 3, 0, 2) \ 220 V(Word32PairShl, Operator::kNoProperties, 3, 0, 2) \
221 V(Word32PairShr, Operator::kNoProperties, 3, 0, 2) \ 221 V(Word32PairShr, Operator::kNoProperties, 3, 0, 2) \
222 V(Word32PairSar, Operator::kNoProperties, 3, 0, 2) \ 222 V(Word32PairSar, Operator::kNoProperties, 3, 0, 2) \
223 V(CreateFloat32x4, Operator::kNoProperties, 4, 0, 1) \ 223 V(CreateFloat32x4, Operator::kNoProperties, 4, 0, 1) \
224 V(Float32x4ExtractLane, Operator::kNoProperties, 2, 0, 1) \
225 V(Float32x4ReplaceLane, Operator::kNoProperties, 3, 0, 1) \
226 V(Float32x4Abs, Operator::kNoProperties, 1, 0, 1) \ 224 V(Float32x4Abs, Operator::kNoProperties, 1, 0, 1) \
227 V(Float32x4Neg, Operator::kNoProperties, 1, 0, 1) \ 225 V(Float32x4Neg, Operator::kNoProperties, 1, 0, 1) \
228 V(Float32x4Sqrt, Operator::kNoProperties, 1, 0, 1) \ 226 V(Float32x4Sqrt, Operator::kNoProperties, 1, 0, 1) \
229 V(Float32x4RecipApprox, Operator::kNoProperties, 1, 0, 1) \ 227 V(Float32x4RecipApprox, Operator::kNoProperties, 1, 0, 1) \
230 V(Float32x4RecipSqrtApprox, Operator::kNoProperties, 1, 0, 1) \ 228 V(Float32x4RecipSqrtApprox, Operator::kNoProperties, 1, 0, 1) \
231 V(Float32x4Add, Operator::kCommutative, 2, 0, 1) \ 229 V(Float32x4Add, Operator::kCommutative, 2, 0, 1) \
232 V(Float32x4Sub, Operator::kNoProperties, 2, 0, 1) \ 230 V(Float32x4Sub, Operator::kNoProperties, 2, 0, 1) \
233 V(Float32x4Mul, Operator::kCommutative, 2, 0, 1) \ 231 V(Float32x4Mul, Operator::kCommutative, 2, 0, 1) \
234 V(Float32x4Div, Operator::kNoProperties, 2, 0, 1) \ 232 V(Float32x4Div, Operator::kNoProperties, 2, 0, 1) \
235 V(Float32x4Min, Operator::kCommutative, 2, 0, 1) \ 233 V(Float32x4Min, Operator::kCommutative, 2, 0, 1) \
236 V(Float32x4Max, Operator::kCommutative, 2, 0, 1) \ 234 V(Float32x4Max, Operator::kCommutative, 2, 0, 1) \
237 V(Float32x4MinNum, Operator::kCommutative, 2, 0, 1) \ 235 V(Float32x4MinNum, Operator::kCommutative, 2, 0, 1) \
238 V(Float32x4MaxNum, Operator::kCommutative, 2, 0, 1) \ 236 V(Float32x4MaxNum, Operator::kCommutative, 2, 0, 1) \
239 V(Float32x4Equal, Operator::kCommutative, 2, 0, 1) \ 237 V(Float32x4Equal, Operator::kCommutative, 2, 0, 1) \
240 V(Float32x4NotEqual, Operator::kCommutative, 2, 0, 1) \ 238 V(Float32x4NotEqual, Operator::kCommutative, 2, 0, 1) \
241 V(Float32x4LessThan, Operator::kNoProperties, 2, 0, 1) \ 239 V(Float32x4LessThan, Operator::kNoProperties, 2, 0, 1) \
242 V(Float32x4LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 240 V(Float32x4LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
243 V(Float32x4GreaterThan, Operator::kNoProperties, 2, 0, 1) \ 241 V(Float32x4GreaterThan, Operator::kNoProperties, 2, 0, 1) \
244 V(Float32x4GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 242 V(Float32x4GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
245 V(Float32x4FromInt32x4, Operator::kNoProperties, 1, 0, 1) \ 243 V(Float32x4FromInt32x4, Operator::kNoProperties, 1, 0, 1) \
246 V(Float32x4FromUint32x4, Operator::kNoProperties, 1, 0, 1) \ 244 V(Float32x4FromUint32x4, Operator::kNoProperties, 1, 0, 1) \
247 V(CreateInt32x4, Operator::kNoProperties, 4, 0, 1) \ 245 V(CreateInt32x4, Operator::kNoProperties, 4, 0, 1) \
248 V(Int32x4ExtractLane, Operator::kNoProperties, 2, 0, 1) \
249 V(Int32x4ReplaceLane, Operator::kNoProperties, 3, 0, 1) \
250 V(Int32x4Neg, Operator::kNoProperties, 1, 0, 1) \ 246 V(Int32x4Neg, Operator::kNoProperties, 1, 0, 1) \
251 V(Int32x4Add, Operator::kCommutative, 2, 0, 1) \ 247 V(Int32x4Add, Operator::kCommutative, 2, 0, 1) \
252 V(Int32x4Sub, Operator::kNoProperties, 2, 0, 1) \ 248 V(Int32x4Sub, Operator::kNoProperties, 2, 0, 1) \
253 V(Int32x4Mul, Operator::kCommutative, 2, 0, 1) \ 249 V(Int32x4Mul, Operator::kCommutative, 2, 0, 1) \
254 V(Int32x4Min, Operator::kCommutative, 2, 0, 1) \ 250 V(Int32x4Min, Operator::kCommutative, 2, 0, 1) \
255 V(Int32x4Max, Operator::kCommutative, 2, 0, 1) \ 251 V(Int32x4Max, Operator::kCommutative, 2, 0, 1) \
256 V(Int32x4ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \ 252 V(Int32x4ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \
257 V(Int32x4ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \ 253 V(Int32x4ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \
258 V(Int32x4Equal, Operator::kCommutative, 2, 0, 1) \ 254 V(Int32x4Equal, Operator::kCommutative, 2, 0, 1) \
259 V(Int32x4NotEqual, Operator::kCommutative, 2, 0, 1) \ 255 V(Int32x4NotEqual, Operator::kCommutative, 2, 0, 1) \
(...skipping 18 matching lines...) Expand all
278 V(Bool32x4Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 274 V(Bool32x4Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
279 V(Bool32x4Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 275 V(Bool32x4Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
280 V(Bool32x4Not, Operator::kNoProperties, 1, 0, 1) \ 276 V(Bool32x4Not, Operator::kNoProperties, 1, 0, 1) \
281 V(Bool32x4AnyTrue, Operator::kNoProperties, 1, 0, 1) \ 277 V(Bool32x4AnyTrue, Operator::kNoProperties, 1, 0, 1) \
282 V(Bool32x4AllTrue, Operator::kNoProperties, 1, 0, 1) \ 278 V(Bool32x4AllTrue, Operator::kNoProperties, 1, 0, 1) \
283 V(Bool32x4Swizzle, Operator::kNoProperties, 5, 0, 1) \ 279 V(Bool32x4Swizzle, Operator::kNoProperties, 5, 0, 1) \
284 V(Bool32x4Shuffle, Operator::kNoProperties, 6, 0, 1) \ 280 V(Bool32x4Shuffle, Operator::kNoProperties, 6, 0, 1) \
285 V(Bool32x4Equal, Operator::kCommutative, 2, 0, 1) \ 281 V(Bool32x4Equal, Operator::kCommutative, 2, 0, 1) \
286 V(Bool32x4NotEqual, Operator::kCommutative, 2, 0, 1) \ 282 V(Bool32x4NotEqual, Operator::kCommutative, 2, 0, 1) \
287 V(CreateInt16x8, Operator::kNoProperties, 8, 0, 1) \ 283 V(CreateInt16x8, Operator::kNoProperties, 8, 0, 1) \
288 V(Int16x8ExtractLane, Operator::kNoProperties, 2, 0, 1) \
289 V(Int16x8ReplaceLane, Operator::kNoProperties, 3, 0, 1) \
290 V(Int16x8Neg, Operator::kNoProperties, 1, 0, 1) \ 284 V(Int16x8Neg, Operator::kNoProperties, 1, 0, 1) \
291 V(Int16x8Add, Operator::kCommutative, 2, 0, 1) \ 285 V(Int16x8Add, Operator::kCommutative, 2, 0, 1) \
292 V(Int16x8AddSaturate, Operator::kCommutative, 2, 0, 1) \ 286 V(Int16x8AddSaturate, Operator::kCommutative, 2, 0, 1) \
293 V(Int16x8Sub, Operator::kNoProperties, 2, 0, 1) \ 287 V(Int16x8Sub, Operator::kNoProperties, 2, 0, 1) \
294 V(Int16x8SubSaturate, Operator::kNoProperties, 2, 0, 1) \ 288 V(Int16x8SubSaturate, Operator::kNoProperties, 2, 0, 1) \
295 V(Int16x8Mul, Operator::kCommutative, 2, 0, 1) \ 289 V(Int16x8Mul, Operator::kCommutative, 2, 0, 1) \
296 V(Int16x8Min, Operator::kCommutative, 2, 0, 1) \ 290 V(Int16x8Min, Operator::kCommutative, 2, 0, 1) \
297 V(Int16x8Max, Operator::kCommutative, 2, 0, 1) \ 291 V(Int16x8Max, Operator::kCommutative, 2, 0, 1) \
298 V(Int16x8ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \ 292 V(Int16x8ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \
299 V(Int16x8ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \ 293 V(Int16x8ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \
(...skipping 23 matching lines...) Expand all
323 V(Bool16x8Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 317 V(Bool16x8Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
324 V(Bool16x8Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 318 V(Bool16x8Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
325 V(Bool16x8Not, Operator::kNoProperties, 1, 0, 1) \ 319 V(Bool16x8Not, Operator::kNoProperties, 1, 0, 1) \
326 V(Bool16x8AnyTrue, Operator::kNoProperties, 1, 0, 1) \ 320 V(Bool16x8AnyTrue, Operator::kNoProperties, 1, 0, 1) \
327 V(Bool16x8AllTrue, Operator::kNoProperties, 1, 0, 1) \ 321 V(Bool16x8AllTrue, Operator::kNoProperties, 1, 0, 1) \
328 V(Bool16x8Swizzle, Operator::kNoProperties, 9, 0, 1) \ 322 V(Bool16x8Swizzle, Operator::kNoProperties, 9, 0, 1) \
329 V(Bool16x8Shuffle, Operator::kNoProperties, 10, 0, 1) \ 323 V(Bool16x8Shuffle, Operator::kNoProperties, 10, 0, 1) \
330 V(Bool16x8Equal, Operator::kCommutative, 2, 0, 1) \ 324 V(Bool16x8Equal, Operator::kCommutative, 2, 0, 1) \
331 V(Bool16x8NotEqual, Operator::kCommutative, 2, 0, 1) \ 325 V(Bool16x8NotEqual, Operator::kCommutative, 2, 0, 1) \
332 V(CreateInt8x16, Operator::kNoProperties, 16, 0, 1) \ 326 V(CreateInt8x16, Operator::kNoProperties, 16, 0, 1) \
333 V(Int8x16ExtractLane, Operator::kNoProperties, 2, 0, 1) \
334 V(Int8x16ReplaceLane, Operator::kNoProperties, 3, 0, 1) \
335 V(Int8x16Neg, Operator::kNoProperties, 1, 0, 1) \ 327 V(Int8x16Neg, Operator::kNoProperties, 1, 0, 1) \
336 V(Int8x16Add, Operator::kCommutative, 2, 0, 1) \ 328 V(Int8x16Add, Operator::kCommutative, 2, 0, 1) \
337 V(Int8x16AddSaturate, Operator::kCommutative, 2, 0, 1) \ 329 V(Int8x16AddSaturate, Operator::kCommutative, 2, 0, 1) \
338 V(Int8x16Sub, Operator::kNoProperties, 2, 0, 1) \ 330 V(Int8x16Sub, Operator::kNoProperties, 2, 0, 1) \
339 V(Int8x16SubSaturate, Operator::kNoProperties, 2, 0, 1) \ 331 V(Int8x16SubSaturate, Operator::kNoProperties, 2, 0, 1) \
340 V(Int8x16Mul, Operator::kCommutative, 2, 0, 1) \ 332 V(Int8x16Mul, Operator::kCommutative, 2, 0, 1) \
341 V(Int8x16Min, Operator::kCommutative, 2, 0, 1) \ 333 V(Int8x16Min, Operator::kCommutative, 2, 0, 1) \
342 V(Int8x16Max, Operator::kCommutative, 2, 0, 1) \ 334 V(Int8x16Max, Operator::kCommutative, 2, 0, 1) \
343 V(Int8x16ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \ 335 V(Int8x16ShiftLeftByScalar, Operator::kNoProperties, 2, 0, 1) \
344 V(Int8x16ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \ 336 V(Int8x16ShiftRightByScalar, Operator::kNoProperties, 2, 0, 1) \
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 V(Int16) \ 443 V(Int16) \
452 V(Uint16) \ 444 V(Uint16) \
453 V(Int32) \ 445 V(Int32) \
454 V(Uint32) 446 V(Uint32)
455 447
456 #define ATOMIC_REPRESENTATION_LIST(V) \ 448 #define ATOMIC_REPRESENTATION_LIST(V) \
457 V(kWord8) \ 449 V(kWord8) \
458 V(kWord16) \ 450 V(kWord16) \
459 V(kWord32) 451 V(kWord32)
460 452
453 #define SIMD_LANE_OP_LIST(V) \
454 V(Float32x4, 4) \
455 V(Int32x4, 4) \
456 V(Int16x8, 8) \
457 V(Int8x16, 16)
458
461 #define STACK_SLOT_CACHED_SIZES_LIST(V) V(4) V(8) V(16) 459 #define STACK_SLOT_CACHED_SIZES_LIST(V) V(4) V(8) V(16)
462 460
463 struct StackSlotOperator : public Operator1<int> { 461 struct StackSlotOperator : public Operator1<int> {
464 explicit StackSlotOperator(int size) 462 explicit StackSlotOperator(int size)
465 : Operator1<int>(IrOpcode::kStackSlot, 463 : Operator1<int>(IrOpcode::kStackSlot,
466 Operator::kNoDeopt | Operator::kNoThrow, "StackSlot", 0, 464 Operator::kNoDeopt | Operator::kNoThrow, "StackSlot", 0,
467 0, 0, 1, 0, 0, size) {} 465 0, 0, 1, 0, 0, size) {}
468 }; 466 };
469 467
470 struct MachineOperatorGlobalCache { 468 struct MachineOperatorGlobalCache {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 AtomicStore##Type##Operator() \ 625 AtomicStore##Type##Operator() \
628 : Operator1<MachineRepresentation>( \ 626 : Operator1<MachineRepresentation>( \
629 IrOpcode::kAtomicStore, \ 627 IrOpcode::kAtomicStore, \
630 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ 628 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \
631 "AtomicStore", 3, 1, 1, 0, 1, 0, MachineRepresentation::Type) {} \ 629 "AtomicStore", 3, 1, 1, 0, 1, 0, MachineRepresentation::Type) {} \
632 }; \ 630 }; \
633 AtomicStore##Type##Operator kAtomicStore##Type; 631 AtomicStore##Type##Operator kAtomicStore##Type;
634 ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE) 632 ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE)
635 #undef STORE 633 #undef STORE
636 634
635 #define SIMD_LANE_OPS(Name, lane_count) \
636 struct Name##ExtractLaneOperator final : public Operator1<int> { \
637 static int lane_number; \
638 Name##ExtractLaneOperator() \
639 : Operator1<int>(IrOpcode::k##Name##ExtractLane, Operator::kPure, \
640 "ExtractLane", 1, 0, 0, 1, 0, 0, lane_number++) {} \
641 }; \
642 struct Name##ReplaceLaneOperator final : public Operator1<int> { \
643 static int lane_number; \
644 Name##ReplaceLaneOperator() \
645 : Operator1<int>(IrOpcode::k##Name##ReplaceLane, Operator::kPure, \
646 "ReplaceLane", 2, 0, 0, 1, 0, 0, lane_number++) {} \
647 }; \
648 Name##ExtractLaneOperator k##Name##ExtractLane[lane_count]; \
649 Name##ReplaceLaneOperator k##Name##ReplaceLane[lane_count];
650 SIMD_LANE_OP_LIST(SIMD_LANE_OPS)
651 #undef SIMD_LANE_OPS
652
637 struct DebugBreakOperator : public Operator { 653 struct DebugBreakOperator : public Operator {
638 DebugBreakOperator() 654 DebugBreakOperator()
639 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0, 655 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0,
640 0, 0, 0, 0, 0) {} 656 0, 0, 0, 0, 0) {}
641 }; 657 };
642 DebugBreakOperator kDebugBreak; 658 DebugBreakOperator kDebugBreak;
643 659
644 struct UnsafePointerAddOperator final : public Operator { 660 struct UnsafePointerAddOperator final : public Operator {
645 UnsafePointerAddOperator() 661 UnsafePointerAddOperator()
646 : Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol, 662 : Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol,
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 #define STORE(kRep) \ 870 #define STORE(kRep) \
855 if (rep == MachineRepresentation::kRep) { \ 871 if (rep == MachineRepresentation::kRep) { \
856 return &cache_.kAtomicStore##kRep; \ 872 return &cache_.kAtomicStore##kRep; \
857 } 873 }
858 ATOMIC_REPRESENTATION_LIST(STORE) 874 ATOMIC_REPRESENTATION_LIST(STORE)
859 #undef STORE 875 #undef STORE
860 UNREACHABLE(); 876 UNREACHABLE();
861 return nullptr; 877 return nullptr;
862 } 878 }
863 879
880 #define SIMD_LANE_OPS(Name, lane_count) \
881 const Operator* MachineOperatorBuilder::Name##ExtractLane( \
882 int32_t lane_number) { \
883 DCHECK(0 <= lane_number && lane_number < lane_count); \
884 return &cache_.k##Name##ExtractLane[lane_number]; \
885 } \
886 const Operator* MachineOperatorBuilder::Name##ReplaceLane( \
887 int32_t lane_number) { \
888 DCHECK(0 <= lane_number && lane_number < lane_count); \
889 return &cache_.k##Name##ReplaceLane[lane_number]; \
890 } \
891 int MachineOperatorGlobalCache::Name##ExtractLaneOperator::lane_number = 0; \
892 int MachineOperatorGlobalCache::Name##ReplaceLaneOperator::lane_number = 0;
893 SIMD_LANE_OP_LIST(SIMD_LANE_OPS)
894 #undef SIMD_LANE_OPS
895
864 } // namespace compiler 896 } // namespace compiler
865 } // namespace internal 897 } // namespace internal
866 } // namespace v8 898 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-operator.h ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698