OLD | NEW |
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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 V(Int16x8SubSaturate, Operator::kNoProperties, 2, 0, 1) \ | 282 V(Int16x8SubSaturate, Operator::kNoProperties, 2, 0, 1) \ |
283 V(Int16x8Mul, Operator::kCommutative, 2, 0, 1) \ | 283 V(Int16x8Mul, Operator::kCommutative, 2, 0, 1) \ |
284 V(Int16x8Min, Operator::kCommutative, 2, 0, 1) \ | 284 V(Int16x8Min, Operator::kCommutative, 2, 0, 1) \ |
285 V(Int16x8Max, Operator::kCommutative, 2, 0, 1) \ | 285 V(Int16x8Max, Operator::kCommutative, 2, 0, 1) \ |
286 V(Int16x8Equal, Operator::kCommutative, 2, 0, 1) \ | 286 V(Int16x8Equal, Operator::kCommutative, 2, 0, 1) \ |
287 V(Int16x8NotEqual, Operator::kCommutative, 2, 0, 1) \ | 287 V(Int16x8NotEqual, Operator::kCommutative, 2, 0, 1) \ |
288 V(Int16x8LessThan, Operator::kNoProperties, 2, 0, 1) \ | 288 V(Int16x8LessThan, Operator::kNoProperties, 2, 0, 1) \ |
289 V(Int16x8LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ | 289 V(Int16x8LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
290 V(Int16x8GreaterThan, Operator::kNoProperties, 2, 0, 1) \ | 290 V(Int16x8GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
291 V(Int16x8GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ | 291 V(Int16x8GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
292 V(Int16x8Select, Operator::kNoProperties, 3, 0, 1) \ | |
293 V(Int16x8Swizzle, Operator::kNoProperties, 9, 0, 1) \ | |
294 V(Int16x8Shuffle, Operator::kNoProperties, 10, 0, 1) \ | |
295 V(Uint16x8AddSaturate, Operator::kCommutative, 2, 0, 1) \ | 292 V(Uint16x8AddSaturate, Operator::kCommutative, 2, 0, 1) \ |
296 V(Uint16x8SubSaturate, Operator::kNoProperties, 2, 0, 1) \ | 293 V(Uint16x8SubSaturate, Operator::kNoProperties, 2, 0, 1) \ |
297 V(Uint16x8Min, Operator::kCommutative, 2, 0, 1) \ | 294 V(Uint16x8Min, Operator::kCommutative, 2, 0, 1) \ |
298 V(Uint16x8Max, Operator::kCommutative, 2, 0, 1) \ | 295 V(Uint16x8Max, Operator::kCommutative, 2, 0, 1) \ |
299 V(Uint16x8LessThan, Operator::kNoProperties, 2, 0, 1) \ | 296 V(Uint16x8LessThan, Operator::kNoProperties, 2, 0, 1) \ |
300 V(Uint16x8LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ | 297 V(Uint16x8LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
301 V(Uint16x8GreaterThan, Operator::kNoProperties, 2, 0, 1) \ | 298 V(Uint16x8GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
302 V(Uint16x8GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ | 299 V(Uint16x8GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
303 V(CreateBool16x8, Operator::kNoProperties, 8, 0, 1) \ | 300 V(CreateBool16x8, Operator::kNoProperties, 8, 0, 1) \ |
304 V(Bool16x8And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 301 V(Bool16x8And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
(...skipping 14 matching lines...) Expand all Loading... |
319 V(Int8x16SubSaturate, Operator::kNoProperties, 2, 0, 1) \ | 316 V(Int8x16SubSaturate, Operator::kNoProperties, 2, 0, 1) \ |
320 V(Int8x16Mul, Operator::kCommutative, 2, 0, 1) \ | 317 V(Int8x16Mul, Operator::kCommutative, 2, 0, 1) \ |
321 V(Int8x16Min, Operator::kCommutative, 2, 0, 1) \ | 318 V(Int8x16Min, Operator::kCommutative, 2, 0, 1) \ |
322 V(Int8x16Max, Operator::kCommutative, 2, 0, 1) \ | 319 V(Int8x16Max, Operator::kCommutative, 2, 0, 1) \ |
323 V(Int8x16Equal, Operator::kCommutative, 2, 0, 1) \ | 320 V(Int8x16Equal, Operator::kCommutative, 2, 0, 1) \ |
324 V(Int8x16NotEqual, Operator::kCommutative, 2, 0, 1) \ | 321 V(Int8x16NotEqual, Operator::kCommutative, 2, 0, 1) \ |
325 V(Int8x16LessThan, Operator::kNoProperties, 2, 0, 1) \ | 322 V(Int8x16LessThan, Operator::kNoProperties, 2, 0, 1) \ |
326 V(Int8x16LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ | 323 V(Int8x16LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
327 V(Int8x16GreaterThan, Operator::kNoProperties, 2, 0, 1) \ | 324 V(Int8x16GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
328 V(Int8x16GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ | 325 V(Int8x16GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
329 V(Int8x16Select, Operator::kNoProperties, 3, 0, 1) \ | |
330 V(Int8x16Swizzle, Operator::kNoProperties, 17, 0, 1) \ | |
331 V(Int8x16Shuffle, Operator::kNoProperties, 18, 0, 1) \ | |
332 V(Uint8x16AddSaturate, Operator::kCommutative, 2, 0, 1) \ | 326 V(Uint8x16AddSaturate, Operator::kCommutative, 2, 0, 1) \ |
333 V(Uint8x16SubSaturate, Operator::kNoProperties, 2, 0, 1) \ | 327 V(Uint8x16SubSaturate, Operator::kNoProperties, 2, 0, 1) \ |
334 V(Uint8x16Min, Operator::kCommutative, 2, 0, 1) \ | 328 V(Uint8x16Min, Operator::kCommutative, 2, 0, 1) \ |
335 V(Uint8x16Max, Operator::kCommutative, 2, 0, 1) \ | 329 V(Uint8x16Max, Operator::kCommutative, 2, 0, 1) \ |
336 V(Uint8x16LessThan, Operator::kNoProperties, 2, 0, 1) \ | 330 V(Uint8x16LessThan, Operator::kNoProperties, 2, 0, 1) \ |
337 V(Uint8x16LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ | 331 V(Uint8x16LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
338 V(Uint8x16GreaterThan, Operator::kNoProperties, 2, 0, 1) \ | 332 V(Uint8x16GreaterThan, Operator::kNoProperties, 2, 0, 1) \ |
339 V(Uint8x16GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ | 333 V(Uint8x16GreaterThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ |
340 V(CreateBool8x16, Operator::kNoProperties, 16, 0, 1) \ | 334 V(CreateBool8x16, Operator::kNoProperties, 16, 0, 1) \ |
341 V(Bool8x16And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 335 V(Bool8x16And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
(...skipping 12 matching lines...) Expand all Loading... |
354 V(Simd128Load3, Operator::kNoProperties, 2, 0, 1) \ | 348 V(Simd128Load3, Operator::kNoProperties, 2, 0, 1) \ |
355 V(Simd128Store, Operator::kNoProperties, 3, 0, 1) \ | 349 V(Simd128Store, Operator::kNoProperties, 3, 0, 1) \ |
356 V(Simd128Store1, Operator::kNoProperties, 3, 0, 1) \ | 350 V(Simd128Store1, Operator::kNoProperties, 3, 0, 1) \ |
357 V(Simd128Store2, Operator::kNoProperties, 3, 0, 1) \ | 351 V(Simd128Store2, Operator::kNoProperties, 3, 0, 1) \ |
358 V(Simd128Store3, Operator::kNoProperties, 3, 0, 1) \ | 352 V(Simd128Store3, Operator::kNoProperties, 3, 0, 1) \ |
359 V(Simd128And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 353 V(Simd128And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
360 V(Simd128Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 354 V(Simd128Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
361 V(Simd128Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 355 V(Simd128Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
362 V(Simd128Not, Operator::kNoProperties, 1, 0, 1) \ | 356 V(Simd128Not, Operator::kNoProperties, 1, 0, 1) \ |
363 V(Simd32x4Select, Operator::kNoProperties, 3, 0, 1) \ | 357 V(Simd32x4Select, Operator::kNoProperties, 3, 0, 1) \ |
364 V(Simd32x4Swizzle, Operator::kNoProperties, 5, 0, 1) \ | 358 V(Simd16x8Select, Operator::kNoProperties, 3, 0, 1) \ |
365 V(Simd32x4Shuffle, Operator::kNoProperties, 6, 0, 1) | 359 V(Simd8x16Select, Operator::kNoProperties, 3, 0, 1) |
366 | 360 |
367 #define PURE_OPTIONAL_OP_LIST(V) \ | 361 #define PURE_OPTIONAL_OP_LIST(V) \ |
368 V(Word32Ctz, Operator::kNoProperties, 1, 0, 1) \ | 362 V(Word32Ctz, Operator::kNoProperties, 1, 0, 1) \ |
369 V(Word64Ctz, Operator::kNoProperties, 1, 0, 1) \ | 363 V(Word64Ctz, Operator::kNoProperties, 1, 0, 1) \ |
370 V(Word32ReverseBits, Operator::kNoProperties, 1, 0, 1) \ | 364 V(Word32ReverseBits, Operator::kNoProperties, 1, 0, 1) \ |
371 V(Word64ReverseBits, Operator::kNoProperties, 1, 0, 1) \ | 365 V(Word64ReverseBits, Operator::kNoProperties, 1, 0, 1) \ |
372 V(Word32ReverseBytes, Operator::kNoProperties, 1, 0, 1) \ | 366 V(Word32ReverseBytes, Operator::kNoProperties, 1, 0, 1) \ |
373 V(Word64ReverseBytes, Operator::kNoProperties, 1, 0, 1) \ | 367 V(Word64ReverseBytes, Operator::kNoProperties, 1, 0, 1) \ |
374 V(Word32Popcnt, Operator::kNoProperties, 1, 0, 1) \ | 368 V(Word32Popcnt, Operator::kNoProperties, 1, 0, 1) \ |
375 V(Word64Popcnt, Operator::kNoProperties, 1, 0, 1) \ | 369 V(Word64Popcnt, Operator::kNoProperties, 1, 0, 1) \ |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 428 |
435 #define SIMD_LANE_OP_LIST(V) \ | 429 #define SIMD_LANE_OP_LIST(V) \ |
436 V(Float32x4, 4) \ | 430 V(Float32x4, 4) \ |
437 V(Int32x4, 4) \ | 431 V(Int32x4, 4) \ |
438 V(Bool32x4, 4) \ | 432 V(Bool32x4, 4) \ |
439 V(Int16x8, 8) \ | 433 V(Int16x8, 8) \ |
440 V(Bool16x8, 8) \ | 434 V(Bool16x8, 8) \ |
441 V(Int8x16, 16) \ | 435 V(Int8x16, 16) \ |
442 V(Bool8x16, 16) | 436 V(Bool8x16, 16) |
443 | 437 |
444 #define SIMD_SHIFT_OP_LIST(V) \ | 438 #define SIMD_FORMAT_LIST(V) \ |
445 V(32x4, 32) \ | 439 V(32x4, 32) \ |
446 V(16x8, 16) \ | 440 V(16x8, 16) \ |
447 V(8x16, 8) | 441 V(8x16, 8) |
448 | 442 |
449 #define STACK_SLOT_CACHED_SIZES_LIST(V) V(4) V(8) V(16) | 443 #define STACK_SLOT_CACHED_SIZES_LIST(V) V(4) V(8) V(16) |
450 | 444 |
451 struct StackSlotOperator : public Operator1<int> { | 445 struct StackSlotOperator : public Operator1<int> { |
452 explicit StackSlotOperator(int size) | 446 explicit StackSlotOperator(int size) |
453 : Operator1<int>(IrOpcode::kStackSlot, | 447 : Operator1<int>(IrOpcode::kStackSlot, |
454 Operator::kNoDeopt | Operator::kNoThrow, "StackSlot", 0, | 448 Operator::kNoDeopt | Operator::kNoThrow, "StackSlot", 0, |
455 0, 0, 1, 0, 0, size) {} | 449 0, 0, 1, 0, 0, size) {} |
456 }; | 450 }; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 IrOpcode::kInt##format##ShiftRightByScalar, Operator::kPure, \ | 876 IrOpcode::kInt##format##ShiftRightByScalar, Operator::kPure, \ |
883 "Arithmetic shift right", 1, 0, 0, 1, 0, 0, shift); \ | 877 "Arithmetic shift right", 1, 0, 0, 1, 0, 0, shift); \ |
884 } \ | 878 } \ |
885 const Operator* MachineOperatorBuilder::Uint##format##ShiftRightByScalar( \ | 879 const Operator* MachineOperatorBuilder::Uint##format##ShiftRightByScalar( \ |
886 int32_t shift) { \ | 880 int32_t shift) { \ |
887 DCHECK(0 <= shift && shift < bits); \ | 881 DCHECK(0 <= shift && shift < bits); \ |
888 return new (zone_) Operator1<int32_t>( \ | 882 return new (zone_) Operator1<int32_t>( \ |
889 IrOpcode::kUint##format##ShiftRightByScalar, Operator::kPure, \ | 883 IrOpcode::kUint##format##ShiftRightByScalar, Operator::kPure, \ |
890 "Shift right", 1, 0, 0, 1, 0, 0, shift); \ | 884 "Shift right", 1, 0, 0, 1, 0, 0, shift); \ |
891 } | 885 } |
892 SIMD_SHIFT_OP_LIST(SIMD_SHIFT_OPS) | 886 SIMD_FORMAT_LIST(SIMD_SHIFT_OPS) |
893 #undef SIMD_SHIFT_OPS | 887 #undef SIMD_SHIFT_OPS |
894 | 888 |
| 889 // TODO(bbudge) Add Shuffle, DCHECKs based on format. |
| 890 #define SIMD_PERMUTE_OPS(format, bits) \ |
| 891 const Operator* MachineOperatorBuilder::Simd##format##Swizzle( \ |
| 892 uint32_t swizzle) { \ |
| 893 return new (zone_) \ |
| 894 Operator1<uint32_t>(IrOpcode::kSimd##format##Swizzle, Operator::kPure, \ |
| 895 "Swizzle", 2, 0, 0, 1, 0, 0, swizzle); \ |
| 896 } |
| 897 SIMD_FORMAT_LIST(SIMD_PERMUTE_OPS) |
| 898 #undef SIMD_PERMUTE_OPS |
| 899 |
895 } // namespace compiler | 900 } // namespace compiler |
896 } // namespace internal | 901 } // namespace internal |
897 } // namespace v8 | 902 } // namespace v8 |
OLD | NEW |