Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: dart/runtime/vm/assembler_arm_test.cc

Issue 119673004: Version 1.1.0-dev.5.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/runtime/vm/allocation_test.cc ('k') | dart/runtime/vm/assembler_x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 3102 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 ASSEMBLER_TEST_RUN(Vmaxqs, test) { 3113 ASSEMBLER_TEST_RUN(Vmaxqs, test) {
3114 EXPECT(test != NULL); 3114 EXPECT(test != NULL);
3115 typedef int (*Tst)(); 3115 typedef int (*Tst)();
3116 EXPECT_EQ(14, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); 3116 EXPECT_EQ(14, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
3117 } 3117 }
3118 3118
3119 3119
3120 // This is the same function as in the Simulator. 3120 // This is the same function as in the Simulator.
3121 static float arm_recip_estimate(float a) { 3121 static float arm_recip_estimate(float a) {
3122 // From the ARM Architecture Reference Manual A2-85. 3122 // From the ARM Architecture Reference Manual A2-85.
3123 if (isinf(a) || (abs(a) >= exp2f(126))) return 0.0; 3123 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0;
3124 else if (a == 0.0) return INFINITY; 3124 else if (a == 0.0) return INFINITY;
3125 else if (isnan(a)) return a; 3125 else if (isnan(a)) return a;
3126 3126
3127 uint32_t a_bits = bit_cast<uint32_t, float>(a); 3127 uint32_t a_bits = bit_cast<uint32_t, float>(a);
3128 // scaled = '0011 1111 1110' : a<22:0> : Zeros(29) 3128 // scaled = '0011 1111 1110' : a<22:0> : Zeros(29)
3129 uint64_t scaled = (static_cast<uint64_t>(0x3fe) << 52) | 3129 uint64_t scaled = (static_cast<uint64_t>(0x3fe) << 52) |
3130 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29); 3130 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29);
3131 // result_exp = 253 - UInt(a<30:23>) 3131 // result_exp = 253 - UInt(a<30:23>)
3132 int32_t result_exp = 253 - ((a_bits >> 23) & 0xff); 3132 int32_t result_exp = 253 - ((a_bits >> 23) & 0xff);
3133 ASSERT((result_exp >= 1) && (result_exp <= 252)); 3133 ASSERT((result_exp >= 1) && (result_exp <= 252));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3233 ASSEMBLER_TEST_RUN(Reciprocal, test) { 3233 ASSEMBLER_TEST_RUN(Reciprocal, test) {
3234 EXPECT(test != NULL); 3234 EXPECT(test != NULL);
3235 typedef float (*Reciprocal)(); 3235 typedef float (*Reciprocal)();
3236 float res = EXECUTE_TEST_CODE_FLOAT(Reciprocal, test->entry()); 3236 float res = EXECUTE_TEST_CODE_FLOAT(Reciprocal, test->entry());
3237 EXPECT_FLOAT_EQ(1.0/147000.0, res, 0.0001f); 3237 EXPECT_FLOAT_EQ(1.0/147000.0, res, 0.0001f);
3238 } 3238 }
3239 3239
3240 3240
3241 static float arm_reciprocal_sqrt_estimate(float a) { 3241 static float arm_reciprocal_sqrt_estimate(float a) {
3242 // From the ARM Architecture Reference Manual A2-87. 3242 // From the ARM Architecture Reference Manual A2-87.
3243 if (isinf(a) || (abs(a) >= exp2f(126))) return 0.0; 3243 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0;
3244 else if (a == 0.0) return INFINITY; 3244 else if (a == 0.0) return INFINITY;
3245 else if (isnan(a)) return a; 3245 else if (isnan(a)) return a;
3246 3246
3247 uint32_t a_bits = bit_cast<uint32_t, float>(a); 3247 uint32_t a_bits = bit_cast<uint32_t, float>(a);
3248 uint64_t scaled; 3248 uint64_t scaled;
3249 if (((a_bits >> 23) & 1) != 0) { 3249 if (((a_bits >> 23) & 1) != 0) {
3250 // scaled = '0 01111111101' : operand<22:0> : Zeros(29) 3250 // scaled = '0 01111111101' : operand<22:0> : Zeros(29)
3251 scaled = (static_cast<uint64_t>(0x3fd) << 52) | 3251 scaled = (static_cast<uint64_t>(0x3fd) << 52) |
3252 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29); 3252 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29);
3253 } else { 3253 } else {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
3583 __ StoreIntoObject(R2, 3583 __ StoreIntoObject(R2,
3584 FieldAddress(R2, GrowableObjectArray::data_offset()), 3584 FieldAddress(R2, GrowableObjectArray::data_offset()),
3585 R1); 3585 R1);
3586 __ PopList((1 << CTX) | (1 << LR)); 3586 __ PopList((1 << CTX) | (1 << LR));
3587 __ Ret(); 3587 __ Ret();
3588 } 3588 }
3589 3589
3590 } // namespace dart 3590 } // namespace dart
3591 3591
3592 #endif // defined TARGET_ARCH_ARM 3592 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « dart/runtime/vm/allocation_test.cc ('k') | dart/runtime/vm/assembler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698