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

Side by Side Diff: src/compiler/simd-scalar-lowering.h

Issue 2843523002: [wasm] Implement simd lowering for I16x8 (Closed)
Patch Set: [wasm] Implement simd lowering for I16x8 Created 3 years, 7 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 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
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 kInt32,
33 kFloat32,
34 kSimd1x4,
35 kInt16,
36 kSimd1x8
gdeepti 2017/04/25 20:29:58 Perhaps maintain the same ordering for ops as in i
aseemgarg 2017/04/26 23:02:01 Done.
37 };
32 38
33 static const int kMaxLanes = 4; 39 static const int kNumLanes32 = 4;
34 static const int kLaneWidth = 16 / kMaxLanes; 40 static const int kNumLanes16 = 8;
41 static const int32_t kMask16 = 0xffff;
42 static const int32_t kShift16 = 16;
35 43
36 struct Replacement { 44 struct Replacement {
37 Node* node[kMaxLanes]; 45 Node** node;
38 SimdType type; // represents what input type is expected 46 SimdType type; // represents output type
47 int num_replacements;
39 }; 48 };
40 49
41 struct NodeState { 50 struct NodeState {
42 Node* node; 51 Node* node;
43 int input_index; 52 int input_index;
44 }; 53 };
45 54
46 Zone* zone() const { return jsgraph_->zone(); } 55 Zone* zone() const { return jsgraph_->zone(); }
47 Graph* graph() const { return jsgraph_->graph(); } 56 Graph* graph() const { return jsgraph_->graph(); }
48 MachineOperatorBuilder* machine() const { return jsgraph_->machine(); } 57 MachineOperatorBuilder* machine() const { return jsgraph_->machine(); }
49 CommonOperatorBuilder* common() const { return jsgraph_->common(); } 58 CommonOperatorBuilder* common() const { return jsgraph_->common(); }
50 Signature<MachineRepresentation>* signature() const { return signature_; } 59 Signature<MachineRepresentation>* signature() const { return signature_; }
51 60
52 void LowerNode(Node* node); 61 void LowerNode(Node* node);
53 bool DefaultLowering(Node* node); 62 bool DefaultLowering(Node* node);
54 63
55 void ReplaceNode(Node* old, Node** new_nodes); 64 int NumLanes(SimdType type);
65 void ReplaceNode(Node* old, Node** new_nodes, int count);
56 bool HasReplacement(size_t index, Node* node); 66 bool HasReplacement(size_t index, Node* node);
57 Node** GetReplacements(Node* node); 67 Node** GetReplacements(Node* node);
68 int ReplacementCount(Node* node);
69 void Float32ToInt32(Node** replacements, Node** result);
70 void Int32ToFloat32(Node** replacements, Node** result);
71 void Int32ToInt16(Node** replacements, Node** result);
72 void Int16ToInt32(Node** replacements, Node** result);
58 Node** GetReplacementsWithType(Node* node, SimdType type); 73 Node** GetReplacementsWithType(Node* node, SimdType type);
59 SimdType ReplacementType(Node* node); 74 SimdType ReplacementType(Node* node);
60 void PreparePhiReplacement(Node* phi); 75 void PreparePhiReplacement(Node* phi);
61 void SetLoweredType(Node* node, Node* output); 76 void SetLoweredType(Node* node, Node* output);
62 void GetIndexNodes(Node* index, Node** new_indices); 77 void GetIndexNodes(Node* index, Node** new_indices, SimdType type);
63 void LowerLoadOp(MachineRepresentation rep, Node* node, 78 void LowerLoadOp(MachineRepresentation rep, Node* node,
64 const Operator* load_op); 79 const Operator* load_op, SimdType type);
65 void LowerStoreOp(MachineRepresentation rep, Node* node, 80 void LowerStoreOp(MachineRepresentation rep, Node* node,
66 const Operator* store_op, SimdType rep_type); 81 const Operator* store_op, SimdType rep_type);
67 void LowerBinaryOp(Node* node, SimdType input_rep_type, const Operator* op, 82 void LowerBinaryOp(Node* node, SimdType input_rep_type, const Operator* op,
68 bool invert_inputs = false); 83 bool invert_inputs = false);
84 Node* FixUpperBits(Node* input, int32_t shift);
85 void LowerBinaryOpForSmallInt(Node* node, SimdType input_rep_type,
86 const Operator* op);
87 Node* Mask(Node* input, int32_t mask);
88 void LowerSaturateBinaryOp(Node* node, SimdType input_rep_type,
89 const Operator* op, bool is_signed);
69 void LowerUnaryOp(Node* node, SimdType input_rep_type, const Operator* op); 90 void LowerUnaryOp(Node* node, SimdType input_rep_type, const Operator* op);
70 void LowerIntMinMax(Node* node, const Operator* op, bool is_max); 91 void LowerIntMinMax(Node* node, const Operator* op, bool is_max,
92 SimdType type);
71 void LowerConvertFromFloat(Node* node, bool is_signed); 93 void LowerConvertFromFloat(Node* node, bool is_signed);
72 void LowerShiftOp(Node* node, const Operator* op); 94 void LowerShiftOp(Node* node, SimdType type);
73 Node* BuildF64Trunc(Node* input); 95 Node* BuildF64Trunc(Node* input);
74 void LowerNotEqual(Node* node, SimdType input_rep_type, const Operator* op); 96 void LowerNotEqual(Node* node, SimdType input_rep_type, const Operator* op);
75 97
76 JSGraph* const jsgraph_; 98 JSGraph* const jsgraph_;
77 NodeMarker<State> state_; 99 NodeMarker<State> state_;
78 ZoneDeque<NodeState> stack_; 100 ZoneDeque<NodeState> stack_;
79 Replacement* replacements_; 101 Replacement* replacements_;
80 Signature<MachineRepresentation>* signature_; 102 Signature<MachineRepresentation>* signature_;
81 Node* placeholder_; 103 Node* placeholder_;
82 int parameter_count_after_lowering_; 104 int parameter_count_after_lowering_;
83 }; 105 };
84 106
85 } // namespace compiler 107 } // namespace compiler
86 } // namespace internal 108 } // namespace internal
87 } // namespace v8 109 } // namespace v8
88 110
89 #endif // V8_COMPILER_SIMD_SCALAR_LOWERING_H_ 111 #endif // V8_COMPILER_SIMD_SCALAR_LOWERING_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/simd-scalar-lowering.cc » ('j') | src/compiler/simd-scalar-lowering.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698