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

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

Issue 1729263002: [wasm] I added comparison operators to the Int64Lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 4 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/int64-lowering.h ('k') | src/compiler/wasm-compiler.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/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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 GetReplacementLow(right)), 306 GetReplacementLow(right)),
307 graph()->NewNode(machine()->Word32Xor(), GetReplacementHigh(left), 307 graph()->NewNode(machine()->Word32Xor(), GetReplacementHigh(left),
308 GetReplacementHigh(right))), 308 GetReplacementHigh(right))),
309 graph()->NewNode(common()->Int32Constant(0))); 309 graph()->NewNode(common()->Int32Constant(0)));
310 310
311 ReplaceNode(node, replacement, nullptr); 311 ReplaceNode(node, replacement, nullptr);
312 break; 312 break;
313 } 313 }
314 // kExprI64Ne: 314 // kExprI64Ne:
315 // kExprI64LtS: 315 // kExprI64LtS:
316 // kExprI64LeS: 316 case IrOpcode::kInt64LessThan: {
317 // kExprI64LtU: 317 LowerComparison(node, machine()->Int32LessThan(),
318 // kExprI64LeU: 318 machine()->Uint32LessThan());
319 // kExprI64GtS: 319 break;
320 // kExprI64GeS: 320 }
321 // kExprI64GtU: 321 case IrOpcode::kInt64LessThanOrEqual: {
322 // kExprI64GeU: 322 LowerComparison(node, machine()->Int32LessThan(),
323 machine()->Uint32LessThanOrEqual());
324 break;
325 }
326 case IrOpcode::kUint64LessThan: {
327 LowerComparison(node, machine()->Uint32LessThan(),
328 machine()->Uint32LessThan());
329 break;
330 }
331 case IrOpcode::kUint64LessThanOrEqual: {
332 LowerComparison(node, machine()->Uint32LessThan(),
333 machine()->Uint32LessThanOrEqual());
334 break;
335 }
323 336
324 // kExprI64SConvertI32: 337 // kExprI64SConvertI32:
325 // kExprI64UConvertI32: 338 // kExprI64UConvertI32:
326 339
327 // kExprF64ReinterpretI64: 340 // kExprF64ReinterpretI64:
328 // kExprI64ReinterpretF64: 341 // kExprI64ReinterpretF64:
329 342
330 // kExprI64Clz: 343 // kExprI64Clz:
331 // kExprI64Ctz: 344 // kExprI64Ctz:
332 // kExprI64Popcnt: 345 // kExprI64Popcnt:
333 346
334 // kExprF32SConvertI64: 347 // kExprF32SConvertI64:
335 // kExprF32UConvertI64: 348 // kExprF32UConvertI64:
336 // kExprF64SConvertI64: 349 // kExprF64SConvertI64:
337 // kExprF64UConvertI64: 350 // kExprF64UConvertI64:
338 // kExprI64SConvertF32: 351 // kExprI64SConvertF32:
339 // kExprI64SConvertF64: 352 // kExprI64SConvertF64:
340 // kExprI64UConvertF32: 353 // kExprI64UConvertF32:
341 // kExprI64UConvertF64: 354 // kExprI64UConvertF64:
342 default: { DefaultLowering(node); } 355 default: { DefaultLowering(node); }
343 } 356 }
344 } 357 }
345 358
359 void Int64Lowering::LowerComparison(Node* node, const Operator* high_word_op,
360 const Operator* low_word_op) {
361 DCHECK(node->InputCount() == 2);
362 Node* left = node->InputAt(0);
363 Node* right = node->InputAt(1);
364 Node* replacement = graph()->NewNode(
365 machine()->Word32Or(),
366 graph()->NewNode(high_word_op, GetReplacementHigh(left),
367 GetReplacementHigh(right)),
368 graph()->NewNode(
369 machine()->Word32And(),
370 graph()->NewNode(machine()->Word32Equal(), GetReplacementHigh(left),
371 GetReplacementHigh(right)),
372 graph()->NewNode(low_word_op, GetReplacementLow(left),
373 GetReplacementLow(right))));
374
375 ReplaceNode(node, replacement, nullptr);
376 }
377
346 bool Int64Lowering::DefaultLowering(Node* node) { 378 bool Int64Lowering::DefaultLowering(Node* node) {
347 bool something_changed = false; 379 bool something_changed = false;
348 for (int i = NodeProperties::PastValueIndex(node) - 1; i >= 0; i--) { 380 for (int i = NodeProperties::PastValueIndex(node) - 1; i >= 0; i--) {
349 Node* input = node->InputAt(i); 381 Node* input = node->InputAt(i);
350 if (HasReplacementLow(input)) { 382 if (HasReplacementLow(input)) {
351 something_changed = true; 383 something_changed = true;
352 node->ReplaceInput(i, GetReplacementLow(input)); 384 node->ReplaceInput(i, GetReplacementLow(input));
353 } 385 }
354 if (HasReplacementHigh(input)) { 386 if (HasReplacementHigh(input)) {
355 something_changed = true; 387 something_changed = true;
(...skipping 25 matching lines...) Expand all
381 } 413 }
382 414
383 Node* Int64Lowering::GetReplacementHigh(Node* node) { 415 Node* Int64Lowering::GetReplacementHigh(Node* node) {
384 Node* result = replacements_[node->id()].high; 416 Node* result = replacements_[node->id()].high;
385 DCHECK(result); 417 DCHECK(result);
386 return result; 418 return result;
387 } 419 }
388 } // namespace compiler 420 } // namespace compiler
389 } // namespace internal 421 } // namespace internal
390 } // namespace v8 422 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/int64-lowering.h ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698