v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
register-arm64.cc
Go to the documentation of this file.
1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#if V8_TARGET_ARCH_ARM64
6
8
9namespace v8 {
10namespace internal {
11
13 DCHECK(vform == kFormat8H || vform == kFormat4S || vform == kFormat2D ||
14 vform == kFormat1Q || vform == kFormatH || vform == kFormatS ||
15 vform == kFormatD);
16 switch (vform) {
17 case kFormat8H:
18 return kFormat8B;
19 case kFormat4S:
20 return kFormat4H;
21 case kFormat2D:
22 return kFormat2S;
23 case kFormat1Q:
24 return kFormat1D;
25 case kFormatH:
26 return kFormatB;
27 case kFormatS:
28 return kFormatH;
29 case kFormatD:
30 return kFormatS;
31 default:
33 }
34}
35
37 DCHECK(vform == kFormat8B || vform == kFormat4H || vform == kFormat2S ||
38 vform == kFormatB || vform == kFormatH || vform == kFormatS);
39 switch (vform) {
40 case kFormat8B:
41 return kFormat8H;
42 case kFormat4H:
43 return kFormat4S;
44 case kFormat2S:
45 return kFormat2D;
46 case kFormatB:
47 return kFormatH;
48 case kFormatH:
49 return kFormatS;
50 case kFormatS:
51 return kFormatD;
52 default:
54 }
55}
56
58 switch (vform) {
59 case kFormatB:
60 case kFormat8B:
61 case kFormat16B:
62 return kFormat16B;
63 case kFormatH:
64 case kFormat4H:
65 case kFormat8H:
66 return kFormat8H;
67 case kFormatS:
68 case kFormat2S:
69 case kFormat4S:
70 return kFormat4S;
71 case kFormatD:
72 case kFormat1D:
73 case kFormat2D:
74 return kFormat2D;
75 default:
77 }
78}
79
81 switch (vform) {
82 case kFormat4H:
83 return kFormat8B;
84 case kFormat8H:
85 return kFormat16B;
86 case kFormat2S:
87 return kFormat4H;
88 case kFormat4S:
89 return kFormat8H;
90 case kFormat1D:
91 return kFormat2S;
92 case kFormat2D:
93 return kFormat4S;
94 case kFormat1Q:
95 return kFormat2D;
96 default:
98 }
99}
100
102 DCHECK(vform == kFormat8B || vform == kFormat4H || vform == kFormat2S);
103 switch (vform) {
104 case kFormat8B:
105 return kFormat16B;
106 case kFormat4H:
107 return kFormat8H;
108 case kFormat2S:
109 return kFormat4S;
110 default:
111 UNREACHABLE();
112 }
113}
114
116 DCHECK(vform == kFormat16B || vform == kFormat8H || vform == kFormat4S);
117 switch (vform) {
118 case kFormat16B:
119 return kFormat8B;
120 case kFormat8H:
121 return kFormat4H;
122 case kFormat4S:
123 return kFormat2S;
124 default:
125 UNREACHABLE();
126 }
127}
128
130 switch (laneSize) {
131 case 8:
132 return kFormatB;
133 case 16:
134 return kFormatH;
135 case 32:
136 return kFormatS;
137 case 64:
138 return kFormatD;
139 default:
140 UNREACHABLE();
141 }
142}
143
144VectorFormat VectorFormatFillQ(int laneSize) {
146}
147
150}
151
153 return RegisterSizeInBitsFromFormat(vform) / 8;
154}
155
158 switch (vform) {
159 case kFormatB:
160 return kBRegSizeInBits;
161 case kFormatH:
162 return kHRegSizeInBits;
163 case kFormatS:
164 return kSRegSizeInBits;
165 case kFormatD:
166 return kDRegSizeInBits;
167 case kFormat8B:
168 case kFormat4H:
169 case kFormat2S:
170 case kFormat1D:
171 return kDRegSizeInBits;
172 default:
173 return kQRegSizeInBits;
174 }
175}
176
179 switch (vform) {
180 case kFormatB:
181 case kFormat8B:
182 case kFormat16B:
183 return 8;
184 case kFormatH:
185 case kFormat4H:
186 case kFormat8H:
187 return 16;
188 case kFormatS:
189 case kFormat2S:
190 case kFormat4S:
191 return 32;
192 case kFormatD:
193 case kFormat1D:
194 case kFormat2D:
195 return 64;
196 case kFormat1Q:
197 return 128;
198 default:
199 UNREACHABLE();
200 }
201}
202
204 return LaneSizeInBitsFromFormat(vform) / 8;
205}
206
209 switch (vform) {
210 case kFormatB:
211 case kFormat8B:
212 case kFormat16B:
213 return 0;
214 case kFormatH:
215 case kFormat4H:
216 case kFormat8H:
217 return 1;
218 case kFormatS:
219 case kFormat2S:
220 case kFormat4S:
221 return 2;
222 case kFormatD:
223 case kFormat1D:
224 case kFormat2D:
225 return 3;
226 default:
227 UNREACHABLE();
228 }
229}
230
233 switch (vform) {
234 case kFormat16B:
235 return 16;
236 case kFormat8B:
237 case kFormat8H:
238 return 8;
239 case kFormat4H:
240 case kFormat4S:
241 return 4;
242 case kFormat2S:
243 case kFormat2D:
244 return 2;
245 case kFormat1D:
246 case kFormat1Q:
247 case kFormatB:
248 case kFormatH:
249 case kFormatS:
250 case kFormatD:
251 return 1;
252 default:
253 UNREACHABLE();
254 }
255}
256
259 switch (vform) {
260 case kFormatB:
261 case kFormat8B:
262 case kFormat16B:
263 return 16;
264 case kFormatH:
265 case kFormat4H:
266 case kFormat8H:
267 return 8;
268 case kFormatS:
269 case kFormat2S:
270 case kFormat4S:
271 return 4;
272 case kFormatD:
273 case kFormat1D:
274 case kFormat2D:
275 return 2;
276 default:
277 UNREACHABLE();
278 }
279}
280
281// Does 'vform' indicate a vector format or a scalar format?
282bool IsVectorFormat(VectorFormat vform) {
284 switch (vform) {
285 case kFormatB:
286 case kFormatH:
287 case kFormatS:
288 case kFormatD:
289 return false;
290 default:
291 return true;
292 }
293}
294
295int64_t MaxIntFromFormat(VectorFormat vform) {
296 return INT64_MAX >> (64 - LaneSizeInBitsFromFormat(vform));
297}
298
299int64_t MinIntFromFormat(VectorFormat vform) {
300 return INT64_MIN >> (64 - LaneSizeInBitsFromFormat(vform));
301}
302
303uint64_t MaxUintFromFormat(VectorFormat vform) {
304 return UINT64_MAX >> (64 - LaneSizeInBitsFromFormat(vform));
305}
306
307} // namespace internal
308} // namespace v8
309
310#endif // V8_TARGET_ARCH_ARM64
VectorFormat ScalarFormatFromLaneSize(int lanesize)
VectorFormat VectorFormatHalfLanes(VectorFormat vform)
V8_EXPORT_PRIVATE int LaneCountFromFormat(VectorFormat vform)
V8_EXPORT_PRIVATE unsigned RegisterSizeInBitsFromFormat(VectorFormat vform)
int64_t MinIntFromFormat(VectorFormat vform)
uint64_t MaxUintFromFormat(VectorFormat vform)
int LaneSizeInBytesLog2FromFormat(VectorFormat vform)
int MaxLaneCountFromFormat(VectorFormat vform)
int64_t MaxIntFromFormat(VectorFormat vform)
VectorFormat VectorFormatHalfWidth(VectorFormat vform)
constexpr int kBRegSizeInBits
V8_EXPORT_PRIVATE bool IsVectorFormat(VectorFormat vform)
unsigned LaneSizeInBitsFromFormat(VectorFormat vform)
VectorFormat VectorFormatDoubleLanes(VectorFormat vform)
constexpr int kSRegSizeInBits
VectorFormat VectorFormatDoubleWidth(VectorFormat vform)
constexpr int kQRegSizeInBits
int LaneSizeInBytesFromFormat(VectorFormat vform)
VectorFormat VectorFormatHalfWidthDoubleLanes(VectorFormat vform)
unsigned RegisterSizeInBytesFromFormat(VectorFormat vform)
constexpr int kHRegSizeInBits
VectorFormat VectorFormatFillQ(int laneSize)
VectorFormat ScalarFormatFromFormat(VectorFormat vform)
constexpr int kDRegSizeInBits
#define DCHECK_NE(v1, v2)
Definition logging.h:486
#define DCHECK(condition)
Definition logging.h:482