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

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: 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
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 GetReplacementHigh(right)); 287 GetReplacementHigh(right));
288 ReplaceNode(node, low_node, high_node); 288 ReplaceNode(node, low_node, high_node);
289 break; 289 break;
290 } 290 }
291 // kExprI64Shl: 291 // kExprI64Shl:
292 // kExprI64ShrU: 292 // kExprI64ShrU:
293 // kExprI64ShrS: 293 // kExprI64ShrS:
294 // kExprI64Eq: 294 // kExprI64Eq:
295 // kExprI64Ne: 295 // kExprI64Ne:
296 // kExprI64LtS: 296 // kExprI64LtS:
297 case IrOpcode::kInt64LessThan: {
298 LowerComparisonToLexicographicComparison(node, machine()->Int32LessThan(),
299 machine()->Uint32LessThan());
300 break;
301 }
297 // kExprI64LeS: 302 // kExprI64LeS:
303 case IrOpcode::kInt64LessThanOrEqual: {
304 LowerComparisonToLexicographicComparison(
305 node, machine()->Int32LessThan(), machine()->Uint32LessThanOrEqual());
306 break;
307 }
298 // kExprI64LtU: 308 // kExprI64LtU:
309 case IrOpcode::kUint64LessThan: {
310 LowerComparisonToLexicographicComparison(
311 node, machine()->Uint32LessThan(), machine()->Uint32LessThan());
312 break;
313 }
299 // kExprI64LeU: 314 // kExprI64LeU:
300 // kExprI64GtS: 315 case IrOpcode::kUint64LessThanOrEqual: {
301 // kExprI64GeS: 316 LowerComparisonToLexicographicComparison(
302 // kExprI64GtU: 317 node, machine()->Uint32LessThan(),
303 // kExprI64GeU: 318 machine()->Uint32LessThanOrEqual());
319 break;
320 }
304 321
305 // kExprI64SConvertI32: 322 // kExprI64SConvertI32:
306 // kExprI64UConvertI32: 323 // kExprI64UConvertI32:
307 324
308 // kExprF64ReinterpretI64: 325 // kExprF64ReinterpretI64:
309 // kExprI64ReinterpretF64: 326 // kExprI64ReinterpretF64:
310 327
311 // kExprI64Clz: 328 // kExprI64Clz:
312 // kExprI64Ctz: 329 // kExprI64Ctz:
313 // kExprI64Popcnt: 330 // kExprI64Popcnt:
314 331
315 // kExprF32SConvertI64: 332 // kExprF32SConvertI64:
316 // kExprF32UConvertI64: 333 // kExprF32UConvertI64:
317 // kExprF64SConvertI64: 334 // kExprF64SConvertI64:
318 // kExprF64UConvertI64: 335 // kExprF64UConvertI64:
319 // kExprI64SConvertF32: 336 // kExprI64SConvertF32:
320 // kExprI64SConvertF64: 337 // kExprI64SConvertF64:
321 // kExprI64UConvertF32: 338 // kExprI64UConvertF32:
322 // kExprI64UConvertF64: 339 // kExprI64UConvertF64:
323 default: { DefaultLowering(node); } 340 default: { DefaultLowering(node); }
324 } 341 }
325 } 342 }
326 343
344 void Int64Lowering::LowerComparisonToLexicographicComparison(
345 Node* node, const Operator* high_word_op, const Operator* low_word_op) {
346 DCHECK(node->InputCount() == 2);
347 Node* left = node->InputAt(0);
348 Node* right = node->InputAt(1);
349 Node* replacement = graph()->NewNode(
350 machine()->Word32Or(),
351 graph()->NewNode(high_word_op, GetReplacementHigh(left),
352 GetReplacementHigh(right)),
353 graph()->NewNode(
354 machine()->Word32And(),
355 graph()->NewNode(machine()->Word32Equal(), GetReplacementHigh(left),
356 GetReplacementHigh(right)),
357 graph()->NewNode(low_word_op, GetReplacementLow(left),
358 GetReplacementLow(right))));
359
360 ReplaceNode(node, replacement, nullptr);
361 }
362
327 bool Int64Lowering::DefaultLowering(Node* node) { 363 bool Int64Lowering::DefaultLowering(Node* node) {
328 bool something_changed = false; 364 bool something_changed = false;
329 for (int i = NodeProperties::PastValueIndex(node) - 1; i >= 0; i--) { 365 for (int i = NodeProperties::PastValueIndex(node) - 1; i >= 0; i--) {
330 Node* input = node->InputAt(i); 366 Node* input = node->InputAt(i);
331 if (HasReplacementLow(input)) { 367 if (HasReplacementLow(input)) {
332 something_changed = true; 368 something_changed = true;
333 node->ReplaceInput(i, GetReplacementLow(input)); 369 node->ReplaceInput(i, GetReplacementLow(input));
334 } 370 }
335 if (HasReplacementHigh(input)) { 371 if (HasReplacementHigh(input)) {
336 something_changed = true; 372 something_changed = true;
(...skipping 25 matching lines...) Expand all
362 } 398 }
363 399
364 Node* Int64Lowering::GetReplacementHigh(Node* node) { 400 Node* Int64Lowering::GetReplacementHigh(Node* node) {
365 Node* result = replacements_[node->id()].high; 401 Node* result = replacements_[node->id()].high;
366 DCHECK(result); 402 DCHECK(result);
367 return result; 403 return result;
368 } 404 }
369 } // namespace compiler 405 } // namespace compiler
370 } // namespace internal 406 } // namespace internal
371 } // namespace v8 407 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698