OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/base/macros.h" | 8 #include "src/base/macros.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 if (shift < lane_bits) { \ | 451 if (shift < lane_bits) { \ |
452 for (int i = 0; i < kLaneCount; i++) { \ | 452 for (int i = 0; i < kLaneCount; i++) { \ |
453 lanes[i] = a->get_lane(i) << shift; \ | 453 lanes[i] = a->get_lane(i) << shift; \ |
454 } \ | 454 } \ |
455 } \ | 455 } \ |
456 Handle<type> result = isolate->factory()->New##type(lanes); \ | 456 Handle<type> result = isolate->factory()->New##type(lanes); \ |
457 return *result; \ | 457 return *result; \ |
458 } | 458 } |
459 | 459 |
460 #define SIMD_LSR_FUNCTION(type, lane_type, lane_bits, lane_count) \ | 460 #define SIMD_LSR_FUNCTION(type, lane_type, lane_bits, lane_count) \ |
461 RUNTIME_FUNCTION(Runtime_##type##ShiftRightLogicalByScalar) { \ | 461 RUNTIME_FUNCTION(Runtime_##type##ShiftRightByScalar) { \ |
462 static const int kLaneCount = lane_count; \ | 462 static const int kLaneCount = lane_count; \ |
463 HandleScope scope(isolate); \ | 463 HandleScope scope(isolate); \ |
464 DCHECK(args.length() == 2); \ | 464 DCHECK(args.length() == 2); \ |
465 CONVERT_ARG_HANDLE_CHECKED(type, a, 0); \ | 465 CONVERT_ARG_HANDLE_CHECKED(type, a, 0); \ |
466 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ | 466 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ |
467 lane_type lanes[kLaneCount] = {0}; \ | 467 lane_type lanes[kLaneCount] = {0}; \ |
468 if (shift < lane_bits) { \ | 468 if (shift < lane_bits) { \ |
469 for (int i = 0; i < kLaneCount; i++) { \ | 469 for (int i = 0; i < kLaneCount; i++) { \ |
470 lanes[i] = static_cast<lane_type>( \ | 470 lanes[i] = static_cast<lane_type>( \ |
471 bit_cast<lane_type>(a->get_lane(i)) >> shift); \ | 471 bit_cast<lane_type>(a->get_lane(i)) >> shift); \ |
472 } \ | 472 } \ |
473 } \ | 473 } \ |
474 Handle<type> result = isolate->factory()->New##type(lanes); \ | 474 Handle<type> result = isolate->factory()->New##type(lanes); \ |
475 return *result; \ | 475 return *result; \ |
476 } | 476 } |
477 | 477 |
478 #define SIMD_ASR_FUNCTION(type, lane_type, lane_bits, lane_count) \ | 478 #define SIMD_ASR_FUNCTION(type, lane_type, lane_bits, lane_count) \ |
479 RUNTIME_FUNCTION(Runtime_##type##ShiftRightArithmeticByScalar) { \ | 479 RUNTIME_FUNCTION(Runtime_##type##ShiftRightByScalar) { \ |
480 static const int kLaneCount = lane_count; \ | 480 static const int kLaneCount = lane_count; \ |
481 HandleScope scope(isolate); \ | 481 HandleScope scope(isolate); \ |
482 DCHECK(args.length() == 2); \ | 482 DCHECK(args.length() == 2); \ |
483 CONVERT_ARG_HANDLE_CHECKED(type, a, 0); \ | 483 CONVERT_ARG_HANDLE_CHECKED(type, a, 0); \ |
484 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ | 484 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ |
485 if (shift >= lane_bits) shift = lane_bits - 1; \ | 485 if (shift >= lane_bits) shift = lane_bits - 1; \ |
486 lane_type lanes[kLaneCount]; \ | 486 lane_type lanes[kLaneCount]; \ |
487 for (int i = 0; i < kLaneCount; i++) { \ | 487 for (int i = 0; i < kLaneCount; i++) { \ |
488 int64_t shifted = static_cast<int64_t>(a->get_lane(i)) >> shift; \ | 488 int64_t shifted = static_cast<int64_t>(a->get_lane(i)) >> shift; \ |
489 lanes[i] = static_cast<lane_type>(shifted); \ | 489 lanes[i] = static_cast<lane_type>(shifted); \ |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 SIMD_LOADN_STOREN_TYPES(SIMD_LOAD3_FUNCTION) | 1062 SIMD_LOADN_STOREN_TYPES(SIMD_LOAD3_FUNCTION) |
1063 SIMD_NUMERIC_TYPES(SIMD_STORE_FUNCTION) | 1063 SIMD_NUMERIC_TYPES(SIMD_STORE_FUNCTION) |
1064 SIMD_LOADN_STOREN_TYPES(SIMD_STORE1_FUNCTION) | 1064 SIMD_LOADN_STOREN_TYPES(SIMD_STORE1_FUNCTION) |
1065 SIMD_LOADN_STOREN_TYPES(SIMD_STORE2_FUNCTION) | 1065 SIMD_LOADN_STOREN_TYPES(SIMD_STORE2_FUNCTION) |
1066 SIMD_LOADN_STOREN_TYPES(SIMD_STORE3_FUNCTION) | 1066 SIMD_LOADN_STOREN_TYPES(SIMD_STORE3_FUNCTION) |
1067 | 1067 |
1068 //------------------------------------------------------------------- | 1068 //------------------------------------------------------------------- |
1069 | 1069 |
1070 } // namespace internal | 1070 } // namespace internal |
1071 } // namespace v8 | 1071 } // namespace v8 |
OLD | NEW |