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

Unified Diff: src/a64/utils-a64.h

Issue 199083005: A64: Fix a few simulation inaccuracies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/a64/simulator-a64.cc ('k') | test/cctest/test-assembler-a64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/a64/utils-a64.h
diff --git a/src/a64/utils-a64.h b/src/a64/utils-a64.h
index 16c51a9c8b52770b44d09fe738adc1cc34dbd80c..c14ea95f97b757c146b809d45ae5152357fbfb59 100644
--- a/src/a64/utils-a64.h
+++ b/src/a64/utils-a64.h
@@ -70,7 +70,7 @@ static inline double rawbits_to_double(uint64_t bits) {
}
-// Bits counting.
+// Bit counting.
int CountLeadingZeros(uint64_t value, int width);
int CountLeadingSignBits(int64_t value, int width);
int CountTrailingZeros(uint64_t value, int width);
@@ -80,9 +80,8 @@ int MaskToBit(uint64_t mask);
// NaN tests.
inline bool IsSignallingNaN(double num) {
- const uint64_t kFP64QuietNaNMask = 0x0008000000000000UL;
uint64_t raw = double_to_rawbits(num);
- if (std::isnan(num) && ((raw & kFP64QuietNaNMask) == 0)) {
+ if (std::isnan(num) && ((raw & kDQuietNanMask) == 0)) {
return true;
}
return false;
@@ -90,9 +89,8 @@ inline bool IsSignallingNaN(double num) {
inline bool IsSignallingNaN(float num) {
- const uint64_t kFP32QuietNaNMask = 0x00400000UL;
uint32_t raw = float_to_rawbits(num);
- if (std::isnan(num) && ((raw & kFP32QuietNaNMask) == 0)) {
+ if (std::isnan(num) && ((raw & kSQuietNanMask) == 0)) {
return true;
}
return false;
@@ -104,6 +102,30 @@ inline bool IsQuietNaN(T num) {
return std::isnan(num) && !IsSignallingNaN(num);
}
+
+// Convert the NaN in 'num' to a quiet NaN.
+inline double ToQuietNaN(double num) {
+ ASSERT(isnan(num));
+ return rawbits_to_double(double_to_rawbits(num) | kDQuietNanMask);
+}
+
+
+inline float ToQuietNaN(float num) {
+ ASSERT(isnan(num));
+ return rawbits_to_float(float_to_rawbits(num) | kSQuietNanMask);
+}
+
+
+// Fused multiply-add.
+inline double FusedMultiplyAdd(double op1, double op2, double a) {
+ return fma(op1, op2, a);
+}
+
+
+inline float FusedMultiplyAdd(float op1, float op2, float a) {
+ return fmaf(op1, op2, a);
+}
+
} } // namespace v8::internal
#endif // V8_A64_UTILS_A64_H_
« no previous file with comments | « src/a64/simulator-a64.cc ('k') | test/cctest/test-assembler-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698