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

Side by Side Diff: src/compiler/machine-operator.h

Issue 1044793002: [turbofan] Add backend support for float32 operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add MachineOperator unit tests. Created 5 years, 8 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_ 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_
6 #define V8_COMPILER_MACHINE_OPERATOR_H_ 6 #define V8_COMPILER_MACHINE_OPERATOR_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/compiler/machine-type.h" 9 #include "src/compiler/machine-type.h"
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 // Interface for building machine-level operators. These operators are 68 // Interface for building machine-level operators. These operators are
69 // machine-level but machine-independent and thus define a language suitable 69 // machine-level but machine-independent and thus define a language suitable
70 // for generating code to run on architectures such as ia32, x64, arm, etc. 70 // for generating code to run on architectures such as ia32, x64, arm, etc.
71 class MachineOperatorBuilder FINAL : public ZoneObject { 71 class MachineOperatorBuilder FINAL : public ZoneObject {
72 public: 72 public:
73 // Flags that specify which operations are available. This is useful 73 // Flags that specify which operations are available. This is useful
74 // for operations that are unsupported by some back-ends. 74 // for operations that are unsupported by some back-ends.
75 enum Flag { 75 enum Flag {
76 kNoFlags = 0u, 76 kNoFlags = 0u,
77 kFloat64Max = 1u << 0, 77 kFloat32Max = 1u << 0,
78 kFloat64Min = 1u << 1, 78 kFloat32Min = 1u << 1,
79 kFloat64RoundDown = 1u << 2, 79 kFloat64Max = 1u << 2,
80 kFloat64RoundTruncate = 1u << 3, 80 kFloat64Min = 1u << 3,
81 kFloat64RoundTiesAway = 1u << 4, 81 kFloat64RoundDown = 1u << 4,
82 kInt32DivIsSafe = 1u << 5, 82 kFloat64RoundTruncate = 1u << 5,
83 kUint32DivIsSafe = 1u << 6, 83 kFloat64RoundTiesAway = 1u << 6,
84 kWord32ShiftIsSafe = 1u << 7 84 kInt32DivIsSafe = 1u << 7,
85 kUint32DivIsSafe = 1u << 8,
86 kWord32ShiftIsSafe = 1u << 9
85 }; 87 };
86 typedef base::Flags<Flag, unsigned> Flags; 88 typedef base::Flags<Flag, unsigned> Flags;
87 89
88 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, 90 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr,
89 Flags supportedOperators = kNoFlags); 91 Flags supportedOperators = kNoFlags);
90 92
91 const Operator* Word32And(); 93 const Operator* Word32And();
92 const Operator* Word32Or(); 94 const Operator* Word32Or();
93 const Operator* Word32Xor(); 95 const Operator* Word32Xor();
94 const Operator* Word32Shl(); 96 const Operator* Word32Shl();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 const Operator* ChangeInt32ToInt64(); 151 const Operator* ChangeInt32ToInt64();
150 const Operator* ChangeUint32ToFloat64(); 152 const Operator* ChangeUint32ToFloat64();
151 const Operator* ChangeUint32ToUint64(); 153 const Operator* ChangeUint32ToUint64();
152 154
153 // These operators truncate numbers, both changing the representation of 155 // These operators truncate numbers, both changing the representation of
154 // the number and mapping multiple input values onto the same output value. 156 // the number and mapping multiple input values onto the same output value.
155 const Operator* TruncateFloat64ToFloat32(); 157 const Operator* TruncateFloat64ToFloat32();
156 const Operator* TruncateFloat64ToInt32(); // JavaScript semantics. 158 const Operator* TruncateFloat64ToInt32(); // JavaScript semantics.
157 const Operator* TruncateInt64ToInt32(); 159 const Operator* TruncateInt64ToInt32();
158 160
159 // Floating point operators always operate with IEEE 754 round-to-nearest. 161 // Floating point operators always operate with IEEE 754 round-to-nearest
162 // (single-precision).
163 const Operator* Float32Add();
164 const Operator* Float32Sub();
165 const Operator* Float32Mul();
166 const Operator* Float32Div();
167 const Operator* Float32Sqrt();
168
169 // Floating point operators always operate with IEEE 754 round-to-nearest
170 // (double-precision).
160 const Operator* Float64Add(); 171 const Operator* Float64Add();
161 const Operator* Float64Sub(); 172 const Operator* Float64Sub();
162 const Operator* Float64Mul(); 173 const Operator* Float64Mul();
163 const Operator* Float64Div(); 174 const Operator* Float64Div();
164 const Operator* Float64Mod(); 175 const Operator* Float64Mod();
165 const Operator* Float64Sqrt(); 176 const Operator* Float64Sqrt();
166 177
167 // Floating point comparisons complying to IEEE 754. 178 // Floating point comparisons complying to IEEE 754 (single-precision).
179 const Operator* Float32Equal();
180 const Operator* Float32LessThan();
181 const Operator* Float32LessThanOrEqual();
182
183 // Floating point comparisons complying to IEEE 754 (double-precision).
168 const Operator* Float64Equal(); 184 const Operator* Float64Equal();
169 const Operator* Float64LessThan(); 185 const Operator* Float64LessThan();
170 const Operator* Float64LessThanOrEqual(); 186 const Operator* Float64LessThanOrEqual();
171 187
172 // Floating point min/max complying to IEEE 754. 188 // Floating point min/max complying to IEEE 754 (single-precision).
189 const Operator* Float32Max();
190 const Operator* Float32Min();
191 bool HasFloat32Max() { return flags_ & kFloat32Max; }
192 bool HasFloat32Min() { return flags_ & kFloat32Min; }
193
194 // Floating point min/max complying to IEEE 754 (double-precision).
173 const Operator* Float64Max(); 195 const Operator* Float64Max();
174 const Operator* Float64Min(); 196 const Operator* Float64Min();
175 bool HasFloat64Max() { return flags_ & kFloat64Max; } 197 bool HasFloat64Max() { return flags_ & kFloat64Max; }
176 bool HasFloat64Min() { return flags_ & kFloat64Min; } 198 bool HasFloat64Min() { return flags_ & kFloat64Min; }
177 199
178 // Floating point rounding. 200 // Floating point rounding.
179 const Operator* Float64RoundDown(); 201 const Operator* Float64RoundDown();
180 const Operator* Float64RoundTruncate(); 202 const Operator* Float64RoundTruncate();
181 const Operator* Float64RoundTiesAway(); 203 const Operator* Float64RoundTiesAway();
182 bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; } 204 bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 }; 269 };
248 270
249 271
250 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) 272 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags)
251 273
252 } // namespace compiler 274 } // namespace compiler
253 } // namespace internal 275 } // namespace internal
254 } // namespace v8 276 } // namespace v8
255 277
256 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ 278 #endif // V8_COMPILER_MACHINE_OPERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698