| 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 #include <cmath> | 5 #include <cmath> |
| 6 #include <functional> | 6 #include <functional> |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 CHECK_EQ(7, m.Call(uint32_t(0xdfbec580))); | 65 CHECK_EQ(7, m.Call(uint32_t(0xdfbec580))); |
| 66 CHECK_EQ(6, m.Call(uint32_t(0x27a9db40))); | 66 CHECK_EQ(6, m.Call(uint32_t(0x27a9db40))); |
| 67 CHECK_EQ(5, m.Call(uint32_t(0xde3bcb20))); | 67 CHECK_EQ(5, m.Call(uint32_t(0xde3bcb20))); |
| 68 CHECK_EQ(4, m.Call(uint32_t(0xd7e8a610))); | 68 CHECK_EQ(4, m.Call(uint32_t(0xd7e8a610))); |
| 69 CHECK_EQ(3, m.Call(uint32_t(0x9afdbc88))); | 69 CHECK_EQ(3, m.Call(uint32_t(0x9afdbc88))); |
| 70 CHECK_EQ(2, m.Call(uint32_t(0x9afdbc84))); | 70 CHECK_EQ(2, m.Call(uint32_t(0x9afdbc84))); |
| 71 CHECK_EQ(1, m.Call(uint32_t(0x9afdbc82))); | 71 CHECK_EQ(1, m.Call(uint32_t(0x9afdbc82))); |
| 72 CHECK_EQ(0, m.Call(uint32_t(0x9afdbc81))); | 72 CHECK_EQ(0, m.Call(uint32_t(0x9afdbc81))); |
| 73 } | 73 } |
| 74 | 74 |
| 75 |
| 75 TEST(RunWord32Clz) { | 76 TEST(RunWord32Clz) { |
| 76 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32()); | 77 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32()); |
| 77 m.Return(m.Word32Clz(m.Parameter(0))); | 78 m.Return(m.Word32Clz(m.Parameter(0))); |
| 78 | 79 |
| 79 CHECK_EQ(0, m.Call(uint32_t(0x80001000))); | 80 CHECK_EQ(0, m.Call(uint32_t(0x80001000))); |
| 80 CHECK_EQ(1, m.Call(uint32_t(0x40000500))); | 81 CHECK_EQ(1, m.Call(uint32_t(0x40000500))); |
| 81 CHECK_EQ(2, m.Call(uint32_t(0x20000300))); | 82 CHECK_EQ(2, m.Call(uint32_t(0x20000300))); |
| 82 CHECK_EQ(3, m.Call(uint32_t(0x10000003))); | 83 CHECK_EQ(3, m.Call(uint32_t(0x10000003))); |
| 83 CHECK_EQ(4, m.Call(uint32_t(0x08050000))); | 84 CHECK_EQ(4, m.Call(uint32_t(0x08050000))); |
| 84 CHECK_EQ(5, m.Call(uint32_t(0x04006000))); | 85 CHECK_EQ(5, m.Call(uint32_t(0x04006000))); |
| (...skipping 5997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6082 Node* call = r.AddNode(r.common()->Call(desc), phi); | 6083 Node* call = r.AddNode(r.common()->Call(desc), phi); |
| 6083 r.Return(call); | 6084 r.Return(call); |
| 6084 | 6085 |
| 6085 CHECK_EQ(33, r.Call(1)); | 6086 CHECK_EQ(33, r.Call(1)); |
| 6086 CHECK_EQ(44, r.Call(0)); | 6087 CHECK_EQ(44, r.Call(0)); |
| 6087 } | 6088 } |
| 6088 | 6089 |
| 6089 } // namespace compiler | 6090 } // namespace compiler |
| 6090 } // namespace internal | 6091 } // namespace internal |
| 6091 } // namespace v8 | 6092 } // namespace v8 |
| OLD | NEW |