OLD | NEW |
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 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); | 1892 EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); |
1893 ASSERT_EQ(1U, s[0]->OutputCount()); | 1893 ASSERT_EQ(1U, s[0]->OutputCount()); |
1894 EXPECT_TRUE( | 1894 EXPECT_TRUE( |
1895 UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); | 1895 UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); |
1896 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 1896 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
1897 EXPECT_EQ(kFlags_none, s[0]->flags_mode()); | 1897 EXPECT_EQ(kFlags_none, s[0]->flags_mode()); |
1898 } | 1898 } |
1899 } | 1899 } |
1900 | 1900 |
1901 | 1901 |
1902 TEST_F(InstructionSelectorTest, Float32SubWithMinusZero) { | |
1903 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32()); | |
1904 Node* const p0 = m.Parameter(0); | |
1905 Node* const n = m.Float32Sub(m.Float32Constant(-0.0f), p0); | |
1906 m.Return(n); | |
1907 Stream s = m.Build(); | |
1908 ASSERT_EQ(1U, s.size()); | |
1909 EXPECT_EQ(kArmVnegF32, s[0]->arch_opcode()); | |
1910 ASSERT_EQ(1U, s[0]->InputCount()); | |
1911 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | |
1912 ASSERT_EQ(1U, s[0]->OutputCount()); | |
1913 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | |
1914 } | |
1915 | |
1916 | |
1917 TEST_F(InstructionSelectorTest, Float64SubWithMinusZero) { | |
1918 StreamBuilder m(this, MachineType::Float64(), MachineType::Float64()); | |
1919 Node* const p0 = m.Parameter(0); | |
1920 Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0); | |
1921 m.Return(n); | |
1922 Stream s = m.Build(); | |
1923 ASSERT_EQ(1U, s.size()); | |
1924 EXPECT_EQ(kArmVnegF64, s[0]->arch_opcode()); | |
1925 ASSERT_EQ(1U, s[0]->InputCount()); | |
1926 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | |
1927 ASSERT_EQ(1U, s[0]->OutputCount()); | |
1928 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | |
1929 } | |
1930 | |
1931 | |
1932 TEST_F(InstructionSelectorTest, Float32SubWithFloat32Mul) { | 1902 TEST_F(InstructionSelectorTest, Float32SubWithFloat32Mul) { |
1933 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), | 1903 StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), |
1934 MachineType::Float32(), MachineType::Float32()); | 1904 MachineType::Float32(), MachineType::Float32()); |
1935 Node* const p0 = m.Parameter(0); | 1905 Node* const p0 = m.Parameter(0); |
1936 Node* const p1 = m.Parameter(1); | 1906 Node* const p1 = m.Parameter(1); |
1937 Node* const p2 = m.Parameter(2); | 1907 Node* const p2 = m.Parameter(2); |
1938 Node* const n = m.Float32Sub(p0, m.Float32Mul(p1, p2)); | 1908 Node* const n = m.Float32Sub(p0, m.Float32Mul(p1, p2)); |
1939 m.Return(n); | 1909 m.Return(n); |
1940 Stream s = m.Build(); | 1910 Stream s = m.Build(); |
1941 ASSERT_EQ(1U, s.size()); | 1911 ASSERT_EQ(1U, s.size()); |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3291 EXPECT_EQ(kArmVnegF64, s[0]->arch_opcode()); | 3261 EXPECT_EQ(kArmVnegF64, s[0]->arch_opcode()); |
3292 ASSERT_EQ(1U, s[0]->InputCount()); | 3262 ASSERT_EQ(1U, s[0]->InputCount()); |
3293 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 3263 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
3294 ASSERT_EQ(1U, s[0]->OutputCount()); | 3264 ASSERT_EQ(1U, s[0]->OutputCount()); |
3295 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 3265 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
3296 } | 3266 } |
3297 | 3267 |
3298 } // namespace compiler | 3268 } // namespace compiler |
3299 } // namespace internal | 3269 } // namespace internal |
3300 } // namespace v8 | 3270 } // namespace v8 |
OLD | NEW |