OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this | 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 // TODO(jochen): Remove this after the setting is turned on globally. | 5 // TODO(jochen): Remove this after the setting is turned on globally. |
6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <functional> | 9 #include <functional> |
10 #include <limits> | 10 #include <limits> |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 CHECK_EQ(8, m.Call(uint64_t(0x00000000cb4dc100))); | 277 CHECK_EQ(8, m.Call(uint64_t(0x00000000cb4dc100))); |
278 CHECK_EQ(7, m.Call(uint64_t(0x00000000dfbec580))); | 278 CHECK_EQ(7, m.Call(uint64_t(0x00000000dfbec580))); |
279 CHECK_EQ(6, m.Call(uint64_t(0x0000000027a9db40))); | 279 CHECK_EQ(6, m.Call(uint64_t(0x0000000027a9db40))); |
280 CHECK_EQ(5, m.Call(uint64_t(0x00000000de3bcb20))); | 280 CHECK_EQ(5, m.Call(uint64_t(0x00000000de3bcb20))); |
281 CHECK_EQ(4, m.Call(uint64_t(0x00000000d7e8a610))); | 281 CHECK_EQ(4, m.Call(uint64_t(0x00000000d7e8a610))); |
282 CHECK_EQ(3, m.Call(uint64_t(0x000000009afdbc88))); | 282 CHECK_EQ(3, m.Call(uint64_t(0x000000009afdbc88))); |
283 CHECK_EQ(2, m.Call(uint64_t(0x000000009afdbc84))); | 283 CHECK_EQ(2, m.Call(uint64_t(0x000000009afdbc84))); |
284 CHECK_EQ(1, m.Call(uint64_t(0x000000009afdbc82))); | 284 CHECK_EQ(1, m.Call(uint64_t(0x000000009afdbc82))); |
285 CHECK_EQ(0, m.Call(uint64_t(0x000000009afdbc81))); | 285 CHECK_EQ(0, m.Call(uint64_t(0x000000009afdbc81))); |
286 } | 286 } |
| 287 |
| 288 |
| 289 TEST(RunWord64Popcnt) { |
| 290 BufferedRawMachineAssemblerTester<int32_t> m(kMachUint64); |
| 291 if (!m.machine()->Word64Popcnt().IsSupported()) { |
| 292 return; |
| 293 } |
| 294 |
| 295 m.Return(m.AddNode(m.machine()->Word64Popcnt().op(), m.Parameter(0))); |
| 296 |
| 297 CHECK_EQ(0, m.Call(uint64_t(0x0000000000000000))); |
| 298 CHECK_EQ(1, m.Call(uint64_t(0x0000000000000001))); |
| 299 CHECK_EQ(1, m.Call(uint64_t(0x8000000000000000))); |
| 300 CHECK_EQ(64, m.Call(uint64_t(0xffffffffffffffff))); |
| 301 CHECK_EQ(12, m.Call(uint64_t(0x000dc100000dc100))); |
| 302 CHECK_EQ(18, m.Call(uint64_t(0xe00dc100e00dc100))); |
| 303 CHECK_EQ(22, m.Call(uint64_t(0xe00dc103e00dc103))); |
| 304 CHECK_EQ(18, m.Call(uint64_t(0x000dc107000dc107))); |
| 305 } |
287 #endif // V8_TARGET_ARCH_64_BIT | 306 #endif // V8_TARGET_ARCH_64_BIT |
288 | 307 |
289 | 308 |
290 static Node* Int32Input(RawMachineAssemblerTester<int32_t>* m, int index) { | 309 static Node* Int32Input(RawMachineAssemblerTester<int32_t>* m, int index) { |
291 switch (index) { | 310 switch (index) { |
292 case 0: | 311 case 0: |
293 return m->Parameter(0); | 312 return m->Parameter(0); |
294 case 1: | 313 case 1: |
295 return m->Parameter(1); | 314 return m->Parameter(1); |
296 case 2: | 315 case 2: |
(...skipping 5136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5433 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5452 Node* call = r.AddNode(r.common()->Call(desc), phi); |
5434 r.Return(call); | 5453 r.Return(call); |
5435 | 5454 |
5436 CHECK_EQ(33, r.Call(1)); | 5455 CHECK_EQ(33, r.Call(1)); |
5437 CHECK_EQ(44, r.Call(0)); | 5456 CHECK_EQ(44, r.Call(0)); |
5438 } | 5457 } |
5439 | 5458 |
5440 } // namespace compiler | 5459 } // namespace compiler |
5441 } // namespace internal | 5460 } // namespace internal |
5442 } // namespace v8 | 5461 } // namespace v8 |
OLD | NEW |