Index: test/cctest/compiler/test-run-machops.cc |
diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc |
index b7c978a747d76e8c6639b502e31f64a5164be84d..96bcc86953d79bc41abf2b058d06fbe28791eca1 100644 |
--- a/test/cctest/compiler/test-run-machops.cc |
+++ b/test/cctest/compiler/test-run-machops.cc |
@@ -284,6 +284,25 @@ TEST(RunWord64Ctz) { |
CHECK_EQ(1, m.Call(uint64_t(0x000000009afdbc82))); |
CHECK_EQ(0, m.Call(uint64_t(0x000000009afdbc81))); |
} |
+ |
+ |
+TEST(RunWord64Popcnt) { |
+ BufferedRawMachineAssemblerTester<int32_t> m(kMachUint64); |
+ if (!m.machine()->Word64Popcnt().IsSupported()) { |
+ return; |
+ } |
+ |
+ m.Return(m.AddNode(m.machine()->Word64Popcnt().op(), m.Parameter(0))); |
+ |
+ CHECK_EQ(0, m.Call(uint64_t(0x0000000000000000))); |
+ CHECK_EQ(1, m.Call(uint64_t(0x0000000000000001))); |
+ CHECK_EQ(1, m.Call(uint64_t(0x8000000000000000))); |
+ CHECK_EQ(64, m.Call(uint64_t(0xffffffffffffffff))); |
+ CHECK_EQ(12, m.Call(uint64_t(0x000dc100000dc100))); |
+ CHECK_EQ(18, m.Call(uint64_t(0xe00dc100e00dc100))); |
+ CHECK_EQ(22, m.Call(uint64_t(0xe00dc103e00dc103))); |
+ CHECK_EQ(18, m.Call(uint64_t(0x000dc107000dc107))); |
+} |
#endif // V8_TARGET_ARCH_64_BIT |