| OLD | NEW | 
|---|
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_SIMD_SCALAR_LOWERING_H_ | 5 #ifndef V8_COMPILER_SIMD_SCALAR_LOWERING_H_ | 
| 6 #define V8_COMPILER_SIMD_SCALAR_LOWERING_H_ | 6 #define V8_COMPILER_SIMD_SCALAR_LOWERING_H_ | 
| 7 | 7 | 
| 8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" | 
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" | 
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 21   SimdScalarLowering(JSGraph* jsgraph, | 21   SimdScalarLowering(JSGraph* jsgraph, | 
| 22                      Signature<MachineRepresentation>* signature); | 22                      Signature<MachineRepresentation>* signature); | 
| 23 | 23 | 
| 24   void LowerGraph(); | 24   void LowerGraph(); | 
| 25 | 25 | 
| 26   int GetParameterCountAfterLowering(); | 26   int GetParameterCountAfterLowering(); | 
| 27 | 27 | 
| 28  private: | 28  private: | 
| 29   enum class State : uint8_t { kUnvisited, kOnStack, kVisited }; | 29   enum class State : uint8_t { kUnvisited, kOnStack, kVisited }; | 
| 30 | 30 | 
| 31   enum class SimdType : uint8_t { kInt32, kFloat32, kSimd1x4 }; | 31   enum class SimdType : uint8_t { | 
| 32 | 32     kFloat32x4, | 
| 33   static const int kMaxLanes = 4; | 33     kInt32x4, | 
| 34   static const int kLaneWidth = 16 / kMaxLanes; | 34     kInt16x8, | 
|  | 35     kSimd1x4, | 
|  | 36     kSimd1x8 | 
|  | 37   }; | 
| 35 | 38 | 
| 36   struct Replacement { | 39   struct Replacement { | 
| 37     Node* node[kMaxLanes]; | 40     Node** node = nullptr; | 
| 38     SimdType type;  // represents what input type is expected | 41     SimdType type;  // represents output type | 
|  | 42     int num_replacements = 0; | 
| 39   }; | 43   }; | 
| 40 | 44 | 
| 41   struct NodeState { | 45   struct NodeState { | 
| 42     Node* node; | 46     Node* node; | 
| 43     int input_index; | 47     int input_index; | 
| 44   }; | 48   }; | 
| 45 | 49 | 
| 46   Zone* zone() const { return jsgraph_->zone(); } | 50   Zone* zone() const { return jsgraph_->zone(); } | 
| 47   Graph* graph() const { return jsgraph_->graph(); } | 51   Graph* graph() const { return jsgraph_->graph(); } | 
| 48   MachineOperatorBuilder* machine() const { return jsgraph_->machine(); } | 52   MachineOperatorBuilder* machine() const { return jsgraph_->machine(); } | 
| 49   CommonOperatorBuilder* common() const { return jsgraph_->common(); } | 53   CommonOperatorBuilder* common() const { return jsgraph_->common(); } | 
| 50   Signature<MachineRepresentation>* signature() const { return signature_; } | 54   Signature<MachineRepresentation>* signature() const { return signature_; } | 
| 51 | 55 | 
| 52   void LowerNode(Node* node); | 56   void LowerNode(Node* node); | 
| 53   bool DefaultLowering(Node* node); | 57   bool DefaultLowering(Node* node); | 
| 54 | 58 | 
| 55   void ReplaceNode(Node* old, Node** new_nodes); | 59   int NumLanes(SimdType type); | 
|  | 60   void ReplaceNode(Node* old, Node** new_nodes, int count); | 
| 56   bool HasReplacement(size_t index, Node* node); | 61   bool HasReplacement(size_t index, Node* node); | 
| 57   Node** GetReplacements(Node* node); | 62   Node** GetReplacements(Node* node); | 
|  | 63   int ReplacementCount(Node* node); | 
|  | 64   void Float32ToInt32(Node** replacements, Node** result); | 
|  | 65   void Int32ToFloat32(Node** replacements, Node** result); | 
| 58   Node** GetReplacementsWithType(Node* node, SimdType type); | 66   Node** GetReplacementsWithType(Node* node, SimdType type); | 
| 59   SimdType ReplacementType(Node* node); | 67   SimdType ReplacementType(Node* node); | 
| 60   void PreparePhiReplacement(Node* phi); | 68   void PreparePhiReplacement(Node* phi); | 
| 61   void SetLoweredType(Node* node, Node* output); | 69   void SetLoweredType(Node* node, Node* output); | 
| 62   void GetIndexNodes(Node* index, Node** new_indices); | 70   void GetIndexNodes(Node* index, Node** new_indices, SimdType type); | 
| 63   void LowerLoadOp(MachineRepresentation rep, Node* node, | 71   void LowerLoadOp(MachineRepresentation rep, Node* node, | 
| 64                    const Operator* load_op); | 72                    const Operator* load_op, SimdType type); | 
| 65   void LowerStoreOp(MachineRepresentation rep, Node* node, | 73   void LowerStoreOp(MachineRepresentation rep, Node* node, | 
| 66                     const Operator* store_op, SimdType rep_type); | 74                     const Operator* store_op, SimdType rep_type); | 
| 67   void LowerBinaryOp(Node* node, SimdType input_rep_type, const Operator* op, | 75   void LowerBinaryOp(Node* node, SimdType input_rep_type, const Operator* op, | 
| 68                      bool invert_inputs = false); | 76                      bool invert_inputs = false); | 
|  | 77   Node* FixUpperBits(Node* input, int32_t shift); | 
|  | 78   void LowerBinaryOpForSmallInt(Node* node, SimdType input_rep_type, | 
|  | 79                                 const Operator* op); | 
|  | 80   Node* Mask(Node* input, int32_t mask); | 
|  | 81   void LowerSaturateBinaryOp(Node* node, SimdType input_rep_type, | 
|  | 82                              const Operator* op, bool is_signed); | 
| 69   void LowerUnaryOp(Node* node, SimdType input_rep_type, const Operator* op); | 83   void LowerUnaryOp(Node* node, SimdType input_rep_type, const Operator* op); | 
| 70   void LowerIntMinMax(Node* node, const Operator* op, bool is_max); | 84   void LowerIntMinMax(Node* node, const Operator* op, bool is_max, | 
|  | 85                       SimdType type); | 
| 71   void LowerConvertFromFloat(Node* node, bool is_signed); | 86   void LowerConvertFromFloat(Node* node, bool is_signed); | 
| 72   void LowerShiftOp(Node* node, const Operator* op); | 87   void LowerShiftOp(Node* node, SimdType type); | 
| 73   Node* BuildF64Trunc(Node* input); | 88   Node* BuildF64Trunc(Node* input); | 
| 74   void LowerNotEqual(Node* node, SimdType input_rep_type, const Operator* op); | 89   void LowerNotEqual(Node* node, SimdType input_rep_type, const Operator* op); | 
| 75 | 90 | 
| 76   JSGraph* const jsgraph_; | 91   JSGraph* const jsgraph_; | 
| 77   NodeMarker<State> state_; | 92   NodeMarker<State> state_; | 
| 78   ZoneDeque<NodeState> stack_; | 93   ZoneDeque<NodeState> stack_; | 
| 79   Replacement* replacements_; | 94   Replacement* replacements_; | 
| 80   Signature<MachineRepresentation>* signature_; | 95   Signature<MachineRepresentation>* signature_; | 
| 81   Node* placeholder_; | 96   Node* placeholder_; | 
| 82   int parameter_count_after_lowering_; | 97   int parameter_count_after_lowering_; | 
| 83 }; | 98 }; | 
| 84 | 99 | 
| 85 }  // namespace compiler | 100 }  // namespace compiler | 
| 86 }  // namespace internal | 101 }  // namespace internal | 
| 87 }  // namespace v8 | 102 }  // namespace v8 | 
| 88 | 103 | 
| 89 #endif  // V8_COMPILER_SIMD_SCALAR_LOWERING_H_ | 104 #endif  // V8_COMPILER_SIMD_SCALAR_LOWERING_H_ | 
| OLD | NEW | 
|---|