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 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3384 | 3384 |
3385 FOR_FLOAT64_INPUTS(pl) { | 3385 FOR_FLOAT64_INPUTS(pl) { |
3386 FOR_FLOAT64_INPUTS(pr) { | 3386 FOR_FLOAT64_INPUTS(pr) { |
3387 double expected = *pl + *pr; | 3387 double expected = *pl + *pr; |
3388 CheckDoubleEq(expected, bt.call(*pl, *pr)); | 3388 CheckDoubleEq(expected, bt.call(*pl, *pr)); |
3389 } | 3389 } |
3390 } | 3390 } |
3391 } | 3391 } |
3392 | 3392 |
3393 | 3393 |
| 3394 TEST(RunFloa32MaxP) { |
| 3395 RawMachineAssemblerTester<int32_t> m; |
| 3396 Float32BinopTester bt(&m); |
| 3397 if (!m.machine()->Float32Max().IsSupported()) return; |
| 3398 |
| 3399 bt.AddReturn(m.Float32Max(bt.param0, bt.param1)); |
| 3400 |
| 3401 FOR_FLOAT32_INPUTS(pl) { |
| 3402 FOR_FLOAT32_INPUTS(pr) { |
| 3403 double expected = *pl > *pr ? *pl : *pr; |
| 3404 CheckDoubleEq(expected, bt.call(*pl, *pr)); |
| 3405 } |
| 3406 } |
| 3407 } |
| 3408 |
| 3409 |
| 3410 TEST(RunFloat64MaxP) { |
| 3411 RawMachineAssemblerTester<int32_t> m; |
| 3412 Float64BinopTester bt(&m); |
| 3413 if (!m.machine()->Float64Max().IsSupported()) return; |
| 3414 |
| 3415 bt.AddReturn(m.Float64Max(bt.param0, bt.param1)); |
| 3416 |
| 3417 FOR_FLOAT64_INPUTS(pl) { |
| 3418 FOR_FLOAT64_INPUTS(pr) { |
| 3419 double expected = *pl > *pr ? *pl : *pr; |
| 3420 CheckDoubleEq(expected, bt.call(*pl, *pr)); |
| 3421 } |
| 3422 } |
| 3423 } |
| 3424 |
| 3425 |
| 3426 TEST(RunFloat32MinP) { |
| 3427 RawMachineAssemblerTester<int32_t> m; |
| 3428 Float32BinopTester bt(&m); |
| 3429 if (!m.machine()->Float32Min().IsSupported()) return; |
| 3430 |
| 3431 bt.AddReturn(m.Float32Min(bt.param0, bt.param1)); |
| 3432 |
| 3433 FOR_FLOAT32_INPUTS(pl) { |
| 3434 FOR_FLOAT32_INPUTS(pr) { |
| 3435 double expected = *pl < *pr ? *pl : *pr; |
| 3436 CheckDoubleEq(expected, bt.call(*pl, *pr)); |
| 3437 } |
| 3438 } |
| 3439 } |
| 3440 |
| 3441 |
| 3442 TEST(RunFloat64MinP) { |
| 3443 RawMachineAssemblerTester<int32_t> m; |
| 3444 Float64BinopTester bt(&m); |
| 3445 if (!m.machine()->Float64Min().IsSupported()) return; |
| 3446 |
| 3447 bt.AddReturn(m.Float64Min(bt.param0, bt.param1)); |
| 3448 |
| 3449 FOR_FLOAT64_INPUTS(pl) { |
| 3450 FOR_FLOAT64_INPUTS(pr) { |
| 3451 double expected = *pl < *pr ? *pl : *pr; |
| 3452 CheckDoubleEq(expected, bt.call(*pl, *pr)); |
| 3453 } |
| 3454 } |
| 3455 } |
| 3456 |
| 3457 |
3394 TEST(RunFloat32SubP) { | 3458 TEST(RunFloat32SubP) { |
3395 RawMachineAssemblerTester<int32_t> m; | 3459 RawMachineAssemblerTester<int32_t> m; |
3396 Float32BinopTester bt(&m); | 3460 Float32BinopTester bt(&m); |
3397 | 3461 |
3398 bt.AddReturn(m.Float32Sub(bt.param0, bt.param1)); | 3462 bt.AddReturn(m.Float32Sub(bt.param0, bt.param1)); |
3399 | 3463 |
3400 FOR_FLOAT32_INPUTS(pl) { | 3464 FOR_FLOAT32_INPUTS(pl) { |
3401 FOR_FLOAT32_INPUTS(pr) { | 3465 FOR_FLOAT32_INPUTS(pr) { |
3402 float expected = *pl - *pr; | 3466 float expected = *pl - *pr; |
3403 CheckFloatEq(expected, bt.call(*pl, *pr)); | 3467 CheckFloatEq(expected, bt.call(*pl, *pr)); |
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5462 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5526 Node* call = r.AddNode(r.common()->Call(desc), phi); |
5463 r.Return(call); | 5527 r.Return(call); |
5464 | 5528 |
5465 CHECK_EQ(33, r.Call(1)); | 5529 CHECK_EQ(33, r.Call(1)); |
5466 CHECK_EQ(44, r.Call(0)); | 5530 CHECK_EQ(44, r.Call(0)); |
5467 } | 5531 } |
5468 | 5532 |
5469 } // namespace compiler | 5533 } // namespace compiler |
5470 } // namespace internal | 5534 } // namespace internal |
5471 } // namespace v8 | 5535 } // namespace v8 |
OLD | NEW |