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

Side by Side Diff: src/diy_fp.h

Issue 971006: Fix arm compilation. DiyFp multiplications are now in a separate procedure. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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 | « src/SConscript ('k') | src/diy_fp.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // The exponents of both numbers must be the same and this must be bigger 57 // The exponents of both numbers must be the same and this must be bigger
58 // than other. The result will not be normalized. 58 // than other. The result will not be normalized.
59 static DiyFp Minus(const DiyFp& a, const DiyFp& b) { 59 static DiyFp Minus(const DiyFp& a, const DiyFp& b) {
60 DiyFp result = a; 60 DiyFp result = a;
61 result.Subtract(b); 61 result.Subtract(b);
62 return result; 62 return result;
63 } 63 }
64 64
65 65
66 // this = this * other. 66 // this = this * other.
67 void Multiply(const DiyFp& other) { 67 void Multiply(const DiyFp& other);
68 // Simply "emulates" a 128 bit multiplication.
69 // However: the resulting number only contains 64 bits. The least
70 // significant 64 bits are only used for rounding the most significant 64
71 // bits.
72 const uint64_t kM32 = 0xFFFFFFFFu;
73 uint64_t a = f_ >> 32;
74 uint64_t b = f_ & kM32;
75 uint64_t c = other.f_ >> 32;
76 uint64_t d = other.f_ & kM32;
77 uint64_t ac = a * c;
78 uint64_t bc = b * c;
79 uint64_t ad = a * d;
80 uint64_t bd = b * d;
81 uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32);
82 tmp += 1U << 31; // round
83 uint64_t result_f = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32);
84 e_ += other.e_ + 64;
85 f_ = result_f;
86 }
87 68
88 // returns a * b; 69 // returns a * b;
89 static DiyFp Times(const DiyFp& a, const DiyFp& b) { 70 static DiyFp Times(const DiyFp& a, const DiyFp& b) {
90 DiyFp result = a; 71 DiyFp result = a;
91 result.Multiply(b); 72 result.Multiply(b);
92 return result; 73 return result;
93 } 74 }
94 75
95 void Normalize() { 76 void Normalize() {
96 ASSERT(f_ != 0); 77 ASSERT(f_ != 0);
(...skipping 30 matching lines...) Expand all
127 private: 108 private:
128 static const uint64_t kUint64MSB = V8_2PART_UINT64_C(0x80000000, 00000000); 109 static const uint64_t kUint64MSB = V8_2PART_UINT64_C(0x80000000, 00000000);
129 110
130 uint64_t f_; 111 uint64_t f_;
131 int e_; 112 int e_;
132 }; 113 };
133 114
134 } } // namespace v8::internal 115 } } // namespace v8::internal
135 116
136 #endif // V8_DIY_FP_H_ 117 #endif // V8_DIY_FP_H_
OLDNEW
« no previous file with comments | « src/SConscript ('k') | src/diy_fp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698