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 <functional> | 5 #include <functional> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 uint32_t expected = *j * *i; | 1252 uint32_t expected = *j * *i; |
1253 CHECK_UINT32_EQ(expected, m.Call(*j)); | 1253 CHECK_UINT32_EQ(expected, m.Call(*j)); |
1254 } | 1254 } |
1255 } | 1255 } |
1256 } | 1256 } |
1257 } | 1257 } |
1258 | 1258 |
1259 | 1259 |
1260 TEST(RunInt32MulAndInt32AddP) { | 1260 TEST(RunInt32MulAndInt32AddP) { |
1261 { | 1261 { |
| 1262 FOR_INT32_INPUTS(i) { |
| 1263 FOR_INT32_INPUTS(j) { |
| 1264 RawMachineAssemblerTester<int32_t> m(kMachInt32); |
| 1265 int32_t p0 = *i; |
| 1266 int32_t p1 = *j; |
| 1267 m.Return(m.Int32Add(m.Int32Constant(p0), |
| 1268 m.Int32Mul(m.Parameter(0), m.Int32Constant(p1)))); |
| 1269 FOR_INT32_INPUTS(k) { |
| 1270 int32_t p2 = *k; |
| 1271 int expected = p0 + static_cast<int32_t>(p1 * p2); |
| 1272 CHECK_EQ(expected, m.Call(p2)); |
| 1273 } |
| 1274 } |
| 1275 } |
| 1276 } |
| 1277 { |
1262 RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32); | 1278 RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32); |
1263 m.Return( | 1279 m.Return( |
1264 m.Int32Add(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2)))); | 1280 m.Int32Add(m.Parameter(0), m.Int32Mul(m.Parameter(1), m.Parameter(2)))); |
1265 FOR_INT32_INPUTS(i) { | 1281 FOR_INT32_INPUTS(i) { |
1266 FOR_INT32_INPUTS(j) { | 1282 FOR_INT32_INPUTS(j) { |
1267 FOR_INT32_INPUTS(k) { | 1283 FOR_INT32_INPUTS(k) { |
1268 int32_t p0 = *i; | 1284 int32_t p0 = *i; |
1269 int32_t p1 = *j; | 1285 int32_t p1 = *j; |
1270 int32_t p2 = *k; | 1286 int32_t p2 = *k; |
1271 int expected = p0 + static_cast<int32_t>(p1 * p2); | 1287 int expected = p0 + static_cast<int32_t>(p1 * p2); |
(...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4314 float actual = *i; | 4330 float actual = *i; |
4315 RawMachineAssemblerTester<int32_t> m; | 4331 RawMachineAssemblerTester<int32_t> m; |
4316 m.StoreToPointer(&actual, kMachFloat32, m.Float32Constant(expected)); | 4332 m.StoreToPointer(&actual, kMachFloat32, m.Float32Constant(expected)); |
4317 m.Return(m.Int32Constant(0)); | 4333 m.Return(m.Int32Constant(0)); |
4318 CHECK_EQ(0, m.Call()); | 4334 CHECK_EQ(0, m.Call()); |
4319 CHECK_EQ(expected, actual); | 4335 CHECK_EQ(expected, actual); |
4320 } | 4336 } |
4321 } | 4337 } |
4322 | 4338 |
4323 #endif // V8_TURBOFAN_TARGET | 4339 #endif // V8_TURBOFAN_TARGET |
OLD | NEW |