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 1768233002: [wasm] Int64Lowering of I64ShrU and I64ShrS on ia32. (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 | « src/compiler/instruction-selector.cc ('k') | 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/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 node->InsertInput(zone(), 1, GetReplacementHigh(value)); 305 node->InsertInput(zone(), 1, GetReplacementHigh(value));
306 306
307 NodeProperties::ChangeOp(node, machine()->Word32PairShl()); 307 NodeProperties::ChangeOp(node, machine()->Word32PairShl());
308 // We access the additional return values through projections. 308 // We access the additional return values through projections.
309 Node* low_node = graph()->NewNode(common()->Projection(0), node); 309 Node* low_node = graph()->NewNode(common()->Projection(0), node);
310 Node* high_node = graph()->NewNode(common()->Projection(1), node); 310 Node* high_node = graph()->NewNode(common()->Projection(1), node);
311 ReplaceNode(node, low_node, high_node); 311 ReplaceNode(node, low_node, high_node);
312 break; 312 break;
313 } 313 }
314 // kExprI64ShrU: 314 // kExprI64ShrU:
315 case IrOpcode::kWord64Shr: {
316 // TODO(turbofan): if the shift count >= 32, then we can set the low word
317 // of the output to 0 and just calculate the high word.
318 DCHECK(node->InputCount() == 2);
319 Node* shift = node->InputAt(1);
320 if (HasReplacementLow(shift)) {
321 // We do not have to care about the high word replacement, because
322 // the shift can only be between 0 and 63 anyways.
323 node->ReplaceInput(1, GetReplacementLow(shift));
324 }
325
326 Node* value = node->InputAt(0);
327 node->ReplaceInput(0, GetReplacementLow(value));
328 node->InsertInput(zone(), 1, GetReplacementHigh(value));
329
330 NodeProperties::ChangeOp(node, machine()->Word32PairShr());
331 // We access the additional return values through projections.
332 Node* low_node = graph()->NewNode(common()->Projection(0), node);
333 Node* high_node = graph()->NewNode(common()->Projection(1), node);
334 ReplaceNode(node, low_node, high_node);
335 break;
336 }
315 // kExprI64ShrS: 337 // kExprI64ShrS:
338 case IrOpcode::kWord64Sar: {
339 // TODO(turbofan): if the shift count >= 32, then we can set the low word
340 // of the output to 0 and just calculate the high word.
341 DCHECK(node->InputCount() == 2);
342 Node* shift = node->InputAt(1);
343 if (HasReplacementLow(shift)) {
344 // We do not have to care about the high word replacement, because
345 // the shift can only be between 0 and 63 anyways.
346 node->ReplaceInput(1, GetReplacementLow(shift));
347 }
348
349 Node* value = node->InputAt(0);
350 node->ReplaceInput(0, GetReplacementLow(value));
351 node->InsertInput(zone(), 1, GetReplacementHigh(value));
352
353 NodeProperties::ChangeOp(node, machine()->Word32PairSar());
354 // We access the additional return values through projections.
355 Node* low_node = graph()->NewNode(common()->Projection(0), node);
356 Node* high_node = graph()->NewNode(common()->Projection(1), node);
357 ReplaceNode(node, low_node, high_node);
358 break;
359 }
316 // kExprI64Eq: 360 // kExprI64Eq:
317 case IrOpcode::kWord64Equal: { 361 case IrOpcode::kWord64Equal: {
318 DCHECK(node->InputCount() == 2); 362 DCHECK(node->InputCount() == 2);
319 Node* left = node->InputAt(0); 363 Node* left = node->InputAt(0);
320 Node* right = node->InputAt(1); 364 Node* right = node->InputAt(1);
321 365
322 // TODO(wasm): Use explicit comparisons and && here? 366 // TODO(wasm): Use explicit comparisons and && here?
323 Node* replacement = graph()->NewNode( 367 Node* replacement = graph()->NewNode(
324 machine()->Word32Equal(), 368 machine()->Word32Equal(),
325 graph()->NewNode( 369 graph()->NewNode(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 470 }
427 471
428 Node* Int64Lowering::GetReplacementHigh(Node* node) { 472 Node* Int64Lowering::GetReplacementHigh(Node* node) {
429 Node* result = replacements_[node->id()].high; 473 Node* result = replacements_[node->id()].high;
430 DCHECK(result); 474 DCHECK(result);
431 return result; 475 return result;
432 } 476 }
433 } // namespace compiler 477 } // namespace compiler
434 } // namespace internal 478 } // namespace internal
435 } // namespace v8 479 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698