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 "src/compiler/instruction-selector-unittest.h" | 5 #include "src/compiler/instruction-selector-unittest.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace compiler { | 9 namespace compiler { |
10 | 10 |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 -32, -12, -11, -5, -4, 0, 5, 9, 25, 28, 51, 58, 60, 89, 104, 108, 109, | 1240 -32, -12, -11, -5, -4, 0, 5, 9, 25, 28, 51, 58, 60, 89, 104, 108, 109, |
1241 114, 116, 120, 138, 150, 161, 166, 172, 228, 255}}, | 1241 114, 116, 120, 138, 150, 161, 166, 172, 228, 255}}, |
1242 {kMachInt32, | 1242 {kMachInt32, |
1243 kArmLdr, | 1243 kArmLdr, |
1244 kArmStr, | 1244 kArmStr, |
1245 &InstructionSelectorTest::Stream::IsInteger, | 1245 &InstructionSelectorTest::Stream::IsInteger, |
1246 {-4095, -1898, -1685, -1562, -1408, -1313, -344, -128, -116, -100, -92, | 1246 {-4095, -1898, -1685, -1562, -1408, -1313, -344, -128, -116, -100, -92, |
1247 -80, -72, -71, -56, -25, -21, -11, -9, 0, 3, 5, 27, 28, 42, 52, 63, 88, | 1247 -80, -72, -71, -56, -25, -21, -11, -9, 0, 3, 5, 27, 28, 42, 52, 63, 88, |
1248 93, 97, 125, 846, 1037, 2102, 2403, 2597, 2632, 2997, 3935, 4095}}, | 1248 93, 97, 125, 846, 1037, 2102, 2403, 2597, 2632, 2997, 3935, 4095}}, |
1249 {kMachFloat32, | 1249 {kMachFloat32, |
1250 kArmVldr32, | 1250 kArmVldrF32, |
1251 kArmVstr32, | 1251 kArmVstrF32, |
1252 &InstructionSelectorTest::Stream::IsDouble, | 1252 &InstructionSelectorTest::Stream::IsDouble, |
1253 {-1020, -928, -896, -772, -728, -680, -660, -488, -372, -112, -100, -92, | 1253 {-1020, -928, -896, -772, -728, -680, -660, -488, -372, -112, -100, -92, |
1254 -84, -80, -72, -64, -60, -56, -52, -48, -36, -32, -20, -8, -4, 0, 8, 20, | 1254 -84, -80, -72, -64, -60, -56, -52, -48, -36, -32, -20, -8, -4, 0, 8, 20, |
1255 24, 40, 64, 112, 204, 388, 516, 852, 856, 976, 988, 1020}}, | 1255 24, 40, 64, 112, 204, 388, 516, 852, 856, 976, 988, 1020}}, |
1256 {kMachFloat64, | 1256 {kMachFloat64, |
1257 kArmVldr64, | 1257 kArmVldrF64, |
1258 kArmVstr64, | 1258 kArmVstrF64, |
1259 &InstructionSelectorTest::Stream::IsDouble, | 1259 &InstructionSelectorTest::Stream::IsDouble, |
1260 {-1020, -948, -796, -696, -612, -364, -320, -308, -128, -112, -108, -104, | 1260 {-1020, -948, -796, -696, -612, -364, -320, -308, -128, -112, -108, -104, |
1261 -96, -84, -80, -56, -48, -40, -20, 0, 24, 28, 36, 48, 64, 84, 96, 100, | 1261 -96, -84, -80, -56, -48, -40, -20, 0, 24, 28, 36, 48, 64, 84, 96, 100, |
1262 108, 116, 120, 140, 156, 408, 432, 444, 772, 832, 940, 1020}}}; | 1262 108, 116, 120, 140, 156, 408, 432, 444, 772, 832, 940, 1020}}}; |
1263 | 1263 |
1264 } // namespace | 1264 } // namespace |
1265 | 1265 |
1266 | 1266 |
1267 typedef InstructionSelectorTestWithParam<MemoryAccess> | 1267 typedef InstructionSelectorTestWithParam<MemoryAccess> |
1268 InstructionSelectorMemoryAccessTest; | 1268 InstructionSelectorMemoryAccessTest; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 } | 1332 } |
1333 } | 1333 } |
1334 | 1334 |
1335 | 1335 |
1336 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, | 1336 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
1337 InstructionSelectorMemoryAccessTest, | 1337 InstructionSelectorMemoryAccessTest, |
1338 ::testing::ValuesIn(kMemoryAccesses)); | 1338 ::testing::ValuesIn(kMemoryAccesses)); |
1339 | 1339 |
1340 | 1340 |
1341 // ----------------------------------------------------------------------------- | 1341 // ----------------------------------------------------------------------------- |
| 1342 // Conversions. |
| 1343 |
| 1344 |
| 1345 TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) { |
| 1346 StreamBuilder m(this, kMachFloat64, kMachFloat32); |
| 1347 m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0))); |
| 1348 Stream s = m.Build(); |
| 1349 ASSERT_EQ(1U, s.size()); |
| 1350 EXPECT_EQ(kArmVcvtF64F32, s[0]->arch_opcode()); |
| 1351 EXPECT_EQ(1U, s[0]->InputCount()); |
| 1352 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 1353 } |
| 1354 |
| 1355 |
| 1356 TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) { |
| 1357 StreamBuilder m(this, kMachFloat32, kMachFloat64); |
| 1358 m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0))); |
| 1359 Stream s = m.Build(); |
| 1360 ASSERT_EQ(1U, s.size()); |
| 1361 EXPECT_EQ(kArmVcvtF32F64, s[0]->arch_opcode()); |
| 1362 EXPECT_EQ(1U, s[0]->InputCount()); |
| 1363 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 1364 } |
| 1365 |
| 1366 |
| 1367 // ----------------------------------------------------------------------------- |
1342 // Miscellaneous. | 1368 // Miscellaneous. |
1343 | 1369 |
1344 | 1370 |
1345 TEST_F(InstructionSelectorTest, Int32AddWithInt32Mul) { | 1371 TEST_F(InstructionSelectorTest, Int32AddWithInt32Mul) { |
1346 { | 1372 { |
1347 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32, kMachInt32); | 1373 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32, kMachInt32); |
1348 m.Return( | 1374 m.Return( |
1349 m.Int32Add(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2)))); | 1375 m.Int32Add(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2)))); |
1350 Stream s = m.Build(); | 1376 Stream s = m.Build(); |
1351 ASSERT_EQ(1U, s.size()); | 1377 ASSERT_EQ(1U, s.size()); |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 m.Word32Shr(m.Parameter(0), m.Int32Constant(lsb)))); | 1914 m.Word32Shr(m.Parameter(0), m.Int32Constant(lsb)))); |
1889 Stream s = m.Build(ARMv7); | 1915 Stream s = m.Build(ARMv7); |
1890 ASSERT_EQ(1U, s.size()); | 1916 ASSERT_EQ(1U, s.size()); |
1891 EXPECT_EQ(kArmUbfx, s[0]->arch_opcode()); | 1917 EXPECT_EQ(kArmUbfx, s[0]->arch_opcode()); |
1892 ASSERT_EQ(3U, s[0]->InputCount()); | 1918 ASSERT_EQ(3U, s[0]->InputCount()); |
1893 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1))); | 1919 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1))); |
1894 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2))); | 1920 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2))); |
1895 } | 1921 } |
1896 } | 1922 } |
1897 } | 1923 } |
| 1924 |
1898 } // namespace compiler | 1925 } // namespace compiler |
1899 } // namespace internal | 1926 } // namespace internal |
1900 } // namespace v8 | 1927 } // namespace v8 |
OLD | NEW |