OLD | NEW |
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 // todo(ahaas): I added a list of missing instructions here to make merging | 302 // todo(ahaas): I added a list of missing instructions here to make merging |
303 // easier when I do them one by one. | 303 // easier when I do them one by one. |
304 // kExprI64Add: | 304 // kExprI64Add: |
305 // kExprI64Sub: | 305 // kExprI64Sub: |
306 // kExprI64Mul: | 306 // kExprI64Mul: |
307 // kExprI64DivS: | 307 // kExprI64DivS: |
308 // kExprI64DivU: | 308 // kExprI64DivU: |
309 // kExprI64RemS: | 309 // kExprI64RemS: |
310 // kExprI64RemU: | 310 // kExprI64RemU: |
311 // kExprI64And: | |
312 // kExprI64Ior: | 311 // kExprI64Ior: |
313 TEST_F(Int64LoweringTest, Int64Ior) { | 312 TEST_F(Int64LoweringTest, Int64Ior) { |
314 LowerGraph(graph()->NewNode(machine()->Word64Or(), Int64Constant(value(0)), | 313 LowerGraph(graph()->NewNode(machine()->Word64Or(), Int64Constant(value(0)), |
315 Int64Constant(value(1))), | 314 Int64Constant(value(1))), |
316 MachineRepresentation::kWord64); | 315 MachineRepresentation::kWord64); |
317 EXPECT_THAT(graph()->end()->InputAt(1), | 316 EXPECT_THAT(graph()->end()->InputAt(1), |
318 IsReturn2(IsWord32Or(IsInt32Constant(low_word_value(0)), | 317 IsReturn2(IsWord32Or(IsInt32Constant(low_word_value(0)), |
319 IsInt32Constant(low_word_value(1))), | 318 IsInt32Constant(low_word_value(1))), |
320 IsWord32Or(IsInt32Constant(high_word_value(0)), | 319 IsWord32Or(IsInt32Constant(high_word_value(0)), |
321 IsInt32Constant(high_word_value(1))), | 320 IsInt32Constant(high_word_value(1))), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 graph()->end()->InputAt(1), | 360 graph()->end()->InputAt(1), |
362 IsReturn(IsWord32Equal( | 361 IsReturn(IsWord32Equal( |
363 IsWord32Or(IsWord32Xor(IsInt32Constant(low_word_value(0)), | 362 IsWord32Or(IsWord32Xor(IsInt32Constant(low_word_value(0)), |
364 IsInt32Constant(low_word_value(1))), | 363 IsInt32Constant(low_word_value(1))), |
365 IsWord32Xor(IsInt32Constant(high_word_value(0)), | 364 IsWord32Xor(IsInt32Constant(high_word_value(0)), |
366 IsInt32Constant(high_word_value(1)))), | 365 IsInt32Constant(high_word_value(1)))), |
367 IsInt32Constant(0)), | 366 IsInt32Constant(0)), |
368 start(), start())); | 367 start(), start())); |
369 } | 368 } |
370 | 369 |
371 // kExprI64Ne: | |
372 // kExprI64LtS: | 370 // kExprI64LtS: |
373 TEST_F(Int64LoweringTest, Int64LtS) { | 371 TEST_F(Int64LoweringTest, Int64LtS) { |
374 TestComparison(machine()->Int64LessThan(), IsInt32LessThan, IsUint32LessThan); | 372 TestComparison(machine()->Int64LessThan(), IsInt32LessThan, IsUint32LessThan); |
375 } | 373 } |
376 // kExprI64LeS: | 374 // kExprI64LeS: |
377 TEST_F(Int64LoweringTest, Int64LeS) { | 375 TEST_F(Int64LoweringTest, Int64LeS) { |
378 TestComparison(machine()->Int64LessThanOrEqual(), IsInt32LessThan, | 376 TestComparison(machine()->Int64LessThanOrEqual(), IsInt32LessThan, |
379 IsUint32LessThanOrEqual); | 377 IsUint32LessThanOrEqual); |
380 } | 378 } |
381 // kExprI64LtU: | 379 // kExprI64LtU: |
382 TEST_F(Int64LoweringTest, Int64LtU) { | 380 TEST_F(Int64LoweringTest, Int64LtU) { |
383 TestComparison(machine()->Uint64LessThan(), IsUint32LessThan, | 381 TestComparison(machine()->Uint64LessThan(), IsUint32LessThan, |
384 IsUint32LessThan); | 382 IsUint32LessThan); |
385 } | 383 } |
386 // kExprI64LeU: | 384 // kExprI64LeU: |
387 TEST_F(Int64LoweringTest, Int64LeU) { | 385 TEST_F(Int64LoweringTest, Int64LeU) { |
388 TestComparison(machine()->Uint64LessThanOrEqual(), IsUint32LessThan, | 386 TestComparison(machine()->Uint64LessThanOrEqual(), IsUint32LessThan, |
389 IsUint32LessThanOrEqual); | 387 IsUint32LessThanOrEqual); |
390 } | 388 } |
391 | 389 |
392 // kExprI32ConvertI64: | 390 // kExprI32ConvertI64: |
| 391 TEST_F(Int64LoweringTest, I32ConvertI64) { |
| 392 LowerGraph(graph()->NewNode(machine()->TruncateInt64ToInt32(), |
| 393 Int64Constant(value(0))), |
| 394 MachineRepresentation::kWord32); |
| 395 EXPECT_THAT(graph()->end()->InputAt(1), |
| 396 IsReturn(IsInt32Constant(low_word_value(0)), start(), start())); |
| 397 } |
393 // kExprI64SConvertI32: | 398 // kExprI64SConvertI32: |
394 // kExprI64UConvertI32: | 399 // kExprI64UConvertI32: |
395 | 400 |
396 // kExprF64ReinterpretI64: | 401 // kExprF64ReinterpretI64: |
397 // kExprI64ReinterpretF64: | 402 // kExprI64ReinterpretF64: |
398 | 403 |
399 // kExprI64Clz: | 404 // kExprI64Clz: |
400 // kExprI64Ctz: | 405 // kExprI64Ctz: |
401 // kExprI64Popcnt: | 406 // kExprI64Popcnt: |
402 | |
403 // kExprF32SConvertI64: | |
404 // kExprF32UConvertI64: | |
405 // kExprF64SConvertI64: | |
406 // kExprF64UConvertI64: | |
407 // kExprI64SConvertF32: | |
408 // kExprI64SConvertF64: | |
409 // kExprI64UConvertF32: | |
410 // kExprI64UConvertF64: | |
411 | |
412 } // namespace compiler | 407 } // namespace compiler |
413 } // namespace internal | 408 } // namespace internal |
414 } // namespace v8 | 409 } // namespace v8 |
OLD | NEW |