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

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 2668013003: [Turbofan] Add more integer SIMD operations for ARM. (Closed)
Patch Set: Fix compile. 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/wasm-compiler.h ('k') | src/wasm/function-body-decoder.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 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/compiler/wasm-compiler.h" 5 #include "src/compiler/wasm-compiler.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 10
(...skipping 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3416 inputs[1], inputs[0]); 3416 inputs[1], inputs[0]);
3417 case wasm::kExprI32x4LeS: 3417 case wasm::kExprI32x4LeS:
3418 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThanOrEqual(), 3418 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThanOrEqual(),
3419 inputs[1], inputs[0]); 3419 inputs[1], inputs[0]);
3420 case wasm::kExprI32x4GtS: 3420 case wasm::kExprI32x4GtS:
3421 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThan(), 3421 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThan(),
3422 inputs[0], inputs[1]); 3422 inputs[0], inputs[1]);
3423 case wasm::kExprI32x4GeS: 3423 case wasm::kExprI32x4GeS:
3424 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThanOrEqual(), 3424 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThanOrEqual(),
3425 inputs[0], inputs[1]); 3425 inputs[0], inputs[1]);
3426 case wasm::kExprI32x4MinU:
3427 return graph()->NewNode(jsgraph()->machine()->Uint32x4Min(), inputs[0],
3428 inputs[1]);
3429 case wasm::kExprI32x4MaxU:
3430 return graph()->NewNode(jsgraph()->machine()->Uint32x4Max(), inputs[0],
3431 inputs[1]);
3426 case wasm::kExprI32x4LtU: 3432 case wasm::kExprI32x4LtU:
3427 return graph()->NewNode(jsgraph()->machine()->Uint32x4GreaterThan(), 3433 return graph()->NewNode(jsgraph()->machine()->Uint32x4GreaterThan(),
3428 inputs[1], inputs[0]); 3434 inputs[1], inputs[0]);
3429 case wasm::kExprI32x4LeU: 3435 case wasm::kExprI32x4LeU:
3430 return graph()->NewNode( 3436 return graph()->NewNode(
3431 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[1], 3437 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[1],
3432 inputs[0]); 3438 inputs[0]);
3433 case wasm::kExprI32x4GtU: 3439 case wasm::kExprI32x4GtU:
3434 return graph()->NewNode(jsgraph()->machine()->Uint32x4GreaterThan(), 3440 return graph()->NewNode(jsgraph()->machine()->Uint32x4GreaterThan(),
3435 inputs[0], inputs[1]); 3441 inputs[0], inputs[1]);
3436 case wasm::kExprI32x4GeU: 3442 case wasm::kExprI32x4GeU:
3437 return graph()->NewNode( 3443 return graph()->NewNode(
3438 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[0], 3444 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[0],
3439 inputs[1]); 3445 inputs[1]);
3440 case wasm::kExprS32x4Select: 3446 case wasm::kExprS32x4Select:
3441 return graph()->NewNode(jsgraph()->machine()->Simd32x4Select(), inputs[0], 3447 return graph()->NewNode(jsgraph()->machine()->Simd32x4Select(), inputs[0],
3442 inputs[1], inputs[2]); 3448 inputs[1], inputs[2]);
3443 case wasm::kExprI16x8Splat: 3449 case wasm::kExprI16x8Splat:
3444 return graph()->NewNode(jsgraph()->machine()->CreateInt16x8(), inputs[0], 3450 return graph()->NewNode(jsgraph()->machine()->CreateInt16x8(), inputs[0],
3445 inputs[0], inputs[0], inputs[0], inputs[0], 3451 inputs[0], inputs[0], inputs[0], inputs[0],
3446 inputs[0], inputs[0], inputs[0]); 3452 inputs[0], inputs[0], inputs[0]);
3447 case wasm::kExprI16x8Neg: 3453 case wasm::kExprI16x8Neg:
3448 return graph()->NewNode(jsgraph()->machine()->Int16x8Neg(), inputs[0]); 3454 return graph()->NewNode(jsgraph()->machine()->Int16x8Neg(), inputs[0]);
3449 case wasm::kExprI16x8Add: 3455 case wasm::kExprI16x8Add:
3450 return graph()->NewNode(jsgraph()->machine()->Int16x8Add(), inputs[0], 3456 return graph()->NewNode(jsgraph()->machine()->Int16x8Add(), inputs[0],
3451 inputs[1]); 3457 inputs[1]);
3458 case wasm::kExprI16x8AddSaturateS:
3459 return graph()->NewNode(jsgraph()->machine()->Int16x8AddSaturate(),
3460 inputs[0], inputs[1]);
3452 case wasm::kExprI16x8Sub: 3461 case wasm::kExprI16x8Sub:
3453 return graph()->NewNode(jsgraph()->machine()->Int16x8Sub(), inputs[0], 3462 return graph()->NewNode(jsgraph()->machine()->Int16x8Sub(), inputs[0],
3454 inputs[1]); 3463 inputs[1]);
3464 case wasm::kExprI16x8SubSaturateS:
3465 return graph()->NewNode(jsgraph()->machine()->Int16x8SubSaturate(),
3466 inputs[0], inputs[1]);
3455 case wasm::kExprI16x8Mul: 3467 case wasm::kExprI16x8Mul:
3456 return graph()->NewNode(jsgraph()->machine()->Int16x8Mul(), inputs[0], 3468 return graph()->NewNode(jsgraph()->machine()->Int16x8Mul(), inputs[0],
3457 inputs[1]); 3469 inputs[1]);
3458 case wasm::kExprI16x8MinS: 3470 case wasm::kExprI16x8MinS:
3459 return graph()->NewNode(jsgraph()->machine()->Int16x8Min(), inputs[0], 3471 return graph()->NewNode(jsgraph()->machine()->Int16x8Min(), inputs[0],
3460 inputs[1]); 3472 inputs[1]);
3461 case wasm::kExprI16x8MaxS: 3473 case wasm::kExprI16x8MaxS:
3462 return graph()->NewNode(jsgraph()->machine()->Int16x8Max(), inputs[0], 3474 return graph()->NewNode(jsgraph()->machine()->Int16x8Max(), inputs[0],
3463 inputs[1]); 3475 inputs[1]);
3464 case wasm::kExprI16x8Eq: 3476 case wasm::kExprI16x8Eq:
3465 return graph()->NewNode(jsgraph()->machine()->Int16x8Equal(), inputs[0], 3477 return graph()->NewNode(jsgraph()->machine()->Int16x8Equal(), inputs[0],
3466 inputs[1]); 3478 inputs[1]);
3467 case wasm::kExprI16x8Ne: 3479 case wasm::kExprI16x8Ne:
3468 return graph()->NewNode(jsgraph()->machine()->Int16x8NotEqual(), 3480 return graph()->NewNode(jsgraph()->machine()->Int16x8NotEqual(),
3469 inputs[0], inputs[1]); 3481 inputs[0], inputs[1]);
3470 case wasm::kExprI16x8LtS: 3482 case wasm::kExprI16x8LtS:
3471 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThan(), 3483 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThan(),
3472 inputs[1], inputs[0]); 3484 inputs[1], inputs[0]);
3473 case wasm::kExprI16x8LeS: 3485 case wasm::kExprI16x8LeS:
3474 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThanOrEqual(), 3486 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThanOrEqual(),
3475 inputs[1], inputs[0]); 3487 inputs[1], inputs[0]);
3476 case wasm::kExprI16x8GtS: 3488 case wasm::kExprI16x8GtS:
3477 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThan(), 3489 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThan(),
3478 inputs[0], inputs[1]); 3490 inputs[0], inputs[1]);
3479 case wasm::kExprI16x8GeS: 3491 case wasm::kExprI16x8GeS:
3480 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThanOrEqual(), 3492 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThanOrEqual(),
3481 inputs[0], inputs[1]); 3493 inputs[0], inputs[1]);
3494 case wasm::kExprI16x8AddSaturateU:
3495 return graph()->NewNode(jsgraph()->machine()->Uint16x8AddSaturate(),
3496 inputs[0], inputs[1]);
3497 case wasm::kExprI16x8SubSaturateU:
3498 return graph()->NewNode(jsgraph()->machine()->Uint16x8SubSaturate(),
3499 inputs[0], inputs[1]);
3500 case wasm::kExprI16x8MinU:
3501 return graph()->NewNode(jsgraph()->machine()->Uint16x8Min(), inputs[0],
3502 inputs[1]);
3503 case wasm::kExprI16x8MaxU:
3504 return graph()->NewNode(jsgraph()->machine()->Uint16x8Max(), inputs[0],
3505 inputs[1]);
3482 case wasm::kExprI16x8LtU: 3506 case wasm::kExprI16x8LtU:
3483 return graph()->NewNode(jsgraph()->machine()->Uint16x8GreaterThan(), 3507 return graph()->NewNode(jsgraph()->machine()->Uint16x8GreaterThan(),
3484 inputs[1], inputs[0]); 3508 inputs[1], inputs[0]);
3485 case wasm::kExprI16x8LeU: 3509 case wasm::kExprI16x8LeU:
3486 return graph()->NewNode( 3510 return graph()->NewNode(
3487 jsgraph()->machine()->Uint16x8GreaterThanOrEqual(), inputs[1], 3511 jsgraph()->machine()->Uint16x8GreaterThanOrEqual(), inputs[1],
3488 inputs[0]); 3512 inputs[0]);
3489 case wasm::kExprI16x8GtU: 3513 case wasm::kExprI16x8GtU:
3490 return graph()->NewNode(jsgraph()->machine()->Uint16x8GreaterThan(), 3514 return graph()->NewNode(jsgraph()->machine()->Uint16x8GreaterThan(),
3491 inputs[0], inputs[1]); 3515 inputs[0], inputs[1]);
3492 case wasm::kExprI16x8GeU: 3516 case wasm::kExprI16x8GeU:
3493 return graph()->NewNode( 3517 return graph()->NewNode(
3494 jsgraph()->machine()->Uint16x8GreaterThanOrEqual(), inputs[0], 3518 jsgraph()->machine()->Uint16x8GreaterThanOrEqual(), inputs[0],
3495 inputs[1]); 3519 inputs[1]);
3496 case wasm::kExprI8x16Splat: 3520 case wasm::kExprI8x16Splat:
3497 return graph()->NewNode(jsgraph()->machine()->CreateInt8x16(), inputs[0], 3521 return graph()->NewNode(jsgraph()->machine()->CreateInt8x16(), inputs[0],
3498 inputs[0], inputs[0], inputs[0], inputs[0], 3522 inputs[0], inputs[0], inputs[0], inputs[0],
3499 inputs[0], inputs[0], inputs[0], inputs[0], 3523 inputs[0], inputs[0], inputs[0], inputs[0],
3500 inputs[0], inputs[0], inputs[0], inputs[0], 3524 inputs[0], inputs[0], inputs[0], inputs[0],
3501 inputs[0], inputs[0], inputs[0]); 3525 inputs[0], inputs[0], inputs[0]);
3502 case wasm::kExprI8x16Neg: 3526 case wasm::kExprI8x16Neg:
3503 return graph()->NewNode(jsgraph()->machine()->Int8x16Neg(), inputs[0]); 3527 return graph()->NewNode(jsgraph()->machine()->Int8x16Neg(), inputs[0]);
3504 case wasm::kExprI8x16Add: 3528 case wasm::kExprI8x16Add:
3505 return graph()->NewNode(jsgraph()->machine()->Int8x16Add(), inputs[0], 3529 return graph()->NewNode(jsgraph()->machine()->Int8x16Add(), inputs[0],
3506 inputs[1]); 3530 inputs[1]);
3531 case wasm::kExprI8x16AddSaturateS:
3532 return graph()->NewNode(jsgraph()->machine()->Int8x16AddSaturate(),
3533 inputs[0], inputs[1]);
3507 case wasm::kExprI8x16Sub: 3534 case wasm::kExprI8x16Sub:
3508 return graph()->NewNode(jsgraph()->machine()->Int8x16Sub(), inputs[0], 3535 return graph()->NewNode(jsgraph()->machine()->Int8x16Sub(), inputs[0],
3509 inputs[1]); 3536 inputs[1]);
3537 case wasm::kExprI8x16SubSaturateS:
3538 return graph()->NewNode(jsgraph()->machine()->Int8x16SubSaturate(),
3539 inputs[0], inputs[1]);
3510 case wasm::kExprI8x16Mul: 3540 case wasm::kExprI8x16Mul:
3511 return graph()->NewNode(jsgraph()->machine()->Int8x16Mul(), inputs[0], 3541 return graph()->NewNode(jsgraph()->machine()->Int8x16Mul(), inputs[0],
3512 inputs[1]); 3542 inputs[1]);
3513 case wasm::kExprI8x16MinS: 3543 case wasm::kExprI8x16MinS:
3514 return graph()->NewNode(jsgraph()->machine()->Int8x16Min(), inputs[0], 3544 return graph()->NewNode(jsgraph()->machine()->Int8x16Min(), inputs[0],
3515 inputs[1]); 3545 inputs[1]);
3516 case wasm::kExprI8x16MaxS: 3546 case wasm::kExprI8x16MaxS:
3517 return graph()->NewNode(jsgraph()->machine()->Int8x16Max(), inputs[0], 3547 return graph()->NewNode(jsgraph()->machine()->Int8x16Max(), inputs[0],
3518 inputs[1]); 3548 inputs[1]);
3519 case wasm::kExprI8x16Eq: 3549 case wasm::kExprI8x16Eq:
3520 return graph()->NewNode(jsgraph()->machine()->Int8x16Equal(), inputs[0], 3550 return graph()->NewNode(jsgraph()->machine()->Int8x16Equal(), inputs[0],
3521 inputs[1]); 3551 inputs[1]);
3522 case wasm::kExprI8x16Ne: 3552 case wasm::kExprI8x16Ne:
3523 return graph()->NewNode(jsgraph()->machine()->Int8x16NotEqual(), 3553 return graph()->NewNode(jsgraph()->machine()->Int8x16NotEqual(),
3524 inputs[0], inputs[1]); 3554 inputs[0], inputs[1]);
3525 case wasm::kExprI8x16LtS: 3555 case wasm::kExprI8x16LtS:
3526 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThan(), 3556 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThan(),
3527 inputs[1], inputs[0]); 3557 inputs[1], inputs[0]);
3528 case wasm::kExprI8x16LeS: 3558 case wasm::kExprI8x16LeS:
3529 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThanOrEqual(), 3559 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThanOrEqual(),
3530 inputs[1], inputs[0]); 3560 inputs[1], inputs[0]);
3531 case wasm::kExprI8x16GtS: 3561 case wasm::kExprI8x16GtS:
3532 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThan(), 3562 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThan(),
3533 inputs[0], inputs[1]); 3563 inputs[0], inputs[1]);
3534 case wasm::kExprI8x16GeS: 3564 case wasm::kExprI8x16GeS:
3535 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThanOrEqual(), 3565 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThanOrEqual(),
3536 inputs[0], inputs[1]); 3566 inputs[0], inputs[1]);
3567 case wasm::kExprI8x16AddSaturateU:
3568 return graph()->NewNode(jsgraph()->machine()->Uint8x16AddSaturate(),
3569 inputs[0], inputs[1]);
3570 case wasm::kExprI8x16SubSaturateU:
3571 return graph()->NewNode(jsgraph()->machine()->Uint8x16SubSaturate(),
3572 inputs[0], inputs[1]);
3573 case wasm::kExprI8x16MinU:
3574 return graph()->NewNode(jsgraph()->machine()->Uint8x16Min(), inputs[0],
3575 inputs[1]);
3576 case wasm::kExprI8x16MaxU:
3577 return graph()->NewNode(jsgraph()->machine()->Uint8x16Max(), inputs[0],
3578 inputs[1]);
3537 case wasm::kExprI8x16LtU: 3579 case wasm::kExprI8x16LtU:
3538 return graph()->NewNode(jsgraph()->machine()->Uint8x16GreaterThan(), 3580 return graph()->NewNode(jsgraph()->machine()->Uint8x16GreaterThan(),
3539 inputs[1], inputs[0]); 3581 inputs[1], inputs[0]);
3540 case wasm::kExprI8x16LeU: 3582 case wasm::kExprI8x16LeU:
3541 return graph()->NewNode( 3583 return graph()->NewNode(
3542 jsgraph()->machine()->Uint8x16GreaterThanOrEqual(), inputs[1], 3584 jsgraph()->machine()->Uint8x16GreaterThanOrEqual(), inputs[1],
3543 inputs[0]); 3585 inputs[0]);
3544 case wasm::kExprI8x16GtU: 3586 case wasm::kExprI8x16GtU:
3545 return graph()->NewNode(jsgraph()->machine()->Uint8x16GreaterThan(), 3587 return graph()->NewNode(jsgraph()->machine()->Uint8x16GreaterThan(),
3546 inputs[0], inputs[1]); 3588 inputs[0], inputs[1]);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3579 return graph()->NewNode(jsgraph()->machine()->Int8x16ExtractLane(lane), 3621 return graph()->NewNode(jsgraph()->machine()->Int8x16ExtractLane(lane),
3580 inputs[0]); 3622 inputs[0]);
3581 case wasm::kExprI8x16ReplaceLane: 3623 case wasm::kExprI8x16ReplaceLane:
3582 return graph()->NewNode(jsgraph()->machine()->Int8x16ReplaceLane(lane), 3624 return graph()->NewNode(jsgraph()->machine()->Int8x16ReplaceLane(lane),
3583 inputs[0], inputs[1]); 3625 inputs[0], inputs[1]);
3584 default: 3626 default:
3585 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); 3627 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr);
3586 } 3628 }
3587 } 3629 }
3588 3630
3631 Node* WasmGraphBuilder::SimdShiftOp(wasm::WasmOpcode opcode, uint8_t shift,
3632 const NodeVector& inputs) {
3633 has_simd_ = true;
3634 switch (opcode) {
3635 case wasm::kExprI32x4Shl:
3636 return graph()->NewNode(
3637 jsgraph()->machine()->Int32x4ShiftLeftByScalar(shift), inputs[0]);
3638 case wasm::kExprI32x4ShrS:
3639 return graph()->NewNode(
3640 jsgraph()->machine()->Int32x4ShiftRightByScalar(shift), inputs[0]);
3641 case wasm::kExprI32x4ShrU:
3642 return graph()->NewNode(
3643 jsgraph()->machine()->Uint32x4ShiftRightByScalar(shift), inputs[0]);
3644 case wasm::kExprI16x8Shl:
3645 return graph()->NewNode(
3646 jsgraph()->machine()->Int16x8ShiftLeftByScalar(shift), inputs[0]);
3647 case wasm::kExprI16x8ShrS:
3648 return graph()->NewNode(
3649 jsgraph()->machine()->Int16x8ShiftRightByScalar(shift), inputs[0]);
3650 case wasm::kExprI16x8ShrU:
3651 return graph()->NewNode(
3652 jsgraph()->machine()->Uint16x8ShiftRightByScalar(shift), inputs[0]);
3653 case wasm::kExprI8x16Shl:
3654 return graph()->NewNode(
3655 jsgraph()->machine()->Int8x16ShiftLeftByScalar(shift), inputs[0]);
3656 case wasm::kExprI8x16ShrS:
3657 return graph()->NewNode(
3658 jsgraph()->machine()->Int8x16ShiftRightByScalar(shift), inputs[0]);
3659 case wasm::kExprI8x16ShrU:
3660 return graph()->NewNode(
3661 jsgraph()->machine()->Uint8x16ShiftRightByScalar(shift), inputs[0]);
3662 default:
3663 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr);
3664 }
3665 }
3666
3589 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, 3667 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag,
3590 Isolate* isolate, Handle<Code> code, 3668 Isolate* isolate, Handle<Code> code,
3591 const char* message, uint32_t index, 3669 const char* message, uint32_t index,
3592 const wasm::WasmName& module_name, 3670 const wasm::WasmName& module_name,
3593 const wasm::WasmName& func_name) { 3671 const wasm::WasmName& func_name) {
3594 DCHECK(isolate->logger()->is_logging_code_events() || 3672 DCHECK(isolate->logger()->is_logging_code_events() ||
3595 isolate->is_profiling()); 3673 isolate->is_profiling());
3596 3674
3597 ScopedVector<char> buffer(128); 3675 ScopedVector<char> buffer(128);
3598 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(), 3676 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(),
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
4021 function_->code_start_offset), 4099 function_->code_start_offset),
4022 compile_ms); 4100 compile_ms);
4023 } 4101 }
4024 4102
4025 return code; 4103 return code;
4026 } 4104 }
4027 4105
4028 } // namespace compiler 4106 } // namespace compiler
4029 } // namespace internal 4107 } // namespace internal
4030 } // namespace v8 4108 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/wasm/function-body-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698