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

Side by Side Diff: test/unittests/compiler/int64-lowering-unittest.cc

Issue 1729493002: [wasm] I added I64Eq to the Int64Lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int64-lowering-xor
Patch Set: 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
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
11 #include "src/compiler/node-properties.h" 11 #include "src/compiler/node-properties.h"
12 12
13 #include "src/signature.h" 13 #include "src/signature.h"
14 14
15 #include "src/wasm/wasm-module.h" 15 #include "src/wasm/wasm-module.h"
16 16
17 #include "test/unittests/compiler/graph-unittest.h" 17 #include "test/unittests/compiler/graph-unittest.h"
18 #include "test/unittests/compiler/node-test-utils.h" 18 #include "test/unittests/compiler/node-test-utils.h"
19 #include "testing/gmock-support.h"
20
21 using testing::AllOf;
22 using testing::Capture;
23 using testing::CaptureEq;
19 24
20 namespace v8 { 25 namespace v8 {
21 namespace internal { 26 namespace internal {
22 namespace compiler { 27 namespace compiler {
23 28
24 class Int64LoweringTest : public GraphTest { 29 class Int64LoweringTest : public GraphTest {
25 public: 30 public:
26 Int64LoweringTest() : GraphTest(), machine_(zone()) { 31 Int64LoweringTest() : GraphTest(), machine_(zone()) {
27 value_[0] = 0x1234567890abcdef; 32 value_[0] = 0x1234567890abcdef;
28 value_[1] = 0x1edcba098765432f; 33 value_[1] = 0x1edcba098765432f;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (4 != kPointerSize) return; 104 if (4 != kPointerSize) return;
100 105
101 int32_t base = 0x1234; 106 int32_t base = 0x1234;
102 int32_t index = 0x5678; 107 int32_t index = 0x5678;
103 108
104 LowerGraph(graph()->NewNode(machine()->Load(MachineType::Int64()), 109 LowerGraph(graph()->NewNode(machine()->Load(MachineType::Int64()),
105 Int32Constant(base), Int32Constant(index), 110 Int32Constant(base), Int32Constant(index),
106 start(), start()), 111 start(), start()),
107 MachineRepresentation::kWord64); 112 MachineRepresentation::kWord64);
108 113
114 Capture<Node*> high_word_load;
109 Matcher<Node*> high_word_load_matcher = 115 Matcher<Node*> high_word_load_matcher =
110 IsLoad(MachineType::Int32(), IsInt32Constant(base), 116 IsLoad(MachineType::Int32(), IsInt32Constant(base),
111 IsInt32Add(IsInt32Constant(index), IsInt32Constant(0x4)), start(), 117 IsInt32Add(IsInt32Constant(index), IsInt32Constant(0x4)), start(),
112 start()); 118 start());
113 119
114 EXPECT_THAT( 120 EXPECT_THAT(
115 graph()->end()->InputAt(1), 121 graph()->end()->InputAt(1),
116 IsReturn2(IsLoad(MachineType::Int32(), IsInt32Constant(base), 122 IsReturn2(IsLoad(MachineType::Int32(), IsInt32Constant(base),
117 IsInt32Constant(index), high_word_load_matcher, start()), 123 IsInt32Constant(index), AllOf(CaptureEq(&high_word_load),
118 high_word_load_matcher, start(), start())); 124 high_word_load_matcher),
125 start()),
126 AllOf(CaptureEq(&high_word_load), high_word_load_matcher),
127 start(), start()));
119 } 128 }
120 129
121 TEST_F(Int64LoweringTest, Int64Store) { 130 TEST_F(Int64LoweringTest, Int64Store) {
122 if (4 != kPointerSize) return; 131 if (4 != kPointerSize) return;
123 132
124 // We have to build the TF graph explicitly here because Store does not return 133 // We have to build the TF graph explicitly here because Store does not return
125 // a value. 134 // a value.
126 135
127 int32_t base = 1111; 136 int32_t base = 1111;
128 int32_t index = 2222; 137 int32_t index = 2222;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 0); 236 Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 0);
228 sig_builder.AddReturn(MachineRepresentation::kWord64); 237 sig_builder.AddReturn(MachineRepresentation::kWord64);
229 238
230 compiler::CallDescriptor* desc = 239 compiler::CallDescriptor* desc =
231 wasm::ModuleEnv::GetWasmCallDescriptor(zone(), sig_builder.Build()); 240 wasm::ModuleEnv::GetWasmCallDescriptor(zone(), sig_builder.Build());
232 241
233 LowerGraph(graph()->NewNode(common()->Call(desc), Int32Constant(function), 242 LowerGraph(graph()->NewNode(common()->Call(desc), Int32Constant(function),
234 start(), start()), 243 start(), start()),
235 MachineRepresentation::kWord64); 244 MachineRepresentation::kWord64);
236 245
246 Capture<Node*> call;
237 Matcher<Node*> call_matcher = 247 Matcher<Node*> call_matcher =
238 IsCall(testing::_, IsInt32Constant(function), start(), start()); 248 IsCall(testing::_, IsInt32Constant(function), start(), start());
239 249
240 EXPECT_THAT(graph()->end()->InputAt(1), 250 EXPECT_THAT(graph()->end()->InputAt(1),
241 IsReturn2(IsProjection(0, call_matcher), 251 IsReturn2(IsProjection(0, AllOf(CaptureEq(&call), call_matcher)),
242 IsProjection(1, call_matcher), start(), start())); 252 IsProjection(1, AllOf(CaptureEq(&call), call_matcher)),
253 start(), start()));
243 254
244 CompareCallDescriptors( 255 CompareCallDescriptors(
245 OpParameter<const CallDescriptor*>( 256 OpParameter<const CallDescriptor*>(
246 graph()->end()->InputAt(1)->InputAt(0)->InputAt(0)), 257 graph()->end()->InputAt(1)->InputAt(0)->InputAt(0)),
247 wasm::ModuleEnv::GetI32WasmCallDescriptor(zone(), desc)); 258 wasm::ModuleEnv::GetI32WasmCallDescriptor(zone(), desc));
248 } 259 }
249 260
250 TEST_F(Int64LoweringTest, CallI64Parameter) { 261 TEST_F(Int64LoweringTest, CallI64Parameter) {
251 if (4 != kPointerSize) return; 262 if (4 != kPointerSize) return;
252 263
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 IsReturn2(IsWord32Xor(IsInt32Constant(low_word_value(0)), 330 IsReturn2(IsWord32Xor(IsInt32Constant(low_word_value(0)),
320 IsInt32Constant(low_word_value(1))), 331 IsInt32Constant(low_word_value(1))),
321 IsWord32Xor(IsInt32Constant(high_word_value(0)), 332 IsWord32Xor(IsInt32Constant(high_word_value(0)),
322 IsInt32Constant(high_word_value(1))), 333 IsInt32Constant(high_word_value(1))),
323 start(), start())); 334 start(), start()));
324 } 335 }
325 // kExprI64Shl: 336 // kExprI64Shl:
326 // kExprI64ShrU: 337 // kExprI64ShrU:
327 // kExprI64ShrS: 338 // kExprI64ShrS:
328 // kExprI64Eq: 339 // kExprI64Eq:
340 TEST_F(Int64LoweringTest, Int64Eq) {
341 if (4 != kPointerSize) return;
342
343 LowerGraph(graph()->NewNode(machine()->Word64Equal(), Int64Constant(value(0)),
344 Int64Constant(value(1))),
345 MachineRepresentation::kWord32);
346 EXPECT_THAT(
347 graph()->end()->InputAt(1),
348 IsReturn(IsWord32Equal(
349 IsWord32Or(IsWord32Xor(IsInt32Constant(low_word_value(0)),
350 IsInt32Constant(low_word_value(1))),
351 IsWord32Xor(IsInt32Constant(high_word_value(0)),
352 IsInt32Constant(high_word_value(1)))),
353 IsInt32Constant(0)),
354 start(), start()));
355 }
356
329 // kExprI64Ne: 357 // kExprI64Ne:
330 // kExprI64LtS: 358 // kExprI64LtS:
331 // kExprI64LeS: 359 // kExprI64LeS:
332 // kExprI64LtU: 360 // kExprI64LtU:
333 // kExprI64LeU: 361 // kExprI64LeU:
334 // kExprI64GtS: 362 // kExprI64GtS:
335 // kExprI64GeS: 363 // kExprI64GeS:
336 // kExprI64GtU: 364 // kExprI64GtU:
337 // kExprI64GeU: 365 // kExprI64GeU:
338 366
(...skipping 13 matching lines...) Expand all
352 // kExprF64SConvertI64: 380 // kExprF64SConvertI64:
353 // kExprF64UConvertI64: 381 // kExprF64UConvertI64:
354 // kExprI64SConvertF32: 382 // kExprI64SConvertF32:
355 // kExprI64SConvertF64: 383 // kExprI64SConvertF64:
356 // kExprI64UConvertF32: 384 // kExprI64UConvertF32:
357 // kExprI64UConvertF64: 385 // kExprI64UConvertF64:
358 386
359 } // namespace compiler 387 } // namespace compiler
360 } // namespace internal 388 } // namespace internal
361 } // namespace v8 389 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698