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/ieee754.h" | 10 #include "src/base/ieee754.h" |
(...skipping 4143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4154 FOR_UINT64_INPUTS(j) { | 4154 FOR_UINT64_INPUTS(j) { |
4155 m.Call(static_cast<uint32_t>(*i & 0xffffffff), | 4155 m.Call(static_cast<uint32_t>(*i & 0xffffffff), |
4156 static_cast<uint32_t>(*i >> 32), | 4156 static_cast<uint32_t>(*i >> 32), |
4157 static_cast<uint32_t>(*j & 0xffffffff), | 4157 static_cast<uint32_t>(*j & 0xffffffff), |
4158 static_cast<uint32_t>(*j >> 32)); | 4158 static_cast<uint32_t>(*j >> 32)); |
4159 CHECK_EQ(*i + *j, ToInt64(low, high)); | 4159 CHECK_EQ(*i + *j, ToInt64(low, high)); |
4160 } | 4160 } |
4161 } | 4161 } |
4162 } | 4162 } |
4163 | 4163 |
4164 TEST(RunInt32PairAddUseOnlyHighWord) { | |
titzer
2016/10/19 09:20:42
Can you add tests for all the Int32Pair* operation
ahaas
2016/10/19 09:59:19
Done.
| |
4165 BufferedRawMachineAssemblerTester<int32_t> m( | |
4166 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(), | |
4167 MachineType::Uint32()); | |
4168 | |
4169 Node* PairAdd = m.Int32PairAdd(m.Parameter(0), m.Parameter(1), m.Parameter(2), | |
4170 m.Parameter(3)); | |
4171 | |
4172 m.Return(m.Projection(1, PairAdd)); | |
4173 | |
4174 FOR_UINT64_INPUTS(i) { | |
4175 FOR_UINT64_INPUTS(j) { | |
4176 CHECK_EQ(static_cast<uint32_t>((*i + *j) >> 32), | |
4177 m.Call(static_cast<uint32_t>(*i & 0xffffffff), | |
4178 static_cast<uint32_t>(*i >> 32), | |
4179 static_cast<uint32_t>(*j & 0xffffffff), | |
4180 static_cast<uint32_t>(*j >> 32))); | |
4181 } | |
4182 } | |
4183 } | |
4184 | |
4164 void TestInt32PairAddWithSharedInput(int a, int b, int c, int d) { | 4185 void TestInt32PairAddWithSharedInput(int a, int b, int c, int d) { |
4165 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), | 4186 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), |
4166 MachineType::Uint32()); | 4187 MachineType::Uint32()); |
4167 | 4188 |
4168 uint32_t high; | 4189 uint32_t high; |
4169 uint32_t low; | 4190 uint32_t low; |
4170 | 4191 |
4171 Node* PairAdd = m.Int32PairAdd(m.Parameter(a), m.Parameter(b), m.Parameter(c), | 4192 Node* PairAdd = m.Int32PairAdd(m.Parameter(a), m.Parameter(b), m.Parameter(c), |
4172 m.Parameter(d)); | 4193 m.Parameter(d)); |
4173 | 4194 |
(...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6571 r.Goto(&merge); | 6592 r.Goto(&merge); |
6572 r.Bind(&merge); | 6593 r.Bind(&merge); |
6573 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); | 6594 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); |
6574 r.Return(phi); | 6595 r.Return(phi); |
6575 CHECK_EQ(1, r.Call(1)); | 6596 CHECK_EQ(1, r.Call(1)); |
6576 } | 6597 } |
6577 | 6598 |
6578 } // namespace compiler | 6599 } // namespace compiler |
6579 } // namespace internal | 6600 } // namespace internal |
6580 } // namespace v8 | 6601 } // namespace v8 |
OLD | NEW |