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

Unified Diff: src/compiler/machine-operator.h

Issue 668173002: Add Float64Round operator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add unittest. Created 6 years, 2 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/compiler/instruction-selector.h ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/machine-operator.h
diff --git a/src/compiler/machine-operator.h b/src/compiler/machine-operator.h
index 568d3eb2b89acc163584aea605375772ccfed1f0..19514460792c6017f007efcfd9b8a431788db741 100644
--- a/src/compiler/machine-operator.h
+++ b/src/compiler/machine-operator.h
@@ -5,6 +5,7 @@
#ifndef V8_COMPILER_MACHINE_OPERATOR_H_
#define V8_COMPILER_MACHINE_OPERATOR_H_
+#include "src/base/flags.h"
#include "src/compiler/machine-type.h"
namespace v8 {
@@ -57,7 +58,19 @@ StoreRepresentation const& StoreRepresentationOf(Operator const*);
// for generating code to run on architectures such as ia32, x64, arm, etc.
class MachineOperatorBuilder FINAL {
public:
- explicit MachineOperatorBuilder(MachineType word = kMachPtr);
+ // Flags that specify which operations are available. This is useful
+ // for operations that are unsupported by some back-ends.
+ enum class Flag : unsigned {
+ kNoFlags = 0,
+ kFloat64Floor = 1 << 0,
+ kFloat64Ceil = 1 << 1,
+ kFloat64RoundTruncate = 1 << 2,
+ kFloat64RoundTiesAway = 1 << 3
+ };
+ typedef base::Flags<Flag, unsigned> Flags;
+
+ explicit MachineOperatorBuilder(MachineType word = kMachPtr,
+ Flags supportedOperators = Flag::kNoFlags);
const Operator* Word32And();
const Operator* Word32Or();
@@ -135,6 +148,20 @@ class MachineOperatorBuilder FINAL {
const Operator* Float64LessThan();
const Operator* Float64LessThanOrEqual();
+ // Floating point rounding.
+ const Operator* Float64Floor();
+ const Operator* Float64Ceil();
+ const Operator* Float64RoundTruncate();
+ const Operator* Float64RoundTiesAway();
+ bool HasFloat64Floor() { return flags_ & Flag::kFloat64Floor; }
+ bool HasFloat64Ceil() { return flags_ & Flag::kFloat64Ceil; }
+ bool HasFloat64RoundTruncate() {
+ return flags_ & Flag::kFloat64RoundTruncate;
+ }
+ bool HasFloat64RoundTiesAway() {
+ return flags_ & Flag::kFloat64RoundTiesAway;
+ }
+
// load [base + index]
const Operator* Load(LoadRepresentation rep);
@@ -181,8 +208,11 @@ class MachineOperatorBuilder FINAL {
private:
const MachineOperatorBuilderImpl& impl_;
const MachineType word_;
+ const Flags flags_;
};
+
+DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags)
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698