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

Unified Diff: src/compiler/node-matchers.h

Issue 2347573002: [turbofan] Reduce some Float64 division to multiplication (Closed)
Patch Set: Move power of two tests to matcher Created 4 years, 3 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
Index: src/compiler/node-matchers.h
diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h
index 10aed51a578877b93ea595a275a0e0657b512729..6c283dc03218be43a59e3b0be1e820f0d046720b 100644
--- a/src/compiler/node-matchers.h
+++ b/src/compiler/node-matchers.h
@@ -11,6 +11,7 @@
#include "src/assembler.h"
#include "src/compiler/node.h"
#include "src/compiler/operator.h"
+#include "src/double.h"
namespace v8 {
namespace internal {
@@ -161,6 +162,17 @@ struct FloatMatcher final : public ValueMatcher<T, kOpcode> {
bool IsNegative() const { return this->HasValue() && this->Value() < 0.0; }
bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); }
bool IsZero() const { return this->Is(0.0) && !std::signbit(this->Value()); }
+ bool IsNormal() const {
+ return this->HasValue() && std::isnormal(this->Value());
+ }
+ bool IsPositiveOrNegativePowerOf2() const {
+ if (!this->HasValue() || (this->Value() == 0.0)) {
+ return false;
+ }
+ Double value = Double(this->Value());
+ return !value.IsInfinite() &&
+ base::bits::IsPowerOfTwo64(value.Significand());
+ }
};
typedef FloatMatcher<float, IrOpcode::kFloat32Constant> Float32Matcher;
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | test/unittests/compiler/machine-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698