Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 static void InitializeVM() { | 97 static void InitializeVM() { |
| 98 if (env.IsEmpty()) { | 98 if (env.IsEmpty()) { |
| 99 env = v8::Context::New(); | 99 env = v8::Context::New(); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 #endif | 102 #endif |
| 103 | 103 |
| 104 #define __ masm. | 104 #define __ masm. |
| 105 | 105 |
| 106 #define BUF_SIZE 8192 | 106 #define BUF_SIZE 8192 |
| 107 #define SETUP() SETUP_SIZE(BUF_SIZE) | 107 #define SETUP() \ |
| 108 CcTest::InitializeVM(); \ | |
| 109 SETUP_SIZE(BUF_SIZE) | |
| 110 | |
| 111 #define SETUP_HELPER() \ | |
| 112 SETUP_SIZE(BUF_SIZE) | |
| 108 | 113 |
| 109 #define INIT_V8() \ | 114 #define INIT_V8() \ |
| 110 CcTest::InitializeVM(); \ | |
| 111 Isolate* isolate = Isolate::Current(); \ | 115 Isolate* isolate = Isolate::Current(); \ |
| 112 HandleScope scope(isolate); \ | 116 HandleScope scope(isolate); \ |
| 113 ASSERT(isolate != NULL); | 117 ASSERT(isolate != NULL); |
| 114 | 118 |
| 115 #ifdef USE_SIMULATOR | 119 #ifdef USE_SIMULATOR |
| 116 | 120 |
| 117 // Run tests with the simulator. | 121 // Run tests with the simulator. |
| 118 #define SETUP_SIZE(buf_size) \ | 122 #define SETUP_SIZE(buf_size) \ |
| 119 INIT_V8(); \ | 123 INIT_V8(); \ |
| 120 byte* buf = new byte[buf_size]; \ | 124 byte* buf = new byte[buf_size]; \ |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1101 ASSERT_EQUAL_64(0, x20); | 1105 ASSERT_EQUAL_64(0, x20); |
| 1102 ASSERT_EQUAL_64(0xffffffff00000001UL, x21); | 1106 ASSERT_EQUAL_64(0xffffffff00000001UL, x21); |
| 1103 ASSERT_EQUAL_64(0xffffffff, x22); | 1107 ASSERT_EQUAL_64(0xffffffff, x22); |
| 1104 ASSERT_EQUAL_64(0xffffffffffffffffUL, x23); | 1108 ASSERT_EQUAL_64(0xffffffffffffffffUL, x23); |
| 1105 | 1109 |
| 1106 TEARDOWN(); | 1110 TEARDOWN(); |
| 1107 } | 1111 } |
| 1108 | 1112 |
| 1109 | 1113 |
| 1110 static void SmullHelper(int64_t expected, int64_t a, int64_t b) { | 1114 static void SmullHelper(int64_t expected, int64_t a, int64_t b) { |
| 1111 SETUP(); | 1115 SETUP_HELPER(); |
| 1112 START(); | 1116 START(); |
| 1113 __ Mov(w0, a); | 1117 __ Mov(w0, a); |
| 1114 __ Mov(w1, b); | 1118 __ Mov(w1, b); |
| 1115 __ Smull(x2, w0, w1); | 1119 __ Smull(x2, w0, w1); |
| 1116 END(); | 1120 END(); |
| 1117 RUN(); | 1121 RUN(); |
| 1118 ASSERT_EQUAL_64(expected, x2); | 1122 ASSERT_EQUAL_64(expected, x2); |
| 1119 TEARDOWN(); | 1123 TEARDOWN(); |
| 1120 } | 1124 } |
| 1121 | 1125 |
| 1122 | 1126 |
| 1123 TEST(smull) { | 1127 TEST(smull) { |
| 1128 CcTest::InitializeVM(); | |
|
ulan
2014/02/04 18:35:59
Is this OK, or should I put hide it behind macro?
m.m.capewell
2014/02/04 18:48:34
Is it possible to hide it in the TEST macro?
ulan
2014/02/05 08:24:54
That would probably break other tests because TEST
| |
| 1124 SmullHelper(0, 0, 0); | 1129 SmullHelper(0, 0, 0); |
| 1125 SmullHelper(1, 1, 1); | 1130 SmullHelper(1, 1, 1); |
| 1126 SmullHelper(-1, -1, 1); | 1131 SmullHelper(-1, -1, 1); |
| 1127 SmullHelper(1, -1, -1); | 1132 SmullHelper(1, -1, -1); |
| 1128 SmullHelper(0xffffffff80000000, 0x80000000, 1); | 1133 SmullHelper(0xffffffff80000000, 0x80000000, 1); |
| 1129 SmullHelper(0x0000000080000000, 0x00010000, 0x00008000); | 1134 SmullHelper(0x0000000080000000, 0x00010000, 0x00008000); |
| 1130 } | 1135 } |
| 1131 | 1136 |
| 1132 | 1137 |
| 1133 TEST(madd) { | 1138 TEST(madd) { |
| (...skipping 3438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4572 ASSERT_EQUAL_FP64(0.0, d7); | 4577 ASSERT_EQUAL_FP64(0.0, d7); |
| 4573 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d8); | 4578 ASSERT_EQUAL_FP64(kFP64NegativeInfinity, d8); |
| 4574 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d9); | 4579 ASSERT_EQUAL_FP64(kFP64PositiveInfinity, d9); |
| 4575 | 4580 |
| 4576 TEARDOWN(); | 4581 TEARDOWN(); |
| 4577 } | 4582 } |
| 4578 | 4583 |
| 4579 | 4584 |
| 4580 static void FmaddFmsubDoubleHelper(double n, double m, double a, | 4585 static void FmaddFmsubDoubleHelper(double n, double m, double a, |
| 4581 double fmadd, double fmsub) { | 4586 double fmadd, double fmsub) { |
| 4582 SETUP(); | 4587 SETUP_HELPER(); |
| 4583 START(); | 4588 START(); |
| 4584 | 4589 |
| 4585 __ Fmov(d0, n); | 4590 __ Fmov(d0, n); |
| 4586 __ Fmov(d1, m); | 4591 __ Fmov(d1, m); |
| 4587 __ Fmov(d2, a); | 4592 __ Fmov(d2, a); |
| 4588 __ Fmadd(d28, d0, d1, d2); | 4593 __ Fmadd(d28, d0, d1, d2); |
| 4589 __ Fmsub(d29, d0, d1, d2); | 4594 __ Fmsub(d29, d0, d1, d2); |
| 4590 __ Fnmadd(d30, d0, d1, d2); | 4595 __ Fnmadd(d30, d0, d1, d2); |
| 4591 __ Fnmsub(d31, d0, d1, d2); | 4596 __ Fnmsub(d31, d0, d1, d2); |
| 4592 | 4597 |
| 4593 END(); | 4598 END(); |
| 4594 RUN(); | 4599 RUN(); |
| 4595 | 4600 |
| 4596 ASSERT_EQUAL_FP64(fmadd, d28); | 4601 ASSERT_EQUAL_FP64(fmadd, d28); |
| 4597 ASSERT_EQUAL_FP64(fmsub, d29); | 4602 ASSERT_EQUAL_FP64(fmsub, d29); |
| 4598 ASSERT_EQUAL_FP64(-fmadd, d30); | 4603 ASSERT_EQUAL_FP64(-fmadd, d30); |
| 4599 ASSERT_EQUAL_FP64(-fmsub, d31); | 4604 ASSERT_EQUAL_FP64(-fmsub, d31); |
| 4600 | 4605 |
| 4601 TEARDOWN(); | 4606 TEARDOWN(); |
| 4602 } | 4607 } |
| 4603 | 4608 |
| 4604 | 4609 |
| 4605 TEST(fmadd_fmsub_double) { | 4610 TEST(fmadd_fmsub_double) { |
| 4611 CcTest::InitializeVM(); | |
| 4606 double inputs[] = { | 4612 double inputs[] = { |
| 4607 // Normal numbers, including -0.0. | 4613 // Normal numbers, including -0.0. |
| 4608 DBL_MAX, DBL_MIN, 3.25, 2.0, 0.0, | 4614 DBL_MAX, DBL_MIN, 3.25, 2.0, 0.0, |
| 4609 -DBL_MAX, -DBL_MIN, -3.25, -2.0, -0.0, | 4615 -DBL_MAX, -DBL_MIN, -3.25, -2.0, -0.0, |
| 4610 // Infinities. | 4616 // Infinities. |
| 4611 kFP64NegativeInfinity, kFP64PositiveInfinity, | 4617 kFP64NegativeInfinity, kFP64PositiveInfinity, |
| 4612 // Subnormal numbers. | 4618 // Subnormal numbers. |
| 4613 rawbits_to_double(0x000fffffffffffff), | 4619 rawbits_to_double(0x000fffffffffffff), |
| 4614 rawbits_to_double(0x0000000000000001), | 4620 rawbits_to_double(0x0000000000000001), |
| 4615 rawbits_to_double(0x000123456789abcd), | 4621 rawbits_to_double(0x000123456789abcd), |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 4632 double fmsub = fma(-n, m, a); | 4638 double fmsub = fma(-n, m, a); |
| 4633 | 4639 |
| 4634 FmaddFmsubDoubleHelper(n, m, a, fmadd, fmsub); | 4640 FmaddFmsubDoubleHelper(n, m, a, fmadd, fmsub); |
| 4635 } | 4641 } |
| 4636 } | 4642 } |
| 4637 } | 4643 } |
| 4638 } | 4644 } |
| 4639 | 4645 |
| 4640 | 4646 |
| 4641 TEST(fmadd_fmsub_double_rounding) { | 4647 TEST(fmadd_fmsub_double_rounding) { |
| 4648 CcTest::InitializeVM(); | |
| 4642 // Make sure we run plenty of tests where an intermediate rounding stage would | 4649 // Make sure we run plenty of tests where an intermediate rounding stage would |
| 4643 // produce an incorrect result. | 4650 // produce an incorrect result. |
| 4644 const int limit = 1000; | 4651 const int limit = 1000; |
| 4645 int count_fmadd = 0; | 4652 int count_fmadd = 0; |
| 4646 int count_fmsub = 0; | 4653 int count_fmsub = 0; |
| 4647 | 4654 |
| 4648 uint16_t seed[3] = {42, 43, 44}; | 4655 uint16_t seed[3] = {42, 43, 44}; |
| 4649 seed48(seed); | 4656 seed48(seed); |
| 4650 | 4657 |
| 4651 while ((count_fmadd < limit) || (count_fmsub < limit)) { | 4658 while ((count_fmadd < limit) || (count_fmsub < limit)) { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 4680 | 4687 |
| 4681 if (test_fmadd || test_fmsub) { | 4688 if (test_fmadd || test_fmsub) { |
| 4682 FmaddFmsubDoubleHelper(n, m, a, fmadd, fmsub); | 4689 FmaddFmsubDoubleHelper(n, m, a, fmadd, fmsub); |
| 4683 } | 4690 } |
| 4684 } | 4691 } |
| 4685 } | 4692 } |
| 4686 | 4693 |
| 4687 | 4694 |
| 4688 static void FmaddFmsubFloatHelper(float n, float m, float a, | 4695 static void FmaddFmsubFloatHelper(float n, float m, float a, |
| 4689 float fmadd, float fmsub) { | 4696 float fmadd, float fmsub) { |
| 4690 SETUP(); | 4697 SETUP_HELPER(); |
| 4691 START(); | 4698 START(); |
| 4692 | 4699 |
| 4693 __ Fmov(s0, n); | 4700 __ Fmov(s0, n); |
| 4694 __ Fmov(s1, m); | 4701 __ Fmov(s1, m); |
| 4695 __ Fmov(s2, a); | 4702 __ Fmov(s2, a); |
| 4696 __ Fmadd(s30, s0, s1, s2); | 4703 __ Fmadd(s30, s0, s1, s2); |
| 4697 __ Fmsub(s31, s0, s1, s2); | 4704 __ Fmsub(s31, s0, s1, s2); |
| 4698 | 4705 |
| 4699 END(); | 4706 END(); |
| 4700 RUN(); | 4707 RUN(); |
| 4701 | 4708 |
| 4702 ASSERT_EQUAL_FP32(fmadd, s30); | 4709 ASSERT_EQUAL_FP32(fmadd, s30); |
| 4703 ASSERT_EQUAL_FP32(fmsub, s31); | 4710 ASSERT_EQUAL_FP32(fmsub, s31); |
| 4704 | 4711 |
| 4705 TEARDOWN(); | 4712 TEARDOWN(); |
| 4706 } | 4713 } |
| 4707 | 4714 |
| 4708 | 4715 |
| 4709 TEST(fmadd_fmsub_float) { | 4716 TEST(fmadd_fmsub_float) { |
| 4717 CcTest::InitializeVM(); | |
| 4710 float inputs[] = { | 4718 float inputs[] = { |
| 4711 // Normal numbers, including -0.0f. | 4719 // Normal numbers, including -0.0f. |
| 4712 FLT_MAX, FLT_MIN, 3.25f, 2.0f, 0.0f, | 4720 FLT_MAX, FLT_MIN, 3.25f, 2.0f, 0.0f, |
| 4713 -FLT_MAX, -FLT_MIN, -3.25f, -2.0f, -0.0f, | 4721 -FLT_MAX, -FLT_MIN, -3.25f, -2.0f, -0.0f, |
| 4714 // Infinities. | 4722 // Infinities. |
| 4715 kFP32NegativeInfinity, kFP32PositiveInfinity, | 4723 kFP32NegativeInfinity, kFP32PositiveInfinity, |
| 4716 // Subnormal numbers. | 4724 // Subnormal numbers. |
| 4717 rawbits_to_float(0x07ffffff), | 4725 rawbits_to_float(0x07ffffff), |
| 4718 rawbits_to_float(0x00000001), | 4726 rawbits_to_float(0x00000001), |
| 4719 rawbits_to_float(0x01234567), | 4727 rawbits_to_float(0x01234567), |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 4736 float fmsub = fmaf(-n, m, a); | 4744 float fmsub = fmaf(-n, m, a); |
| 4737 | 4745 |
| 4738 FmaddFmsubFloatHelper(n, m, a, fmadd, fmsub); | 4746 FmaddFmsubFloatHelper(n, m, a, fmadd, fmsub); |
| 4739 } | 4747 } |
| 4740 } | 4748 } |
| 4741 } | 4749 } |
| 4742 } | 4750 } |
| 4743 | 4751 |
| 4744 | 4752 |
| 4745 TEST(fmadd_fmsub_float_rounding) { | 4753 TEST(fmadd_fmsub_float_rounding) { |
| 4754 CcTest::InitializeVM(); | |
| 4746 // Make sure we run plenty of tests where an intermediate rounding stage would | 4755 // Make sure we run plenty of tests where an intermediate rounding stage would |
| 4747 // produce an incorrect result. | 4756 // produce an incorrect result. |
| 4748 const int limit = 1000; | 4757 const int limit = 1000; |
| 4749 int count_fmadd = 0; | 4758 int count_fmadd = 0; |
| 4750 int count_fmsub = 0; | 4759 int count_fmsub = 0; |
| 4751 | 4760 |
| 4752 uint16_t seed[3] = {42, 43, 44}; | 4761 uint16_t seed[3] = {42, 43, 44}; |
| 4753 seed48(seed); | 4762 seed48(seed); |
| 4754 | 4763 |
| 4755 while ((count_fmadd < limit) || (count_fmsub < limit)) { | 4764 while ((count_fmadd < limit) || (count_fmsub < limit)) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4913 (copysign(1.0, n) != copysign(1.0, m))) { | 4922 (copysign(1.0, n) != copysign(1.0, m))) { |
| 4914 return min ? -0.0 : 0.0; | 4923 return min ? -0.0 : 0.0; |
| 4915 } | 4924 } |
| 4916 | 4925 |
| 4917 return min ? fmin(n, m) : fmax(n, m); | 4926 return min ? fmin(n, m) : fmax(n, m); |
| 4918 } | 4927 } |
| 4919 | 4928 |
| 4920 | 4929 |
| 4921 static void FminFmaxDoubleHelper(double n, double m, double min, double max, | 4930 static void FminFmaxDoubleHelper(double n, double m, double min, double max, |
| 4922 double minnm, double maxnm) { | 4931 double minnm, double maxnm) { |
| 4923 SETUP(); | 4932 SETUP_HELPER(); |
| 4924 | 4933 |
| 4925 START(); | 4934 START(); |
| 4926 __ Fmov(d0, n); | 4935 __ Fmov(d0, n); |
| 4927 __ Fmov(d1, m); | 4936 __ Fmov(d1, m); |
| 4928 __ Fmin(d28, d0, d1); | 4937 __ Fmin(d28, d0, d1); |
| 4929 __ Fmax(d29, d0, d1); | 4938 __ Fmax(d29, d0, d1); |
| 4930 __ Fminnm(d30, d0, d1); | 4939 __ Fminnm(d30, d0, d1); |
| 4931 __ Fmaxnm(d31, d0, d1); | 4940 __ Fmaxnm(d31, d0, d1); |
| 4932 END(); | 4941 END(); |
| 4933 | 4942 |
| 4934 RUN(); | 4943 RUN(); |
| 4935 | 4944 |
| 4936 ASSERT_EQUAL_FP64(min, d28); | 4945 ASSERT_EQUAL_FP64(min, d28); |
| 4937 ASSERT_EQUAL_FP64(max, d29); | 4946 ASSERT_EQUAL_FP64(max, d29); |
| 4938 ASSERT_EQUAL_FP64(minnm, d30); | 4947 ASSERT_EQUAL_FP64(minnm, d30); |
| 4939 ASSERT_EQUAL_FP64(maxnm, d31); | 4948 ASSERT_EQUAL_FP64(maxnm, d31); |
| 4940 | 4949 |
| 4941 TEARDOWN(); | 4950 TEARDOWN(); |
| 4942 } | 4951 } |
| 4943 | 4952 |
| 4944 | 4953 |
| 4945 TEST(fmax_fmin_d) { | 4954 TEST(fmax_fmin_d) { |
| 4955 CcTest::InitializeVM(); | |
| 4946 // Bootstrap tests. | 4956 // Bootstrap tests. |
| 4947 FminFmaxDoubleHelper(0, 0, 0, 0, 0, 0); | 4957 FminFmaxDoubleHelper(0, 0, 0, 0, 0, 0); |
| 4948 FminFmaxDoubleHelper(0, 1, 0, 1, 0, 1); | 4958 FminFmaxDoubleHelper(0, 1, 0, 1, 0, 1); |
| 4949 FminFmaxDoubleHelper(kFP64PositiveInfinity, kFP64NegativeInfinity, | 4959 FminFmaxDoubleHelper(kFP64PositiveInfinity, kFP64NegativeInfinity, |
| 4950 kFP64NegativeInfinity, kFP64PositiveInfinity, | 4960 kFP64NegativeInfinity, kFP64PositiveInfinity, |
| 4951 kFP64NegativeInfinity, kFP64PositiveInfinity); | 4961 kFP64NegativeInfinity, kFP64PositiveInfinity); |
| 4952 FminFmaxDoubleHelper(kFP64SignallingNaN, 0, | 4962 FminFmaxDoubleHelper(kFP64SignallingNaN, 0, |
| 4953 kFP64SignallingNaN, kFP64SignallingNaN, | 4963 kFP64SignallingNaN, kFP64SignallingNaN, |
| 4954 kFP64SignallingNaN, kFP64SignallingNaN); | 4964 kFP64SignallingNaN, kFP64SignallingNaN); |
| 4955 FminFmaxDoubleHelper(kFP64QuietNaN, 0, | 4965 FminFmaxDoubleHelper(kFP64QuietNaN, 0, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 4976 MinMaxHelper(n, m, false), | 4986 MinMaxHelper(n, m, false), |
| 4977 MinMaxHelper(n, m, true, kFP64PositiveInfinity), | 4987 MinMaxHelper(n, m, true, kFP64PositiveInfinity), |
| 4978 MinMaxHelper(n, m, false, kFP64NegativeInfinity)); | 4988 MinMaxHelper(n, m, false, kFP64NegativeInfinity)); |
| 4979 } | 4989 } |
| 4980 } | 4990 } |
| 4981 } | 4991 } |
| 4982 | 4992 |
| 4983 | 4993 |
| 4984 static void FminFmaxFloatHelper(float n, float m, float min, float max, | 4994 static void FminFmaxFloatHelper(float n, float m, float min, float max, |
| 4985 float minnm, float maxnm) { | 4995 float minnm, float maxnm) { |
| 4986 SETUP(); | 4996 SETUP_HELPER(); |
| 4987 | 4997 |
| 4988 START(); | 4998 START(); |
| 4989 // TODO(all): Signalling NaNs are sometimes converted by the C compiler to | 4999 // TODO(all): Signalling NaNs are sometimes converted by the C compiler to |
| 4990 // quiet NaNs on implicit casts from float to double. Here, we move the raw | 5000 // quiet NaNs on implicit casts from float to double. Here, we move the raw |
| 4991 // bits into a W register first, so we get the correct value. Fix Fmov so this | 5001 // bits into a W register first, so we get the correct value. Fix Fmov so this |
| 4992 // additional step is no longer needed. | 5002 // additional step is no longer needed. |
| 4993 __ Mov(w0, float_to_rawbits(n)); | 5003 __ Mov(w0, float_to_rawbits(n)); |
| 4994 __ Fmov(s0, w0); | 5004 __ Fmov(s0, w0); |
| 4995 __ Mov(w0, float_to_rawbits(m)); | 5005 __ Mov(w0, float_to_rawbits(m)); |
| 4996 __ Fmov(s1, w0); | 5006 __ Fmov(s1, w0); |
| 4997 __ Fmin(s28, s0, s1); | 5007 __ Fmin(s28, s0, s1); |
| 4998 __ Fmax(s29, s0, s1); | 5008 __ Fmax(s29, s0, s1); |
| 4999 __ Fminnm(s30, s0, s1); | 5009 __ Fminnm(s30, s0, s1); |
| 5000 __ Fmaxnm(s31, s0, s1); | 5010 __ Fmaxnm(s31, s0, s1); |
| 5001 END(); | 5011 END(); |
| 5002 | 5012 |
| 5003 RUN(); | 5013 RUN(); |
| 5004 | 5014 |
| 5005 ASSERT_EQUAL_FP32(min, s28); | 5015 ASSERT_EQUAL_FP32(min, s28); |
| 5006 ASSERT_EQUAL_FP32(max, s29); | 5016 ASSERT_EQUAL_FP32(max, s29); |
| 5007 ASSERT_EQUAL_FP32(minnm, s30); | 5017 ASSERT_EQUAL_FP32(minnm, s30); |
| 5008 ASSERT_EQUAL_FP32(maxnm, s31); | 5018 ASSERT_EQUAL_FP32(maxnm, s31); |
| 5009 | 5019 |
| 5010 TEARDOWN(); | 5020 TEARDOWN(); |
| 5011 } | 5021 } |
| 5012 | 5022 |
| 5013 | 5023 |
| 5014 TEST(fmax_fmin_s) { | 5024 TEST(fmax_fmin_s) { |
| 5025 CcTest::InitializeVM(); | |
| 5015 // Bootstrap tests. | 5026 // Bootstrap tests. |
| 5016 FminFmaxFloatHelper(0, 0, 0, 0, 0, 0); | 5027 FminFmaxFloatHelper(0, 0, 0, 0, 0, 0); |
| 5017 FminFmaxFloatHelper(0, 1, 0, 1, 0, 1); | 5028 FminFmaxFloatHelper(0, 1, 0, 1, 0, 1); |
| 5018 FminFmaxFloatHelper(kFP32PositiveInfinity, kFP32NegativeInfinity, | 5029 FminFmaxFloatHelper(kFP32PositiveInfinity, kFP32NegativeInfinity, |
| 5019 kFP32NegativeInfinity, kFP32PositiveInfinity, | 5030 kFP32NegativeInfinity, kFP32PositiveInfinity, |
| 5020 kFP32NegativeInfinity, kFP32PositiveInfinity); | 5031 kFP32NegativeInfinity, kFP32PositiveInfinity); |
| 5021 FminFmaxFloatHelper(kFP32SignallingNaN, 0, | 5032 FminFmaxFloatHelper(kFP32SignallingNaN, 0, |
| 5022 kFP32SignallingNaN, kFP32SignallingNaN, | 5033 kFP32SignallingNaN, kFP32SignallingNaN, |
| 5023 kFP32SignallingNaN, kFP32SignallingNaN); | 5034 kFP32SignallingNaN, kFP32SignallingNaN); |
| 5024 FminFmaxFloatHelper(kFP32QuietNaN, 0, | 5035 FminFmaxFloatHelper(kFP32QuietNaN, 0, |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5659 // - The remaining mantissa bits are copied until they run out. | 5670 // - The remaining mantissa bits are copied until they run out. |
| 5660 // - The low-order bits that haven't already been assigned are set to 0. | 5671 // - The low-order bits that haven't already been assigned are set to 0. |
| 5661 ASSERT_EQUAL_FP64(rawbits_to_double(0x7ff82468a0000000), d13); | 5672 ASSERT_EQUAL_FP64(rawbits_to_double(0x7ff82468a0000000), d13); |
| 5662 ASSERT_EQUAL_FP64(rawbits_to_double(0x7ff82468a0000000), d14); | 5673 ASSERT_EQUAL_FP64(rawbits_to_double(0x7ff82468a0000000), d14); |
| 5663 | 5674 |
| 5664 TEARDOWN(); | 5675 TEARDOWN(); |
| 5665 } | 5676 } |
| 5666 | 5677 |
| 5667 | 5678 |
| 5668 TEST(fcvt_sd) { | 5679 TEST(fcvt_sd) { |
| 5680 CcTest::InitializeVM(); | |
| 5669 // There are a huge number of corner-cases to check, so this test iterates | 5681 // There are a huge number of corner-cases to check, so this test iterates |
| 5670 // through a list. The list is then negated and checked again (since the sign | 5682 // through a list. The list is then negated and checked again (since the sign |
| 5671 // is irrelevant in ties-to-even rounding), so the list shouldn't include any | 5683 // is irrelevant in ties-to-even rounding), so the list shouldn't include any |
| 5672 // negative values. | 5684 // negative values. |
| 5673 // | 5685 // |
| 5674 // Note that this test only checks ties-to-even rounding, because that is all | 5686 // Note that this test only checks ties-to-even rounding, because that is all |
| 5675 // that the simulator supports. | 5687 // that the simulator supports. |
| 5676 struct {double in; float expected;} test[] = { | 5688 struct {double in; float expected;} test[] = { |
| 5677 // Check some simple conversions. | 5689 // Check some simple conversions. |
| 5678 {0.0, 0.0f}, | 5690 {0.0, 0.0f}, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5754 int count = sizeof(test) / sizeof(test[0]); | 5766 int count = sizeof(test) / sizeof(test[0]); |
| 5755 | 5767 |
| 5756 for (int i = 0; i < count; i++) { | 5768 for (int i = 0; i < count; i++) { |
| 5757 double in = test[i].in; | 5769 double in = test[i].in; |
| 5758 float expected = test[i].expected; | 5770 float expected = test[i].expected; |
| 5759 | 5771 |
| 5760 // We only expect positive input. | 5772 // We only expect positive input. |
| 5761 ASSERT(std::signbit(in) == 0); | 5773 ASSERT(std::signbit(in) == 0); |
| 5762 ASSERT(std::signbit(expected) == 0); | 5774 ASSERT(std::signbit(expected) == 0); |
| 5763 | 5775 |
| 5764 SETUP(); | 5776 SETUP_HELPER(); |
| 5765 START(); | 5777 START(); |
| 5766 | 5778 |
| 5767 __ Fmov(d10, in); | 5779 __ Fmov(d10, in); |
| 5768 __ Fcvt(s20, d10); | 5780 __ Fcvt(s20, d10); |
| 5769 | 5781 |
| 5770 __ Fmov(d11, -in); | 5782 __ Fmov(d11, -in); |
| 5771 __ Fcvt(s21, d11); | 5783 __ Fcvt(s21, d11); |
| 5772 | 5784 |
| 5773 END(); | 5785 END(); |
| 5774 RUN(); | 5786 RUN(); |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6616 int32_t s32 = s64 & 0x7fffffff; | 6628 int32_t s32 = s64 & 0x7fffffff; |
| 6617 | 6629 |
| 6618 bool cvtf_s32 = (s64 == s32); | 6630 bool cvtf_s32 = (s64 == s32); |
| 6619 bool cvtf_u32 = (u64 == u32); | 6631 bool cvtf_u32 = (u64 == u32); |
| 6620 | 6632 |
| 6621 double results_scvtf_x[65]; | 6633 double results_scvtf_x[65]; |
| 6622 double results_ucvtf_x[65]; | 6634 double results_ucvtf_x[65]; |
| 6623 double results_scvtf_w[33]; | 6635 double results_scvtf_w[33]; |
| 6624 double results_ucvtf_w[33]; | 6636 double results_ucvtf_w[33]; |
| 6625 | 6637 |
| 6626 SETUP(); | 6638 SETUP_HELPER(); |
| 6627 START(); | 6639 START(); |
| 6628 | 6640 |
| 6629 __ Mov(x0, reinterpret_cast<int64_t>(results_scvtf_x)); | 6641 __ Mov(x0, reinterpret_cast<int64_t>(results_scvtf_x)); |
| 6630 __ Mov(x1, reinterpret_cast<int64_t>(results_ucvtf_x)); | 6642 __ Mov(x1, reinterpret_cast<int64_t>(results_ucvtf_x)); |
| 6631 __ Mov(x2, reinterpret_cast<int64_t>(results_scvtf_w)); | 6643 __ Mov(x2, reinterpret_cast<int64_t>(results_scvtf_w)); |
| 6632 __ Mov(x3, reinterpret_cast<int64_t>(results_ucvtf_w)); | 6644 __ Mov(x3, reinterpret_cast<int64_t>(results_ucvtf_w)); |
| 6633 | 6645 |
| 6634 __ Mov(x10, s64); | 6646 __ Mov(x10, s64); |
| 6635 | 6647 |
| 6636 // Corrupt the top word, in case it is accidentally used during W-register | 6648 // Corrupt the top word, in case it is accidentally used during W-register |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6689 double expected_ucvtf = expected_ucvtf_base / pow(2, fbits); | 6701 double expected_ucvtf = expected_ucvtf_base / pow(2, fbits); |
| 6690 ASSERT_EQUAL_FP64(expected_scvtf, results_scvtf_x[fbits]); | 6702 ASSERT_EQUAL_FP64(expected_scvtf, results_scvtf_x[fbits]); |
| 6691 ASSERT_EQUAL_FP64(expected_ucvtf, results_ucvtf_x[fbits]); | 6703 ASSERT_EQUAL_FP64(expected_ucvtf, results_ucvtf_x[fbits]); |
| 6692 } | 6704 } |
| 6693 | 6705 |
| 6694 TEARDOWN(); | 6706 TEARDOWN(); |
| 6695 } | 6707 } |
| 6696 | 6708 |
| 6697 | 6709 |
| 6698 TEST(scvtf_ucvtf_double) { | 6710 TEST(scvtf_ucvtf_double) { |
| 6711 CcTest::InitializeVM(); | |
| 6699 // Simple conversions of positive numbers which require no rounding; the | 6712 // Simple conversions of positive numbers which require no rounding; the |
| 6700 // results should not depened on the rounding mode, and ucvtf and scvtf should | 6713 // results should not depened on the rounding mode, and ucvtf and scvtf should |
| 6701 // produce the same result. | 6714 // produce the same result. |
| 6702 TestUScvtfHelper(0x0000000000000000, 0x0000000000000000, 0x0000000000000000); | 6715 TestUScvtfHelper(0x0000000000000000, 0x0000000000000000, 0x0000000000000000); |
| 6703 TestUScvtfHelper(0x0000000000000001, 0x3ff0000000000000, 0x3ff0000000000000); | 6716 TestUScvtfHelper(0x0000000000000001, 0x3ff0000000000000, 0x3ff0000000000000); |
| 6704 TestUScvtfHelper(0x0000000040000000, 0x41d0000000000000, 0x41d0000000000000); | 6717 TestUScvtfHelper(0x0000000040000000, 0x41d0000000000000, 0x41d0000000000000); |
| 6705 TestUScvtfHelper(0x0000000100000000, 0x41f0000000000000, 0x41f0000000000000); | 6718 TestUScvtfHelper(0x0000000100000000, 0x41f0000000000000, 0x41f0000000000000); |
| 6706 TestUScvtfHelper(0x4000000000000000, 0x43d0000000000000, 0x43d0000000000000); | 6719 TestUScvtfHelper(0x4000000000000000, 0x43d0000000000000, 0x43d0000000000000); |
| 6707 // Test mantissa extremities. | 6720 // Test mantissa extremities. |
| 6708 TestUScvtfHelper(0x4000000000000400, 0x43d0000000000001, 0x43d0000000000001); | 6721 TestUScvtfHelper(0x4000000000000400, 0x43d0000000000001, 0x43d0000000000001); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6770 int32_t s32 = s64 & 0x7fffffff; | 6783 int32_t s32 = s64 & 0x7fffffff; |
| 6771 | 6784 |
| 6772 bool cvtf_s32 = (s64 == s32); | 6785 bool cvtf_s32 = (s64 == s32); |
| 6773 bool cvtf_u32 = (u64 == u32); | 6786 bool cvtf_u32 = (u64 == u32); |
| 6774 | 6787 |
| 6775 float results_scvtf_x[65]; | 6788 float results_scvtf_x[65]; |
| 6776 float results_ucvtf_x[65]; | 6789 float results_ucvtf_x[65]; |
| 6777 float results_scvtf_w[33]; | 6790 float results_scvtf_w[33]; |
| 6778 float results_ucvtf_w[33]; | 6791 float results_ucvtf_w[33]; |
| 6779 | 6792 |
| 6780 SETUP(); | 6793 SETUP_HELPER(); |
| 6781 START(); | 6794 START(); |
| 6782 | 6795 |
| 6783 __ Mov(x0, reinterpret_cast<int64_t>(results_scvtf_x)); | 6796 __ Mov(x0, reinterpret_cast<int64_t>(results_scvtf_x)); |
| 6784 __ Mov(x1, reinterpret_cast<int64_t>(results_ucvtf_x)); | 6797 __ Mov(x1, reinterpret_cast<int64_t>(results_ucvtf_x)); |
| 6785 __ Mov(x2, reinterpret_cast<int64_t>(results_scvtf_w)); | 6798 __ Mov(x2, reinterpret_cast<int64_t>(results_scvtf_w)); |
| 6786 __ Mov(x3, reinterpret_cast<int64_t>(results_ucvtf_w)); | 6799 __ Mov(x3, reinterpret_cast<int64_t>(results_ucvtf_w)); |
| 6787 | 6800 |
| 6788 __ Mov(x10, s64); | 6801 __ Mov(x10, s64); |
| 6789 | 6802 |
| 6790 // Corrupt the top word, in case it is accidentally used during W-register | 6803 // Corrupt the top word, in case it is accidentally used during W-register |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6845 float expected_ucvtf = expected_ucvtf_base / powf(2, fbits); | 6858 float expected_ucvtf = expected_ucvtf_base / powf(2, fbits); |
| 6846 ASSERT_EQUAL_FP32(expected_scvtf, results_scvtf_x[fbits]); | 6859 ASSERT_EQUAL_FP32(expected_scvtf, results_scvtf_x[fbits]); |
| 6847 ASSERT_EQUAL_FP32(expected_ucvtf, results_ucvtf_x[fbits]); | 6860 ASSERT_EQUAL_FP32(expected_ucvtf, results_ucvtf_x[fbits]); |
| 6848 } | 6861 } |
| 6849 | 6862 |
| 6850 TEARDOWN(); | 6863 TEARDOWN(); |
| 6851 } | 6864 } |
| 6852 | 6865 |
| 6853 | 6866 |
| 6854 TEST(scvtf_ucvtf_float) { | 6867 TEST(scvtf_ucvtf_float) { |
| 6868 CcTest::InitializeVM(); | |
| 6855 // Simple conversions of positive numbers which require no rounding; the | 6869 // Simple conversions of positive numbers which require no rounding; the |
| 6856 // results should not depened on the rounding mode, and ucvtf and scvtf should | 6870 // results should not depened on the rounding mode, and ucvtf and scvtf should |
| 6857 // produce the same result. | 6871 // produce the same result. |
| 6858 TestUScvtf32Helper(0x0000000000000000, 0x00000000, 0x00000000); | 6872 TestUScvtf32Helper(0x0000000000000000, 0x00000000, 0x00000000); |
| 6859 TestUScvtf32Helper(0x0000000000000001, 0x3f800000, 0x3f800000); | 6873 TestUScvtf32Helper(0x0000000000000001, 0x3f800000, 0x3f800000); |
| 6860 TestUScvtf32Helper(0x0000000040000000, 0x4e800000, 0x4e800000); | 6874 TestUScvtf32Helper(0x0000000040000000, 0x4e800000, 0x4e800000); |
| 6861 TestUScvtf32Helper(0x0000000100000000, 0x4f800000, 0x4f800000); | 6875 TestUScvtf32Helper(0x0000000100000000, 0x4f800000, 0x4f800000); |
| 6862 TestUScvtf32Helper(0x4000000000000000, 0x5e800000, 0x5e800000); | 6876 TestUScvtf32Helper(0x4000000000000000, 0x5e800000, 0x5e800000); |
| 6863 // Test mantissa extremities. | 6877 // Test mantissa extremities. |
| 6864 TestUScvtf32Helper(0x0000000000800001, 0x4b000001, 0x4b000001); | 6878 TestUScvtf32Helper(0x0000000000800001, 0x4b000001, 0x4b000001); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7515 // * Pop <reg_count> registers to restore the original contents. | 7529 // * Pop <reg_count> registers to restore the original contents. |
| 7516 // * Drop <claim> bytes to restore the original stack pointer. | 7530 // * Drop <claim> bytes to restore the original stack pointer. |
| 7517 // | 7531 // |
| 7518 // Different push and pop methods can be specified independently to test for | 7532 // Different push and pop methods can be specified independently to test for |
| 7519 // proper word-endian behaviour. | 7533 // proper word-endian behaviour. |
| 7520 static void PushPopJsspSimpleHelper(int reg_count, | 7534 static void PushPopJsspSimpleHelper(int reg_count, |
| 7521 int claim, | 7535 int claim, |
| 7522 int reg_size, | 7536 int reg_size, |
| 7523 PushPopMethod push_method, | 7537 PushPopMethod push_method, |
| 7524 PushPopMethod pop_method) { | 7538 PushPopMethod pop_method) { |
| 7525 SETUP(); | 7539 SETUP_HELPER(); |
| 7526 | 7540 |
| 7527 START(); | 7541 START(); |
| 7528 | 7542 |
| 7529 // Registers x8 and x9 are used by the macro assembler for debug code (for | 7543 // Registers x8 and x9 are used by the macro assembler for debug code (for |
| 7530 // example in 'Pop'), so we can't use them here. We can't use jssp because it | 7544 // example in 'Pop'), so we can't use them here. We can't use jssp because it |
| 7531 // will be the stack pointer for this test. | 7545 // will be the stack pointer for this test. |
| 7532 static RegList const allowed = ~(x8.Bit() | x9.Bit() | jssp.Bit()); | 7546 static RegList const allowed = ~(x8.Bit() | x9.Bit() | jssp.Bit()); |
| 7533 if (reg_count == kPushPopJsspMaxRegCount) { | 7547 if (reg_count == kPushPopJsspMaxRegCount) { |
| 7534 reg_count = CountSetBits(allowed, kNumberOfRegisters); | 7548 reg_count = CountSetBits(allowed, kNumberOfRegisters); |
| 7535 } | 7549 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7627 } else { | 7641 } else { |
| 7628 ASSERT_EQUAL_64(literal_base * i, x[i]); | 7642 ASSERT_EQUAL_64(literal_base * i, x[i]); |
| 7629 } | 7643 } |
| 7630 } | 7644 } |
| 7631 | 7645 |
| 7632 TEARDOWN(); | 7646 TEARDOWN(); |
| 7633 } | 7647 } |
| 7634 | 7648 |
| 7635 | 7649 |
| 7636 TEST(push_pop_jssp_simple_32) { | 7650 TEST(push_pop_jssp_simple_32) { |
| 7651 CcTest::InitializeVM(); | |
| 7637 for (int claim = 0; claim <= 8; claim++) { | 7652 for (int claim = 0; claim <= 8; claim++) { |
| 7638 for (int count = 0; count <= 8; count++) { | 7653 for (int count = 0; count <= 8; count++) { |
| 7639 PushPopJsspSimpleHelper(count, claim, kWRegSize, | 7654 PushPopJsspSimpleHelper(count, claim, kWRegSize, |
| 7640 PushPopByFour, PushPopByFour); | 7655 PushPopByFour, PushPopByFour); |
| 7641 PushPopJsspSimpleHelper(count, claim, kWRegSize, | 7656 PushPopJsspSimpleHelper(count, claim, kWRegSize, |
| 7642 PushPopByFour, PushPopRegList); | 7657 PushPopByFour, PushPopRegList); |
| 7643 PushPopJsspSimpleHelper(count, claim, kWRegSize, | 7658 PushPopJsspSimpleHelper(count, claim, kWRegSize, |
| 7644 PushPopRegList, PushPopByFour); | 7659 PushPopRegList, PushPopByFour); |
| 7645 PushPopJsspSimpleHelper(count, claim, kWRegSize, | 7660 PushPopJsspSimpleHelper(count, claim, kWRegSize, |
| 7646 PushPopRegList, PushPopRegList); | 7661 PushPopRegList, PushPopRegList); |
| 7647 } | 7662 } |
| 7648 // Test with the maximum number of registers. | 7663 // Test with the maximum number of registers. |
| 7649 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, | 7664 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, |
| 7650 PushPopByFour, PushPopByFour); | 7665 PushPopByFour, PushPopByFour); |
| 7651 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, | 7666 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, |
| 7652 PushPopByFour, PushPopRegList); | 7667 PushPopByFour, PushPopRegList); |
| 7653 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, | 7668 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, |
| 7654 PushPopRegList, PushPopByFour); | 7669 PushPopRegList, PushPopByFour); |
| 7655 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, | 7670 PushPopJsspSimpleHelper(kPushPopJsspMaxRegCount, claim, kWRegSize, |
| 7656 PushPopRegList, PushPopRegList); | 7671 PushPopRegList, PushPopRegList); |
| 7657 } | 7672 } |
| 7658 } | 7673 } |
| 7659 | 7674 |
| 7660 | 7675 |
| 7661 TEST(push_pop_jssp_simple_64) { | 7676 TEST(push_pop_jssp_simple_64) { |
| 7677 CcTest::InitializeVM(); | |
| 7662 for (int claim = 0; claim <= 8; claim++) { | 7678 for (int claim = 0; claim <= 8; claim++) { |
| 7663 for (int count = 0; count <= 8; count++) { | 7679 for (int count = 0; count <= 8; count++) { |
| 7664 PushPopJsspSimpleHelper(count, claim, kXRegSize, | 7680 PushPopJsspSimpleHelper(count, claim, kXRegSize, |
| 7665 PushPopByFour, PushPopByFour); | 7681 PushPopByFour, PushPopByFour); |
| 7666 PushPopJsspSimpleHelper(count, claim, kXRegSize, | 7682 PushPopJsspSimpleHelper(count, claim, kXRegSize, |
| 7667 PushPopByFour, PushPopRegList); | 7683 PushPopByFour, PushPopRegList); |
| 7668 PushPopJsspSimpleHelper(count, claim, kXRegSize, | 7684 PushPopJsspSimpleHelper(count, claim, kXRegSize, |
| 7669 PushPopRegList, PushPopByFour); | 7685 PushPopRegList, PushPopByFour); |
| 7670 PushPopJsspSimpleHelper(count, claim, kXRegSize, | 7686 PushPopJsspSimpleHelper(count, claim, kXRegSize, |
| 7671 PushPopRegList, PushPopRegList); | 7687 PushPopRegList, PushPopRegList); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 7694 // * Pop <reg_count> FP registers to restore the original contents. | 7710 // * Pop <reg_count> FP registers to restore the original contents. |
| 7695 // * Drop <claim> bytes to restore the original stack pointer. | 7711 // * Drop <claim> bytes to restore the original stack pointer. |
| 7696 // | 7712 // |
| 7697 // Different push and pop methods can be specified independently to test for | 7713 // Different push and pop methods can be specified independently to test for |
| 7698 // proper word-endian behaviour. | 7714 // proper word-endian behaviour. |
| 7699 static void PushPopFPJsspSimpleHelper(int reg_count, | 7715 static void PushPopFPJsspSimpleHelper(int reg_count, |
| 7700 int claim, | 7716 int claim, |
| 7701 int reg_size, | 7717 int reg_size, |
| 7702 PushPopMethod push_method, | 7718 PushPopMethod push_method, |
| 7703 PushPopMethod pop_method) { | 7719 PushPopMethod pop_method) { |
| 7704 SETUP(); | 7720 SETUP_HELPER(); |
| 7705 | 7721 |
| 7706 START(); | 7722 START(); |
| 7707 | 7723 |
| 7708 // We can use any floating-point register. None of them are reserved for | 7724 // We can use any floating-point register. None of them are reserved for |
| 7709 // debug code, for example. | 7725 // debug code, for example. |
| 7710 static RegList const allowed = ~0; | 7726 static RegList const allowed = ~0; |
| 7711 if (reg_count == kPushPopFPJsspMaxRegCount) { | 7727 if (reg_count == kPushPopFPJsspMaxRegCount) { |
| 7712 reg_count = CountSetBits(allowed, kNumberOfFPRegisters); | 7728 reg_count = CountSetBits(allowed, kNumberOfFPRegisters); |
| 7713 } | 7729 } |
| 7714 // Work out which registers to use, based on reg_size. | 7730 // Work out which registers to use, based on reg_size. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7808 double expected; | 7824 double expected; |
| 7809 memcpy(&expected, &literal, sizeof(expected)); | 7825 memcpy(&expected, &literal, sizeof(expected)); |
| 7810 ASSERT_EQUAL_FP64(expected, d[i]); | 7826 ASSERT_EQUAL_FP64(expected, d[i]); |
| 7811 } | 7827 } |
| 7812 | 7828 |
| 7813 TEARDOWN(); | 7829 TEARDOWN(); |
| 7814 } | 7830 } |
| 7815 | 7831 |
| 7816 | 7832 |
| 7817 TEST(push_pop_fp_jssp_simple_32) { | 7833 TEST(push_pop_fp_jssp_simple_32) { |
| 7834 CcTest::InitializeVM(); | |
| 7818 for (int claim = 0; claim <= 8; claim++) { | 7835 for (int claim = 0; claim <= 8; claim++) { |
| 7819 for (int count = 0; count <= 8; count++) { | 7836 for (int count = 0; count <= 8; count++) { |
| 7820 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, | 7837 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, |
| 7821 PushPopByFour, PushPopByFour); | 7838 PushPopByFour, PushPopByFour); |
| 7822 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, | 7839 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, |
| 7823 PushPopByFour, PushPopRegList); | 7840 PushPopByFour, PushPopRegList); |
| 7824 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, | 7841 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, |
| 7825 PushPopRegList, PushPopByFour); | 7842 PushPopRegList, PushPopByFour); |
| 7826 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, | 7843 PushPopFPJsspSimpleHelper(count, claim, kSRegSize, |
| 7827 PushPopRegList, PushPopRegList); | 7844 PushPopRegList, PushPopRegList); |
| 7828 } | 7845 } |
| 7829 // Test with the maximum number of registers. | 7846 // Test with the maximum number of registers. |
| 7830 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, | 7847 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, |
| 7831 PushPopByFour, PushPopByFour); | 7848 PushPopByFour, PushPopByFour); |
| 7832 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, | 7849 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, |
| 7833 PushPopByFour, PushPopRegList); | 7850 PushPopByFour, PushPopRegList); |
| 7834 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, | 7851 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, |
| 7835 PushPopRegList, PushPopByFour); | 7852 PushPopRegList, PushPopByFour); |
| 7836 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, | 7853 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kSRegSize, |
| 7837 PushPopRegList, PushPopRegList); | 7854 PushPopRegList, PushPopRegList); |
| 7838 } | 7855 } |
| 7839 } | 7856 } |
| 7840 | 7857 |
| 7841 | 7858 |
| 7842 TEST(push_pop_fp_jssp_simple_64) { | 7859 TEST(push_pop_fp_jssp_simple_64) { |
| 7860 CcTest::InitializeVM(); | |
| 7843 for (int claim = 0; claim <= 8; claim++) { | 7861 for (int claim = 0; claim <= 8; claim++) { |
| 7844 for (int count = 0; count <= 8; count++) { | 7862 for (int count = 0; count <= 8; count++) { |
| 7845 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, | 7863 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, |
| 7846 PushPopByFour, PushPopByFour); | 7864 PushPopByFour, PushPopByFour); |
| 7847 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, | 7865 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, |
| 7848 PushPopByFour, PushPopRegList); | 7866 PushPopByFour, PushPopRegList); |
| 7849 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, | 7867 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, |
| 7850 PushPopRegList, PushPopByFour); | 7868 PushPopRegList, PushPopByFour); |
| 7851 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, | 7869 PushPopFPJsspSimpleHelper(count, claim, kDRegSize, |
| 7852 PushPopRegList, PushPopRegList); | 7870 PushPopRegList, PushPopRegList); |
| 7853 } | 7871 } |
| 7854 // Test with the maximum number of registers. | 7872 // Test with the maximum number of registers. |
| 7855 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSize, | 7873 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSize, |
| 7856 PushPopByFour, PushPopByFour); | 7874 PushPopByFour, PushPopByFour); |
| 7857 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSize, | 7875 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSize, |
| 7858 PushPopByFour, PushPopRegList); | 7876 PushPopByFour, PushPopRegList); |
| 7859 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSize, | 7877 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSize, |
| 7860 PushPopRegList, PushPopByFour); | 7878 PushPopRegList, PushPopByFour); |
| 7861 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSize, | 7879 PushPopFPJsspSimpleHelper(kPushPopFPJsspMaxRegCount, claim, kDRegSize, |
| 7862 PushPopRegList, PushPopRegList); | 7880 PushPopRegList, PushPopRegList); |
| 7863 } | 7881 } |
| 7864 } | 7882 } |
| 7865 | 7883 |
| 7866 | 7884 |
| 7867 // Push and pop data using an overlapping combination of Push/Pop and | 7885 // Push and pop data using an overlapping combination of Push/Pop and |
| 7868 // RegList-based methods. | 7886 // RegList-based methods. |
| 7869 static void PushPopJsspMixedMethodsHelper(int claim, int reg_size) { | 7887 static void PushPopJsspMixedMethodsHelper(int claim, int reg_size) { |
| 7870 SETUP(); | 7888 SETUP_HELPER(); |
| 7871 | 7889 |
| 7872 // Registers x8 and x9 are used by the macro assembler for debug code (for | 7890 // Registers x8 and x9 are used by the macro assembler for debug code (for |
| 7873 // example in 'Pop'), so we can't use them here. We can't use jssp because it | 7891 // example in 'Pop'), so we can't use them here. We can't use jssp because it |
| 7874 // will be the stack pointer for this test. | 7892 // will be the stack pointer for this test. |
| 7875 static RegList const allowed = | 7893 static RegList const allowed = |
| 7876 ~(x8.Bit() | x9.Bit() | jssp.Bit() | xzr.Bit()); | 7894 ~(x8.Bit() | x9.Bit() | jssp.Bit() | xzr.Bit()); |
| 7877 // Work out which registers to use, based on reg_size. | 7895 // Work out which registers to use, based on reg_size. |
| 7878 Register r[10]; | 7896 Register r[10]; |
| 7879 Register x[10]; | 7897 Register x[10]; |
| 7880 PopulateRegisterArray(NULL, x, r, reg_size, 10, allowed); | 7898 PopulateRegisterArray(NULL, x, r, reg_size, 10, allowed); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7947 ASSERT_EQUAL_64(literal_base * 0, x[7]); | 7965 ASSERT_EQUAL_64(literal_base * 0, x[7]); |
| 7948 ASSERT_EQUAL_64(literal_base * 3, x[6]); | 7966 ASSERT_EQUAL_64(literal_base * 3, x[6]); |
| 7949 ASSERT_EQUAL_64(literal_base * 1, x[5]); | 7967 ASSERT_EQUAL_64(literal_base * 1, x[5]); |
| 7950 ASSERT_EQUAL_64(literal_base * 2, x[4]); | 7968 ASSERT_EQUAL_64(literal_base * 2, x[4]); |
| 7951 | 7969 |
| 7952 TEARDOWN(); | 7970 TEARDOWN(); |
| 7953 } | 7971 } |
| 7954 | 7972 |
| 7955 | 7973 |
| 7956 TEST(push_pop_jssp_mixed_methods_64) { | 7974 TEST(push_pop_jssp_mixed_methods_64) { |
| 7975 CcTest::InitializeVM(); | |
| 7957 for (int claim = 0; claim <= 8; claim++) { | 7976 for (int claim = 0; claim <= 8; claim++) { |
| 7958 PushPopJsspMixedMethodsHelper(claim, kXRegSize); | 7977 PushPopJsspMixedMethodsHelper(claim, kXRegSize); |
| 7959 } | 7978 } |
| 7960 } | 7979 } |
| 7961 | 7980 |
| 7962 | 7981 |
| 7963 TEST(push_pop_jssp_mixed_methods_32) { | 7982 TEST(push_pop_jssp_mixed_methods_32) { |
| 7983 CcTest::InitializeVM(); | |
| 7964 for (int claim = 0; claim <= 8; claim++) { | 7984 for (int claim = 0; claim <= 8; claim++) { |
| 7965 PushPopJsspMixedMethodsHelper(claim, kWRegSize); | 7985 PushPopJsspMixedMethodsHelper(claim, kWRegSize); |
| 7966 } | 7986 } |
| 7967 } | 7987 } |
| 7968 | 7988 |
| 7969 | 7989 |
| 7970 // Push and pop data using overlapping X- and W-sized quantities. | 7990 // Push and pop data using overlapping X- and W-sized quantities. |
| 7971 static void PushPopJsspWXOverlapHelper(int reg_count, int claim) { | 7991 static void PushPopJsspWXOverlapHelper(int reg_count, int claim) { |
| 7972 // This test emits rather a lot of code. | 7992 // This test emits rather a lot of code. |
| 7973 SETUP_SIZE(BUF_SIZE * 2); | 7993 SETUP_SIZE(BUF_SIZE * 2); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8149 ASSERT_EQUAL_64(expected, x[i]); | 8169 ASSERT_EQUAL_64(expected, x[i]); |
| 8150 } | 8170 } |
| 8151 } | 8171 } |
| 8152 ASSERT(slot == requested_w_slots); | 8172 ASSERT(slot == requested_w_slots); |
| 8153 | 8173 |
| 8154 TEARDOWN(); | 8174 TEARDOWN(); |
| 8155 } | 8175 } |
| 8156 | 8176 |
| 8157 | 8177 |
| 8158 TEST(push_pop_jssp_wx_overlap) { | 8178 TEST(push_pop_jssp_wx_overlap) { |
| 8179 CcTest::InitializeVM(); | |
| 8159 for (int claim = 0; claim <= 8; claim++) { | 8180 for (int claim = 0; claim <= 8; claim++) { |
| 8160 for (int count = 1; count <= 8; count++) { | 8181 for (int count = 1; count <= 8; count++) { |
| 8161 PushPopJsspWXOverlapHelper(count, claim); | 8182 PushPopJsspWXOverlapHelper(count, claim); |
| 8162 PushPopJsspWXOverlapHelper(count, claim); | 8183 PushPopJsspWXOverlapHelper(count, claim); |
| 8163 PushPopJsspWXOverlapHelper(count, claim); | 8184 PushPopJsspWXOverlapHelper(count, claim); |
| 8164 PushPopJsspWXOverlapHelper(count, claim); | 8185 PushPopJsspWXOverlapHelper(count, claim); |
| 8165 } | 8186 } |
| 8166 // Test with the maximum number of registers. | 8187 // Test with the maximum number of registers. |
| 8167 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); | 8188 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); |
| 8168 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); | 8189 PushPopJsspWXOverlapHelper(kPushPopJsspMaxRegCount, claim); |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8974 dst_tagged[0] = kHeapObjectTag; | 8995 dst_tagged[0] = kHeapObjectTag; |
| 8975 | 8996 |
| 8976 // Allocate memory for each other test. Each test <n> will have <n> fields. | 8997 // Allocate memory for each other test. Each test <n> will have <n> fields. |
| 8977 // This is intended to exercise as many paths in CopyFields as possible. | 8998 // This is intended to exercise as many paths in CopyFields as possible. |
| 8978 for (unsigned i = 1; i < kTestCount; i++) { | 8999 for (unsigned i = 1; i < kTestCount; i++) { |
| 8979 dst[i] = new uint64_t[i]; | 9000 dst[i] = new uint64_t[i]; |
| 8980 memset(dst[i], 0, i * sizeof(kLiteralBase)); | 9001 memset(dst[i], 0, i * sizeof(kLiteralBase)); |
| 8981 dst_tagged[i] = reinterpret_cast<uint64_t>(dst[i]) + kHeapObjectTag; | 9002 dst_tagged[i] = reinterpret_cast<uint64_t>(dst[i]) + kHeapObjectTag; |
| 8982 } | 9003 } |
| 8983 | 9004 |
| 8984 SETUP(); | 9005 SETUP_HELPER(); |
| 8985 START(); | 9006 START(); |
| 8986 | 9007 |
| 8987 __ Mov(x0, dst_tagged[0]); | 9008 __ Mov(x0, dst_tagged[0]); |
| 8988 __ Mov(x1, 0); | 9009 __ Mov(x1, 0); |
| 8989 __ CopyFields(x0, x1, temps, 0); | 9010 __ CopyFields(x0, x1, temps, 0); |
| 8990 for (unsigned i = 1; i < kTestCount; i++) { | 9011 for (unsigned i = 1; i < kTestCount; i++) { |
| 8991 __ Mov(x0, dst_tagged[i]); | 9012 __ Mov(x0, dst_tagged[i]); |
| 8992 __ Mov(x1, src_tagged); | 9013 __ Mov(x1, src_tagged); |
| 8993 __ CopyFields(x0, x1, temps, i); | 9014 __ CopyFields(x0, x1, temps, i); |
| 8994 } | 9015 } |
| 8995 | 9016 |
| 8996 END(); | 9017 END(); |
| 8997 RUN(); | 9018 RUN(); |
| 8998 TEARDOWN(); | 9019 TEARDOWN(); |
| 8999 | 9020 |
| 9000 for (unsigned i = 1; i < kTestCount; i++) { | 9021 for (unsigned i = 1; i < kTestCount; i++) { |
| 9001 for (unsigned j = 0; j < i; j++) { | 9022 for (unsigned j = 0; j < i; j++) { |
| 9002 CHECK(src[j] == dst[i][j]); | 9023 CHECK(src[j] == dst[i][j]); |
| 9003 } | 9024 } |
| 9004 delete [] dst[i]; | 9025 delete [] dst[i]; |
| 9005 } | 9026 } |
| 9006 } | 9027 } |
| 9007 | 9028 |
| 9008 | 9029 |
| 9009 // This is a V8-specific test. | 9030 // This is a V8-specific test. |
| 9010 TEST(copyfields) { | 9031 TEST(copyfields) { |
| 9032 CcTest::InitializeVM(); | |
| 9011 CopyFieldsHelper(CPURegList(x10)); | 9033 CopyFieldsHelper(CPURegList(x10)); |
| 9012 CopyFieldsHelper(CPURegList(x10, x11)); | 9034 CopyFieldsHelper(CPURegList(x10, x11)); |
| 9013 CopyFieldsHelper(CPURegList(x10, x11, x12)); | 9035 CopyFieldsHelper(CPURegList(x10, x11, x12)); |
| 9014 CopyFieldsHelper(CPURegList(x10, x11, x12, x13)); | 9036 CopyFieldsHelper(CPURegList(x10, x11, x12, x13)); |
| 9015 } | 9037 } |
| 9016 | 9038 |
| 9017 | 9039 |
| 9018 static void DoSmiAbsTest(int32_t value, bool must_fail = false) { | 9040 static void DoSmiAbsTest(int32_t value, bool must_fail = false) { |
| 9019 SETUP(); | 9041 SETUP_HELPER(); |
| 9020 | 9042 |
| 9021 START(); | 9043 START(); |
| 9022 Label end, slow; | 9044 Label end, slow; |
| 9023 __ Mov(x2, 0xc001c0de); | 9045 __ Mov(x2, 0xc001c0de); |
| 9024 __ Mov(x1, value); | 9046 __ Mov(x1, value); |
| 9025 __ SmiTag(x1); | 9047 __ SmiTag(x1); |
| 9026 __ SmiAbs(x1, x0, &slow); | 9048 __ SmiAbs(x1, x0, &slow); |
| 9027 __ SmiUntag(x1); | 9049 __ SmiUntag(x1); |
| 9028 __ B(&end); | 9050 __ B(&end); |
| 9029 | 9051 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 9045 | 9067 |
| 9046 // Check that we didn't jump on slow. | 9068 // Check that we didn't jump on slow. |
| 9047 ASSERT_EQUAL_64(0xc001c0de, x2); | 9069 ASSERT_EQUAL_64(0xc001c0de, x2); |
| 9048 } | 9070 } |
| 9049 | 9071 |
| 9050 TEARDOWN(); | 9072 TEARDOWN(); |
| 9051 } | 9073 } |
| 9052 | 9074 |
| 9053 | 9075 |
| 9054 TEST(smi_abs) { | 9076 TEST(smi_abs) { |
| 9077 CcTest::InitializeVM(); | |
| 9055 // Simple and edge cases. | 9078 // Simple and edge cases. |
| 9056 DoSmiAbsTest(0); | 9079 DoSmiAbsTest(0); |
| 9057 DoSmiAbsTest(0x12345); | 9080 DoSmiAbsTest(0x12345); |
| 9058 DoSmiAbsTest(0x40000000); | 9081 DoSmiAbsTest(0x40000000); |
| 9059 DoSmiAbsTest(0x7fffffff); | 9082 DoSmiAbsTest(0x7fffffff); |
| 9060 DoSmiAbsTest(-1); | 9083 DoSmiAbsTest(-1); |
| 9061 DoSmiAbsTest(-12345); | 9084 DoSmiAbsTest(-12345); |
| 9062 DoSmiAbsTest(0x80000001); | 9085 DoSmiAbsTest(0x80000001); |
| 9063 | 9086 |
| 9064 // Check that the most negative SMI is detected. | 9087 // Check that the most negative SMI is detected. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9192 // TODO(jbramley): Once Crankshaft is complete, decide if we need to support | 9215 // TODO(jbramley): Once Crankshaft is complete, decide if we need to support |
| 9193 // non-relocatable calls at all. | 9216 // non-relocatable calls at all. |
| 9194 CHECK(return_address == | 9217 CHECK(return_address == |
| 9195 Assembler::return_address_from_call_start(call_start)); | 9218 Assembler::return_address_from_call_start(call_start)); |
| 9196 | 9219 |
| 9197 TEARDOWN(); | 9220 TEARDOWN(); |
| 9198 } | 9221 } |
| 9199 | 9222 |
| 9200 | 9223 |
| 9201 static void ECMA262ToInt32Helper(int32_t expected, double input) { | 9224 static void ECMA262ToInt32Helper(int32_t expected, double input) { |
| 9202 SETUP(); | 9225 SETUP_HELPER(); |
| 9203 START(); | 9226 START(); |
| 9204 | 9227 |
| 9205 __ Fmov(d0, input); | 9228 __ Fmov(d0, input); |
| 9206 | 9229 |
| 9207 __ ECMA262ToInt32(x0, d0, x10, x11, MacroAssembler::INT32_IN_W); | 9230 __ ECMA262ToInt32(x0, d0, x10, x11, MacroAssembler::INT32_IN_W); |
| 9208 __ ECMA262ToInt32(x1, d0, x10, x11, MacroAssembler::INT32_IN_X); | 9231 __ ECMA262ToInt32(x1, d0, x10, x11, MacroAssembler::INT32_IN_X); |
| 9209 __ ECMA262ToInt32(x2, d0, x10, x11, MacroAssembler::SMI); | 9232 __ ECMA262ToInt32(x2, d0, x10, x11, MacroAssembler::SMI); |
| 9210 | 9233 |
| 9211 // The upper bits of INT32_IN_W are undefined, so make sure we don't try to | 9234 // The upper bits of INT32_IN_W are undefined, so make sure we don't try to |
| 9212 // test them. | 9235 // test them. |
| 9213 __ Mov(w0, w0); | 9236 __ Mov(w0, w0); |
| 9214 | 9237 |
| 9215 END(); | 9238 END(); |
| 9216 | 9239 |
| 9217 RUN(); | 9240 RUN(); |
| 9218 | 9241 |
| 9219 int64_t expected64 = expected; | 9242 int64_t expected64 = expected; |
| 9220 | 9243 |
| 9221 ASSERT_EQUAL_32(expected, w0); | 9244 ASSERT_EQUAL_32(expected, w0); |
| 9222 ASSERT_EQUAL_64(expected64, x1); | 9245 ASSERT_EQUAL_64(expected64, x1); |
| 9223 ASSERT_EQUAL_64(expected64 << kSmiShift | kSmiTag, x2); | 9246 ASSERT_EQUAL_64(expected64 << kSmiShift | kSmiTag, x2); |
| 9224 | 9247 |
| 9225 TEARDOWN(); | 9248 TEARDOWN(); |
| 9226 } | 9249 } |
| 9227 | 9250 |
| 9228 | 9251 |
| 9229 TEST(ecma_262_to_int32) { | 9252 TEST(ecma_262_to_int32) { |
| 9253 CcTest::InitializeVM(); | |
| 9230 // ==== exponent < 64 ==== | 9254 // ==== exponent < 64 ==== |
| 9231 | 9255 |
| 9232 ECMA262ToInt32Helper(0, 0.0); | 9256 ECMA262ToInt32Helper(0, 0.0); |
| 9233 ECMA262ToInt32Helper(0, -0.0); | 9257 ECMA262ToInt32Helper(0, -0.0); |
| 9234 ECMA262ToInt32Helper(1, 1.0); | 9258 ECMA262ToInt32Helper(1, 1.0); |
| 9235 ECMA262ToInt32Helper(-1, -1.0); | 9259 ECMA262ToInt32Helper(-1, -1.0); |
| 9236 | 9260 |
| 9237 // The largest representable value that is less than 1. | 9261 // The largest representable value that is less than 1. |
| 9238 ECMA262ToInt32Helper(0, 0x001fffffffffffff * pow(2, -53)); | 9262 ECMA262ToInt32Helper(0, 0x001fffffffffffff * pow(2, -53)); |
| 9239 ECMA262ToInt32Helper(0, 0x001fffffffffffff * -pow(2, -53)); | 9263 ECMA262ToInt32Helper(0, 0x001fffffffffffff * -pow(2, -53)); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9294 ECMA262ToInt32Helper(0, std::numeric_limits<double>::quiet_NaN()); | 9318 ECMA262ToInt32Helper(0, std::numeric_limits<double>::quiet_NaN()); |
| 9295 ECMA262ToInt32Helper(0, -std::numeric_limits<double>::quiet_NaN()); | 9319 ECMA262ToInt32Helper(0, -std::numeric_limits<double>::quiet_NaN()); |
| 9296 ECMA262ToInt32Helper(0, std::numeric_limits<double>::signaling_NaN()); | 9320 ECMA262ToInt32Helper(0, std::numeric_limits<double>::signaling_NaN()); |
| 9297 ECMA262ToInt32Helper(0, -std::numeric_limits<double>::signaling_NaN()); | 9321 ECMA262ToInt32Helper(0, -std::numeric_limits<double>::signaling_NaN()); |
| 9298 } | 9322 } |
| 9299 | 9323 |
| 9300 | 9324 |
| 9301 static void AbsHelperX(int64_t value) { | 9325 static void AbsHelperX(int64_t value) { |
| 9302 int64_t expected; | 9326 int64_t expected; |
| 9303 | 9327 |
| 9304 SETUP(); | 9328 SETUP_HELPER(); |
| 9305 START(); | 9329 START(); |
| 9306 | 9330 |
| 9307 Label fail; | 9331 Label fail; |
| 9308 Label done; | 9332 Label done; |
| 9309 | 9333 |
| 9310 __ Mov(x0, 0); | 9334 __ Mov(x0, 0); |
| 9311 __ Mov(x1, value); | 9335 __ Mov(x1, value); |
| 9312 | 9336 |
| 9313 if (value != kXMinInt) { | 9337 if (value != kXMinInt) { |
| 9314 expected = labs(value); | 9338 expected = labs(value); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9349 ASSERT_EQUAL_64(expected, x12); | 9373 ASSERT_EQUAL_64(expected, x12); |
| 9350 ASSERT_EQUAL_64(expected, x13); | 9374 ASSERT_EQUAL_64(expected, x13); |
| 9351 | 9375 |
| 9352 TEARDOWN(); | 9376 TEARDOWN(); |
| 9353 } | 9377 } |
| 9354 | 9378 |
| 9355 | 9379 |
| 9356 static void AbsHelperW(int32_t value) { | 9380 static void AbsHelperW(int32_t value) { |
| 9357 int32_t expected; | 9381 int32_t expected; |
| 9358 | 9382 |
| 9359 SETUP(); | 9383 SETUP_HELPER(); |
| 9360 START(); | 9384 START(); |
| 9361 | 9385 |
| 9362 Label fail; | 9386 Label fail; |
| 9363 Label done; | 9387 Label done; |
| 9364 | 9388 |
| 9365 __ Mov(w0, 0); | 9389 __ Mov(w0, 0); |
| 9366 // TODO(jbramley): The cast is needed to avoid a sign-extension bug in VIXL. | 9390 // TODO(jbramley): The cast is needed to avoid a sign-extension bug in VIXL. |
| 9367 // Once it is fixed, we should remove the cast. | 9391 // Once it is fixed, we should remove the cast. |
| 9368 __ Mov(w1, static_cast<uint32_t>(value)); | 9392 __ Mov(w1, static_cast<uint32_t>(value)); |
| 9369 | 9393 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9404 ASSERT_EQUAL_32(expected, w10); | 9428 ASSERT_EQUAL_32(expected, w10); |
| 9405 ASSERT_EQUAL_32(expected, w11); | 9429 ASSERT_EQUAL_32(expected, w11); |
| 9406 ASSERT_EQUAL_32(expected, w12); | 9430 ASSERT_EQUAL_32(expected, w12); |
| 9407 ASSERT_EQUAL_32(expected, w13); | 9431 ASSERT_EQUAL_32(expected, w13); |
| 9408 | 9432 |
| 9409 TEARDOWN(); | 9433 TEARDOWN(); |
| 9410 } | 9434 } |
| 9411 | 9435 |
| 9412 | 9436 |
| 9413 TEST(abs) { | 9437 TEST(abs) { |
| 9438 CcTest::InitializeVM(); | |
| 9414 AbsHelperX(0); | 9439 AbsHelperX(0); |
| 9415 AbsHelperX(42); | 9440 AbsHelperX(42); |
| 9416 AbsHelperX(-42); | 9441 AbsHelperX(-42); |
| 9417 AbsHelperX(kXMinInt); | 9442 AbsHelperX(kXMinInt); |
| 9418 AbsHelperX(kXMaxInt); | 9443 AbsHelperX(kXMaxInt); |
| 9419 | 9444 |
| 9420 AbsHelperW(0); | 9445 AbsHelperW(0); |
| 9421 AbsHelperW(42); | 9446 AbsHelperW(42); |
| 9422 AbsHelperW(-42); | 9447 AbsHelperW(-42); |
| 9423 AbsHelperW(kWMinInt); | 9448 AbsHelperW(kWMinInt); |
| 9424 AbsHelperW(kWMaxInt); | 9449 AbsHelperW(kWMaxInt); |
| 9425 } | 9450 } |
| 9426 | 9451 |
| OLD | NEW |