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

Side by Side Diff: test/unittests/compiler/arm/instruction-selector-arm-unittest.cc

Issue 850073002: [turbofan] Allow 0.0 as immediate for floating-point comparison on arm/arm64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 <limits> 5 #include <limits>
6 6
7 #include "test/unittests/compiler/instruction-selector-unittest.h" 7 #include "test/unittests/compiler/instruction-selector-unittest.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 } 1472 }
1473 } 1473 }
1474 1474
1475 1475
1476 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, 1476 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
1477 InstructionSelectorComparisonTest, 1477 InstructionSelectorComparisonTest,
1478 ::testing::ValuesIn(kComparisons)); 1478 ::testing::ValuesIn(kComparisons));
1479 1479
1480 1480
1481 // ----------------------------------------------------------------------------- 1481 // -----------------------------------------------------------------------------
1482 // Floating point comparisons.
1483
1484
1485 const Comparison kFPComparisons[] = {
1486 {&RawMachineAssembler::Float64Equal, "Float64Equal", kEqual, kNotEqual},
1487 {&RawMachineAssembler::Float64LessThan, "Float64LessThan",
1488 kUnsignedLessThan, kUnsignedGreaterThanOrEqual},
1489 {&RawMachineAssembler::Float64LessThanOrEqual, "Float64LessThanOrEqual",
1490 kUnsignedLessThanOrEqual, kUnsignedGreaterThan}};
1491
1492
1493 typedef InstructionSelectorTestWithParam<Comparison>
1494 InstructionSelectorFPComparisonTest;
1495
1496
1497 TEST_P(InstructionSelectorFPComparisonTest, WithParameters) {
1498 const Comparison& cmp = GetParam();
1499 StreamBuilder m(this, kMachInt32, kMachFloat64, kMachFloat64);
1500 m.Return((m.*cmp.constructor)(m.Parameter(0), m.Parameter(1)));
1501 Stream const s = m.Build();
1502 ASSERT_EQ(1U, s.size());
1503 EXPECT_EQ(kArmVcmpF64, s[0]->arch_opcode());
1504 ASSERT_EQ(2U, s[0]->InputCount());
1505 ASSERT_EQ(1U, s[0]->OutputCount());
1506 EXPECT_EQ(kFlags_set, s[0]->flags_mode());
1507 EXPECT_EQ(cmp.flags_condition, s[0]->flags_condition());
1508 }
1509
1510
1511 TEST_P(InstructionSelectorFPComparisonTest, NegatedWithParameters) {
1512 const Comparison& cmp = GetParam();
1513 StreamBuilder m(this, kMachInt32, kMachFloat64, kMachFloat64);
1514 m.Return(
1515 m.WordBinaryNot((m.*cmp.constructor)(m.Parameter(0), m.Parameter(1))));
1516 Stream const s = m.Build();
1517 ASSERT_EQ(1U, s.size());
1518 EXPECT_EQ(kArmVcmpF64, s[0]->arch_opcode());
1519 ASSERT_EQ(2U, s[0]->InputCount());
1520 ASSERT_EQ(1U, s[0]->OutputCount());
1521 EXPECT_EQ(kFlags_set, s[0]->flags_mode());
1522 EXPECT_EQ(cmp.negated_flags_condition, s[0]->flags_condition());
1523 }
1524
1525
1526 TEST_P(InstructionSelectorFPComparisonTest, WithImmediateZeroOnRight) {
1527 const Comparison& cmp = GetParam();
1528 StreamBuilder m(this, kMachInt32, kMachFloat64);
1529 m.Return((m.*cmp.constructor)(m.Parameter(0), m.Float64Constant(0.0)));
1530 Stream const s = m.Build();
1531 ASSERT_EQ(1U, s.size());
1532 EXPECT_EQ(kArmVcmpF64, s[0]->arch_opcode());
1533 ASSERT_EQ(2U, s[0]->InputCount());
1534 EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
1535 ASSERT_EQ(1U, s[0]->OutputCount());
1536 EXPECT_EQ(kFlags_set, s[0]->flags_mode());
1537 EXPECT_EQ(cmp.flags_condition, s[0]->flags_condition());
1538 }
1539
1540
1541 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
1542 InstructionSelectorFPComparisonTest,
1543 ::testing::ValuesIn(kFPComparisons));
1544
1545
1546 TEST_F(InstructionSelectorTest, Float64EqualWithImmediateZeroOnLeft) {
1547 StreamBuilder m(this, kMachInt32, kMachFloat64);
1548 m.Return(m.Float64Equal(m.Float64Constant(0.0), m.Parameter(0)));
1549 Stream s = m.Build();
1550 ASSERT_EQ(1U, s.size());
1551 EXPECT_EQ(kArmVcmpF64, s[0]->arch_opcode());
1552 EXPECT_EQ(2U, s[0]->InputCount());
1553 EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
1554 EXPECT_EQ(1U, s[0]->OutputCount());
1555 EXPECT_EQ(kFlags_set, s[0]->flags_mode());
1556 EXPECT_EQ(kEqual, s[0]->flags_condition());
1557 }
1558
1559
1560 // -----------------------------------------------------------------------------
1482 // Miscellaneous. 1561 // Miscellaneous.
1483 1562
1484 1563
1485 TEST_F(InstructionSelectorTest, Float64SubWithMinusZero) { 1564 TEST_F(InstructionSelectorTest, Float64SubWithMinusZero) {
1486 StreamBuilder m(this, kMachFloat64, kMachFloat64); 1565 StreamBuilder m(this, kMachFloat64, kMachFloat64);
1487 Node* const p0 = m.Parameter(0); 1566 Node* const p0 = m.Parameter(0);
1488 Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0); 1567 Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0);
1489 m.Return(n); 1568 m.Return(n);
1490 Stream s = m.Build(); 1569 Stream s = m.Build();
1491 ASSERT_EQ(1U, s.size()); 1570 ASSERT_EQ(1U, s.size());
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 ASSERT_EQ(3U, s[0]->InputCount()); 2422 ASSERT_EQ(3U, s[0]->InputCount());
2344 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1))); 2423 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1)));
2345 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2))); 2424 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2)));
2346 } 2425 }
2347 } 2426 }
2348 } 2427 }
2349 2428
2350 } // namespace compiler 2429 } // namespace compiler
2351 } // namespace internal 2430 } // namespace internal
2352 } // namespace v8 2431 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698