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

Side by Side Diff: src/compiler/int64-lowering.cc

Issue 1806593003: [wasm] Int64Lowering of Word64Ctz. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 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
« no previous file with comments | « no previous file | src/compiler/machine-operator.h » ('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/int64-lowering.h" 5 #include "src/compiler/int64-lowering.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/diamond.h" 7 #include "src/compiler/diamond.h"
8 #include "src/compiler/graph.h" 8 #include "src/compiler/graph.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 MachineRepresentation::kWord32, 535 MachineRepresentation::kWord32,
536 graph()->NewNode(machine()->Int32Add(), 536 graph()->NewNode(machine()->Int32Add(),
537 graph()->NewNode(machine()->Word32Clz(), 537 graph()->NewNode(machine()->Word32Clz(),
538 GetReplacementLow(input)), 538 GetReplacementLow(input)),
539 graph()->NewNode(common()->Int32Constant(32))), 539 graph()->NewNode(common()->Int32Constant(32))),
540 graph()->NewNode(machine()->Word32Clz(), GetReplacementHigh(input))); 540 graph()->NewNode(machine()->Word32Clz(), GetReplacementHigh(input)));
541 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0))); 541 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0)));
542 break; 542 break;
543 } 543 }
544 // kExprI64Ctz: 544 // kExprI64Ctz:
545 case IrOpcode::kWord64Ctz: {
546 DCHECK(node->InputCount() == 1);
547 DCHECK(machine()->Word32Ctz().IsSupported());
548 Node* input = node->InputAt(0);
549 Diamond d(
550 graph(), common(),
551 graph()->NewNode(machine()->Word32Equal(), GetReplacementLow(input),
552 graph()->NewNode(common()->Int32Constant(0))));
553 Node* low_node =
554 d.Phi(MachineRepresentation::kWord32,
555 graph()->NewNode(machine()->Int32Add(),
556 graph()->NewNode(machine()->Word32Ctz().op(),
557 GetReplacementHigh(input)),
558 graph()->NewNode(common()->Int32Constant(32))),
559 graph()->NewNode(machine()->Word32Ctz().op(),
560 GetReplacementLow(input)));
561 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0)));
562 break;
563 }
564 // kExprI64Popcnt:
545 case IrOpcode::kWord64Popcnt: { 565 case IrOpcode::kWord64Popcnt: {
546 DCHECK(node->InputCount() == 1); 566 DCHECK(node->InputCount() == 1);
547 Node* input = node->InputAt(0); 567 Node* input = node->InputAt(0);
548 // We assume that a Word64Popcnt node only has been created if 568 // We assume that a Word64Popcnt node only has been created if
549 // Word32Popcnt is actually supported. 569 // Word32Popcnt is actually supported.
550 DCHECK(machine()->Word32Popcnt().IsSupported()); 570 DCHECK(machine()->Word32Popcnt().IsSupported());
551 ReplaceNode(node, graph()->NewNode( 571 ReplaceNode(node, graph()->NewNode(
552 machine()->Int32Add(), 572 machine()->Int32Add(),
553 graph()->NewNode(machine()->Word32Popcnt().op(), 573 graph()->NewNode(machine()->Word32Popcnt().op(),
554 GetReplacementLow(input)), 574 GetReplacementLow(input)),
555 graph()->NewNode(machine()->Word32Popcnt().op(), 575 graph()->NewNode(machine()->Word32Popcnt().op(),
556 GetReplacementHigh(input))), 576 GetReplacementHigh(input))),
557 graph()->NewNode(common()->Int32Constant(0))); 577 graph()->NewNode(common()->Int32Constant(0)));
558 break; 578 break;
559 } 579 }
560 // kExprI64Popcnt:
561 580
562 default: { DefaultLowering(node); } 581 default: { DefaultLowering(node); }
563 } 582 }
564 } 583 }
565 584
566 void Int64Lowering::LowerComparison(Node* node, const Operator* high_word_op, 585 void Int64Lowering::LowerComparison(Node* node, const Operator* high_word_op,
567 const Operator* low_word_op) { 586 const Operator* low_word_op) {
568 DCHECK(node->InputCount() == 2); 587 DCHECK(node->InputCount() == 2);
569 Node* left = node->InputAt(0); 588 Node* left = node->InputAt(0);
570 Node* right = node->InputAt(1); 589 Node* right = node->InputAt(1);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 } 639 }
621 640
622 Node* Int64Lowering::GetReplacementHigh(Node* node) { 641 Node* Int64Lowering::GetReplacementHigh(Node* node) {
623 Node* result = replacements_[node->id()].high; 642 Node* result = replacements_[node->id()].high;
624 DCHECK(result); 643 DCHECK(result);
625 return result; 644 return result;
626 } 645 }
627 } // namespace compiler 646 } // namespace compiler
628 } // namespace internal 647 } // namespace internal
629 } // namespace v8 648 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698