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

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: Introduce several machine ops instead of round + mode param. 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
Index: src/compiler/machine-operator.h
diff --git a/src/compiler/machine-operator.h b/src/compiler/machine-operator.h
index 568d3eb2b89acc163584aea605375772ccfed1f0..76289c417940237de7a58b36fd4700fc08ee6eef 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 {
@@ -51,13 +52,25 @@ std::ostream& operator<<(std::ostream&, StoreRepresentation);
StoreRepresentation const& StoreRepresentationOf(Operator const*);
+enum SupportedOperator {
Benedikt Meurer 2014/10/23 07:11:14 I'd not name it SupportedOperator, but rather move
sigurds 2014/10/23 10:37:56 Done.
+ kNoSupportedOperators = 0,
+ kSupportsFloat64Floor = 1 << 0,
+ kSupportsFloat64Ceil = 1 << 1,
+ kSupportsFloat64RoundTiesAway = 1 << 2,
+ kSupportsFloat64RoundTiesTowards = 1 << 3
+};
+
+typedef base::Flags<SupportedOperator, uint8_t> SupportedOperators;
+DEFINE_OPERATORS_FOR_FLAGS(SupportedOperators)
// Interface for building machine-level operators. These operators are
// machine-level but machine-independent and thus define a language suitable
// for generating code to run on architectures such as ia32, x64, arm, etc.
class MachineOperatorBuilder FINAL {
public:
- explicit MachineOperatorBuilder(MachineType word = kMachPtr);
+ explicit MachineOperatorBuilder(
+ MachineType word = kMachPtr,
+ SupportedOperators supportedOperators = kNoSupportedOperators);
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* Float64RoundAwayFromZero();
+ const Operator* Float64RoundToZero();
+ bool HasFloat64Floor() { return supportedOperators_ & kSupportsFloat64Floor; }
+ bool HasFloat64Ceil() { return supportedOperators_ & kSupportsFloat64Ceil; }
+ bool HasFloat64RoundAwayFromZero() {
+ return supportedOperators_ & kSupportsFloat64RoundTiesAway;
+ }
+ bool HasFloat64RoundToZero() {
+ return supportedOperators_ & kSupportsFloat64RoundTiesTowards;
+ }
+
// load [base + index]
const Operator* Load(LoadRepresentation rep);
@@ -181,6 +208,7 @@ class MachineOperatorBuilder FINAL {
private:
const MachineOperatorBuilderImpl& impl_;
const MachineType word_;
+ const SupportedOperators supportedOperators_;
};
} // namespace compiler

Powered by Google App Engine
This is Rietveld 408576698