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

Side by Side Diff: test/unittests/compiler/int64-lowering-unittest.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/linkage.h" 7 #include "src/compiler/linkage.h"
8 #include "src/compiler/machine-operator.h" 8 #include "src/compiler/machine-operator.h"
9 #include "src/compiler/node.h" 9 #include "src/compiler/node.h"
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 int64_t value(int i) { return value_[i]; } 79 int64_t value(int i) { return value_[i]; }
80 80
81 int32_t low_word_value(int i) { 81 int32_t low_word_value(int i) {
82 return static_cast<int32_t>(value_[i] & 0xffffffff); 82 return static_cast<int32_t>(value_[i] & 0xffffffff);
83 } 83 }
84 84
85 int32_t high_word_value(int i) { 85 int32_t high_word_value(int i) {
86 return static_cast<int32_t>(value_[i] >> 32); 86 return static_cast<int32_t>(value_[i] >> 32);
87 } 87 }
88 88
89 void TestLexicographicOrdering(
90 const Operator* op,
91 Matcher<Node*> (*high_word_matcher)(const Matcher<Node*>& lhs_matcher,
92 const Matcher<Node*>& rhs_matcher),
93 Matcher<Node*> (*low_word_matcher)(const Matcher<Node*>& lhs_matcher,
94 const Matcher<Node*>& rhs_matcher)) {
95 LowerGraph(
96 graph()->NewNode(op, Int64Constant(value(0)), Int64Constant(value(1))),
97 MachineRepresentation::kWord32);
98 EXPECT_THAT(
99 graph()->end()->InputAt(1),
100 IsReturn(IsWord32Or(
101 high_word_matcher(IsInt32Constant(high_word_value(0)),
102 IsInt32Constant(high_word_value(1))),
103 IsWord32And(
104 IsWord32Equal(IsInt32Constant(high_word_value(0)),
105 IsInt32Constant(high_word_value(1))),
106 low_word_matcher(IsInt32Constant(low_word_value(0)),
107 IsInt32Constant(low_word_value(1))))),
108 start(), start()));
109 }
110
89 private: 111 private:
90 MachineOperatorBuilder machine_; 112 MachineOperatorBuilder machine_;
91 int64_t value_[3]; 113 int64_t value_[3];
92 }; 114 };
93 115
94 TEST_F(Int64LoweringTest, Int64Constant) { 116 TEST_F(Int64LoweringTest, Int64Constant) {
95 if (4 != kPointerSize) return; 117 if (4 != kPointerSize) return;
96 118
97 LowerGraph(Int64Constant(value(0)), MachineRepresentation::kWord64); 119 LowerGraph(Int64Constant(value(0)), MachineRepresentation::kWord64);
98 EXPECT_THAT(graph()->end()->InputAt(1), 120 EXPECT_THAT(graph()->end()->InputAt(1),
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 IsWord32Xor(IsInt32Constant(high_word_value(0)), 354 IsWord32Xor(IsInt32Constant(high_word_value(0)),
333 IsInt32Constant(high_word_value(1))), 355 IsInt32Constant(high_word_value(1))),
334 start(), start())); 356 start(), start()));
335 } 357 }
336 // kExprI64Shl: 358 // kExprI64Shl:
337 // kExprI64ShrU: 359 // kExprI64ShrU:
338 // kExprI64ShrS: 360 // kExprI64ShrS:
339 // kExprI64Eq: 361 // kExprI64Eq:
340 // kExprI64Ne: 362 // kExprI64Ne:
341 // kExprI64LtS: 363 // kExprI64LtS:
364 TEST_F(Int64LoweringTest, Int64LtS) {
365 if (4 != kPointerSize) return;
366 TestLexicographicOrdering(machine()->Int64LessThan(), IsInt32LessThan,
367 IsUint32LessThan);
368 }
342 // kExprI64LeS: 369 // kExprI64LeS:
370 TEST_F(Int64LoweringTest, Int64LeS) {
371 if (4 != kPointerSize) return;
372 TestLexicographicOrdering(machine()->Int64LessThanOrEqual(), IsInt32LessThan,
373 IsUint32LessThanOrEqual);
374 }
343 // kExprI64LtU: 375 // kExprI64LtU:
376 TEST_F(Int64LoweringTest, Int64LtU) {
377 if (4 != kPointerSize) return;
378 TestLexicographicOrdering(machine()->Uint64LessThan(), IsUint32LessThan,
379 IsUint32LessThan);
380 }
344 // kExprI64LeU: 381 // kExprI64LeU:
345 // kExprI64GtS: 382 TEST_F(Int64LoweringTest, Int64LeU) {
346 // kExprI64GeS: 383 if (4 != kPointerSize) return;
347 // kExprI64GtU: 384 TestLexicographicOrdering(machine()->Uint64LessThanOrEqual(),
348 // kExprI64GeU: 385 IsUint32LessThan, IsUint32LessThanOrEqual);
386 }
349 387
350 // kExprI32ConvertI64: 388 // kExprI32ConvertI64:
351 // kExprI64SConvertI32: 389 // kExprI64SConvertI32:
352 // kExprI64UConvertI32: 390 // kExprI64UConvertI32:
353 391
354 // kExprF64ReinterpretI64: 392 // kExprF64ReinterpretI64:
355 // kExprI64ReinterpretF64: 393 // kExprI64ReinterpretF64:
356 394
357 // kExprI64Clz: 395 // kExprI64Clz:
358 // kExprI64Ctz: 396 // kExprI64Ctz:
359 // kExprI64Popcnt: 397 // kExprI64Popcnt:
360 398
361 // kExprF32SConvertI64: 399 // kExprF32SConvertI64:
362 // kExprF32UConvertI64: 400 // kExprF32UConvertI64:
363 // kExprF64SConvertI64: 401 // kExprF64SConvertI64:
364 // kExprF64UConvertI64: 402 // kExprF64UConvertI64:
365 // kExprI64SConvertF32: 403 // kExprI64SConvertF32:
366 // kExprI64SConvertF64: 404 // kExprI64SConvertF64:
367 // kExprI64UConvertF32: 405 // kExprI64UConvertF32:
368 // kExprI64UConvertF64: 406 // kExprI64UConvertF64:
369 407
370 } // namespace compiler 408 } // namespace compiler
371 } // namespace internal 409 } // namespace internal
372 } // namespace v8 410 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698