5 #ifndef V8_COMPILER_SIMD_SCALAR_LOWERING_H_ 6 #define V8_COMPILER_SIMD_SCALAR_LOWERING_H_ 8 #include "src/compiler/common-operator.h" 9 #include "src/compiler/graph.h" 10 #include "src/compiler/machine-graph.h" 11 #include "src/compiler/machine-operator.h" 12 #include "src/compiler/node-marker.h" 13 #include "src/zone/zone-containers.h" 30 int GetParameterCountAfterLowering();
33 enum class State : uint8_t { kUnvisited, kOnStack, kVisited };
35 enum class SimdType : uint8_t { kFloat32x4, kInt32x4, kInt16x8, kInt8x16 };
37 #if defined(V8_TARGET_BIG_ENDIAN) 38 static constexpr
int kLaneOffsets[16] = {15, 14, 13, 12, 11, 10, 9, 8,
39 7, 6, 5, 4, 3, 2, 1, 0};
41 static constexpr
int kLaneOffsets[16] = {0, 1, 2, 3, 4, 5, 6, 7,
42 8, 9, 10, 11, 12, 13, 14, 15};
45 Node** node =
nullptr;
47 int num_replacements = 0;
55 Zone* zone()
const {
return mcgraph_->zone(); }
56 Graph* graph()
const {
return mcgraph_->graph(); }
61 void LowerNode(
Node* node);
62 bool DefaultLowering(
Node* node);
64 int NumLanes(SimdType
type);
65 void ReplaceNode(
Node* old,
Node** new_nodes,
int count);
66 bool HasReplacement(
size_t index,
Node* node);
68 int ReplacementCount(
Node* node);
69 void Float32ToInt32(
Node** replacements,
Node** result);
70 void Int32ToFloat32(
Node** replacements,
Node** result);
72 void Int32ToSmallerInt(
Node** replacements,
Node** result);
74 void SmallerIntToInt32(
Node** replacements,
Node** result);
75 Node** GetReplacementsWithType(
Node* node, SimdType
type);
76 SimdType ReplacementType(
Node* node);
77 void PreparePhiReplacement(
Node* phi);
78 void SetLoweredType(
Node* node,
Node* output);
79 void GetIndexNodes(
Node* index,
Node** new_indices, SimdType
type);
80 void LowerLoadOp(
Node* node, SimdType
type);
81 void LowerStoreOp(
Node* node);
82 void LowerBinaryOp(
Node* node, SimdType input_rep_type,
const Operator* op,
83 bool not_horizontal =
true);
84 void LowerCompareOp(
Node* node, SimdType input_rep_type,
const Operator* op,
85 bool invert_inputs =
false);
86 Node* FixUpperBits(
Node* input, int32_t shift);
87 void LowerBinaryOpForSmallInt(
Node* node, SimdType input_rep_type,
88 const Operator* op,
bool not_horizontal =
true);
89 Node* Mask(
Node* input, int32_t mask);
90 void LowerSaturateBinaryOp(
Node* node, SimdType input_rep_type,
92 void LowerUnaryOp(
Node* node, SimdType input_rep_type,
const Operator* op);
93 void LowerIntMinMax(
Node* node,
const Operator* op,
bool is_max,
95 void LowerConvertFromFloat(
Node* node,
bool is_signed);
96 void LowerConvertFromInt(
Node* node, SimdType input_rep_type,
97 SimdType output_rep_type,
bool is_signed,
99 void LowerPack(
Node* node, SimdType input_rep_type, SimdType output_rep_type,
101 void LowerShiftOp(
Node* node, SimdType
type);
103 void LowerNotEqual(
Node* node, SimdType input_rep_type,
const Operator* op);
109 Replacement* replacements_;
112 int parameter_count_after_lowering_;
119 #endif // V8_COMPILER_SIMD_SCALAR_LOWERING_H_