OLD | NEW |
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Flags that specify which operations are available. This is useful | 109 // Flags that specify which operations are available. This is useful |
110 // for operations that are unsupported by some back-ends. | 110 // for operations that are unsupported by some back-ends. |
111 enum Flag { | 111 enum Flag { |
112 kNoFlags = 0u, | 112 kNoFlags = 0u, |
113 // Note that Float*Max behaves like `(b < a) ? a : b`, not like Math.max(). | 113 // Note that Float*Max behaves like `(b < a) ? a : b`, not like Math.max(). |
114 // Note that Float*Min behaves like `(a < b) ? a : b`, not like Math.min(). | 114 // Note that Float*Min behaves like `(a < b) ? a : b`, not like Math.min(). |
115 kFloat32Max = 1u << 0, | 115 kFloat32Max = 1u << 0, |
116 kFloat32Min = 1u << 1, | 116 kFloat32Min = 1u << 1, |
117 kFloat64Max = 1u << 2, | 117 kFloat64Max = 1u << 2, |
118 kFloat64Min = 1u << 3, | 118 kFloat64Min = 1u << 3, |
119 kFloat64RoundDown = 1u << 4, | 119 kFloat32RoundDown = 1u << 4, |
120 kFloat64RoundUp = 1u << 5, | 120 kFloat64RoundDown = 1u << 5, |
121 kFloat64RoundTruncate = 1u << 6, | 121 kFloat64RoundUp = 1u << 6, |
122 kFloat64RoundTiesEven = 1u << 7, | 122 kFloat64RoundTruncate = 1u << 7, |
123 kFloat64RoundTiesAway = 1u << 8, | 123 kFloat64RoundTiesEven = 1u << 8, |
124 kInt32DivIsSafe = 1u << 9, | 124 kFloat64RoundTiesAway = 1u << 9, |
125 kUint32DivIsSafe = 1u << 10, | 125 kInt32DivIsSafe = 1u << 10, |
126 kWord32ShiftIsSafe = 1u << 11, | 126 kUint32DivIsSafe = 1u << 11, |
127 kWord32Ctz = 1u << 12, | 127 kWord32ShiftIsSafe = 1u << 12, |
128 kWord64Ctz = 1u << 13, | 128 kWord32Ctz = 1u << 13, |
129 kWord32Popcnt = 1u << 14, | 129 kWord64Ctz = 1u << 14, |
130 kWord64Popcnt = 1u << 15, | 130 kWord32Popcnt = 1u << 15, |
| 131 kWord64Popcnt = 1u << 16, |
131 kAllOptionalOps = kFloat32Max | kFloat32Min | kFloat64Max | kFloat64Min | | 132 kAllOptionalOps = kFloat32Max | kFloat32Min | kFloat64Max | kFloat64Min | |
132 kFloat64RoundDown | kFloat64RoundUp | | 133 kFloat64RoundDown | kFloat64RoundUp | |
133 kFloat64RoundTruncate | kFloat64RoundTiesAway | | 134 kFloat64RoundTruncate | kFloat64RoundTiesAway | |
134 kFloat64RoundTiesEven | kWord32Ctz | kWord64Ctz | | 135 kFloat64RoundTiesEven | kWord32Ctz | kWord64Ctz | |
135 kWord32Popcnt | kWord64Popcnt | 136 kWord32Popcnt | kWord64Popcnt | kFloat32RoundDown |
136 }; | 137 }; |
137 typedef base::Flags<Flag, unsigned> Flags; | 138 typedef base::Flags<Flag, unsigned> Flags; |
138 | 139 |
139 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, | 140 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, |
140 Flags supportedOperators = kNoFlags); | 141 Flags supportedOperators = kNoFlags); |
141 | 142 |
142 const Operator* Word32And(); | 143 const Operator* Word32And(); |
143 const Operator* Word32Or(); | 144 const Operator* Word32Or(); |
144 const Operator* Word32Xor(); | 145 const Operator* Word32Xor(); |
145 const Operator* Word32Shl(); | 146 const Operator* Word32Shl(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 const OptionalOperator Float64Max(); | 262 const OptionalOperator Float64Max(); |
262 const OptionalOperator Float64Min(); | 263 const OptionalOperator Float64Min(); |
263 | 264 |
264 // Floating point abs complying to IEEE 754 (single-precision). | 265 // Floating point abs complying to IEEE 754 (single-precision). |
265 const Operator* Float32Abs(); | 266 const Operator* Float32Abs(); |
266 | 267 |
267 // Floating point abs complying to IEEE 754 (double-precision). | 268 // Floating point abs complying to IEEE 754 (double-precision). |
268 const Operator* Float64Abs(); | 269 const Operator* Float64Abs(); |
269 | 270 |
270 // Floating point rounding. | 271 // Floating point rounding. |
| 272 const OptionalOperator Float32RoundDown(); |
271 const OptionalOperator Float64RoundDown(); | 273 const OptionalOperator Float64RoundDown(); |
272 const OptionalOperator Float64RoundUp(); | 274 const OptionalOperator Float64RoundUp(); |
273 const OptionalOperator Float64RoundTruncate(); | 275 const OptionalOperator Float64RoundTruncate(); |
274 const OptionalOperator Float64RoundTiesAway(); | 276 const OptionalOperator Float64RoundTiesAway(); |
275 const OptionalOperator Float64RoundTiesEven(); | 277 const OptionalOperator Float64RoundTiesEven(); |
276 | 278 |
277 // Floating point bit representation. | 279 // Floating point bit representation. |
278 const Operator* Float64ExtractLowWord32(); | 280 const Operator* Float64ExtractLowWord32(); |
279 const Operator* Float64ExtractHighWord32(); | 281 const Operator* Float64ExtractHighWord32(); |
280 const Operator* Float64InsertLowWord32(); | 282 const Operator* Float64InsertLowWord32(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 }; | 340 }; |
339 | 341 |
340 | 342 |
341 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 343 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
342 | 344 |
343 } // namespace compiler | 345 } // namespace compiler |
344 } // namespace internal | 346 } // namespace internal |
345 } // namespace v8 | 347 } // namespace v8 |
346 | 348 |
347 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 349 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |