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

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

Issue 1810473002: [wasm] Int64Lowering of Word64Clz. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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.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/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/graph.h" 8 #include "src/compiler/graph.h"
8 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
9 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-properties.h" 11 #include "src/compiler/node-properties.h"
11 12
12 #include "src/compiler/node.h" 13 #include "src/compiler/node.h"
13 #include "src/wasm/wasm-module.h" 14 #include "src/wasm/wasm-module.h"
14 #include "src/zone.h" 15 #include "src/zone.h"
15 16
16 namespace v8 { 17 namespace v8 {
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 graph()->start()); 498 graph()->start());
498 499
499 Node* low_node = 500 Node* low_node =
500 graph()->NewNode(machine()->Load(MachineType::Int32()), stack_slot, 501 graph()->NewNode(machine()->Load(MachineType::Int32()), stack_slot,
501 graph()->NewNode(common()->Int32Constant(0)), store, 502 graph()->NewNode(common()->Int32Constant(0)), store,
502 graph()->start()); 503 graph()->start());
503 ReplaceNode(node, low_node, high_node); 504 ReplaceNode(node, low_node, high_node);
504 break; 505 break;
505 } 506 }
506 // kExprI64Clz: 507 // kExprI64Clz:
508 case IrOpcode::kWord64Clz: {
509 DCHECK(node->InputCount() == 1);
510 Node* input = node->InputAt(0);
511 Diamond d(
512 graph(), common(),
513 graph()->NewNode(machine()->Word32Equal(), GetReplacementHigh(input),
514 graph()->NewNode(common()->Int32Constant(0))));
515
516 Node* low_node = d.Phi(
517 MachineRepresentation::kWord32,
518 graph()->NewNode(machine()->Int32Add(),
519 graph()->NewNode(machine()->Word32Clz(),
520 GetReplacementLow(input)),
521 graph()->NewNode(common()->Int32Constant(32))),
522 graph()->NewNode(machine()->Word32Clz(), GetReplacementHigh(input)));
523 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0)));
524 break;
525 }
507 // kExprI64Ctz: 526 // kExprI64Ctz:
508 case IrOpcode::kWord64Popcnt: { 527 case IrOpcode::kWord64Popcnt: {
509 DCHECK(node->InputCount() == 1); 528 DCHECK(node->InputCount() == 1);
510 Node* input = node->InputAt(0); 529 Node* input = node->InputAt(0);
511 // We assume that a Word64Popcnt node only has been created if 530 // We assume that a Word64Popcnt node only has been created if
512 // Word32Popcnt is actually supported. 531 // Word32Popcnt is actually supported.
513 DCHECK(machine()->Word32Popcnt().IsSupported()); 532 DCHECK(machine()->Word32Popcnt().IsSupported());
514 ReplaceNode(node, graph()->NewNode( 533 ReplaceNode(node, graph()->NewNode(
515 machine()->Int32Add(), 534 machine()->Int32Add(),
516 graph()->NewNode(machine()->Word32Popcnt().op(), 535 graph()->NewNode(machine()->Word32Popcnt().op(),
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } 602 }
584 603
585 Node* Int64Lowering::GetReplacementHigh(Node* node) { 604 Node* Int64Lowering::GetReplacementHigh(Node* node) {
586 Node* result = replacements_[node->id()].high; 605 Node* result = replacements_[node->id()].high;
587 DCHECK(result); 606 DCHECK(result);
588 return result; 607 return result;
589 } 608 }
590 } // namespace compiler 609 } // namespace compiler
591 } // namespace internal 610 } // namespace internal
592 } // namespace v8 611 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/machine-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698