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

Side by Side Diff: src/harmony-simd.js

Issue 1230343003: V8: Add SIMD functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove name table size hack. Created 5 years, 4 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
« no previous file with comments | « no previous file | src/messages.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
11 // ------------------------------------------------------------------- 11 // -------------------------------------------------------------------
12 // Imports 12 // Imports
13 13
14 var GlobalSIMD = global.SIMD; 14 var GlobalSIMD = global.SIMD;
15 15
16 macro SIMD_TYPES(FUNCTION) 16 macro SIMD_FLOAT_TYPES(FUNCTION)
17 FUNCTION(Float32x4, float32x4, 4) 17 FUNCTION(Float32x4, float32x4, 4)
18 endmacro
19
20 macro SIMD_INT_TYPES(FUNCTION)
18 FUNCTION(Int32x4, int32x4, 4) 21 FUNCTION(Int32x4, int32x4, 4)
22 FUNCTION(Int16x8, int16x8, 8)
23 FUNCTION(Int8x16, int8x16, 16)
24 endmacro
25
26 macro SIMD_BOOL_TYPES(FUNCTION)
19 FUNCTION(Bool32x4, bool32x4, 4) 27 FUNCTION(Bool32x4, bool32x4, 4)
20 FUNCTION(Int16x8, int16x8, 8)
21 FUNCTION(Bool16x8, bool16x8, 8) 28 FUNCTION(Bool16x8, bool16x8, 8)
22 FUNCTION(Int8x16, int8x16, 16)
23 FUNCTION(Bool8x16, bool8x16, 16) 29 FUNCTION(Bool8x16, bool8x16, 16)
24 endmacro 30 endmacro
25 31
32 macro SIMD_ALL_TYPES(FUNCTION)
33 SIMD_FLOAT_TYPES(FUNCTION)
34 SIMD_INT_TYPES(FUNCTION)
35 SIMD_BOOL_TYPES(FUNCTION)
36 endmacro
37
26 macro DECLARE_GLOBALS(NAME, TYPE, LANES) 38 macro DECLARE_GLOBALS(NAME, TYPE, LANES)
27 var GlobalNAME = GlobalSIMD.NAME; 39 var GlobalNAME = GlobalSIMD.NAME;
28 endmacro 40 endmacro
29 41
30 SIMD_TYPES(DECLARE_GLOBALS) 42 SIMD_ALL_TYPES(DECLARE_GLOBALS)
31 43
32 macro DECLARE_COMMON_FUNCTIONS(NAME, TYPE, LANES) 44 macro DECLARE_COMMON_FUNCTIONS(NAME, TYPE, LANES)
33 function NAMECheckJS(a) { 45 function NAMECheckJS(a) {
34 return %NAMECheck(a); 46 return %NAMECheck(a);
35 } 47 }
36 48
37 function NAMEToString() { 49 function NAMEToString() {
38 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') { 50 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') {
39 throw MakeTypeError(kIncompatibleMethodReceiver, 51 throw MakeTypeError(kIncompatibleMethodReceiver,
40 "NAME.prototype.toString", this); 52 "NAME.prototype.toString", this);
(...skipping 25 matching lines...) Expand all
66 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') { 78 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') {
67 throw MakeTypeError(kIncompatibleMethodReceiver, 79 throw MakeTypeError(kIncompatibleMethodReceiver,
68 "NAME.prototype.valueOf", this); 80 "NAME.prototype.valueOf", this);
69 } 81 }
70 return %_ValueOf(this); 82 return %_ValueOf(this);
71 } 83 }
72 84
73 function NAMEExtractLaneJS(instance, lane) { 85 function NAMEExtractLaneJS(instance, lane) {
74 return %NAMEExtractLane(instance, lane); 86 return %NAMEExtractLane(instance, lane);
75 } 87 }
76 endmacro
77 88
78 SIMD_TYPES(DECLARE_COMMON_FUNCTIONS) 89 function NAMEEqualJS(a, b) {
90 return %NAMEEqual(a, b);
91 }
79 92
80 macro SIMD_NUMERIC_TYPES(FUNCTION) 93 function NAMENotEqualJS(a, b) {
81 FUNCTION(Float32x4) 94 return %NAMENotEqual(a, b);
82 FUNCTION(Int32x4)
83 FUNCTION(Int16x8)
84 FUNCTION(Int8x16)
85 endmacro
86
87 macro DECLARE_NUMERIC_FUNCTIONS(NAME)
88 function NAMEReplaceLaneJS(instance, lane, value) {
89 return %NAMEReplaceLane(instance, lane, TO_NUMBER_INLINE(value));
90 } 95 }
91 endmacro 96 endmacro
92 97
93 SIMD_NUMERIC_TYPES(DECLARE_NUMERIC_FUNCTIONS) 98 SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS)
94 99
95 macro SIMD_BOOL_TYPES(FUNCTION) 100 macro DECLARE_INT_FUNCTIONS(NAME, TYPE, LANES)
96 FUNCTION(Bool32x4) 101 function NAMEShiftLeftByScalarJS(instance, shift) {
97 FUNCTION(Bool16x8) 102 return %NAMEShiftLeftByScalar(instance, shift);
98 FUNCTION(Bool8x16) 103 }
104
105 function NAMEShiftRightLogicalByScalarJS(instance, shift) {
106 return %NAMEShiftRightLogicalByScalar(instance, shift);
107 }
108
109 function NAMEShiftRightArithmeticByScalarJS(instance, shift) {
110 return %NAMEShiftRightArithmeticByScalar(instance, shift);
111 }
99 endmacro 112 endmacro
100 113
101 macro DECLARE_BOOL_FUNCTIONS(NAME) 114 SIMD_INT_TYPES(DECLARE_INT_FUNCTIONS)
115
116 macro DECLARE_BOOL_FUNCTIONS(NAME, TYPE, LANES)
102 function NAMEReplaceLaneJS(instance, lane, value) { 117 function NAMEReplaceLaneJS(instance, lane, value) {
103 return %NAMEReplaceLane(instance, lane, value); 118 return %NAMEReplaceLane(instance, lane, value);
104 } 119 }
120
121 function NAMEAnyTrueJS(s) {
122 return %NAMEAnyTrue(s);
123 }
124
125 function NAMEAllTrueJS(s) {
126 return %NAMEAllTrue(s);
127 }
105 endmacro 128 endmacro
106 129
107 SIMD_BOOL_TYPES(DECLARE_BOOL_FUNCTIONS) 130 SIMD_BOOL_TYPES(DECLARE_BOOL_FUNCTIONS)
108 131
109 macro SIMD_UNSIGNED_INT_TYPES(FUNCTION) 132 macro SIMD_UNSIGNED_INT_TYPES(FUNCTION)
110 FUNCTION(Int16x8) 133 FUNCTION(Int16x8)
111 FUNCTION(Int8x16) 134 FUNCTION(Int8x16)
112 endmacro 135 endmacro
113 136
114 macro DECLARE_UNSIGNED_INT_FUNCTIONS(NAME) 137 macro DECLARE_UNSIGNED_INT_FUNCTIONS(NAME)
115 function NAMEUnsignedExtractLaneJS(instance, lane) { 138 function NAMEUnsignedExtractLaneJS(instance, lane) {
116 return %NAMEUnsignedExtractLane(instance, lane); 139 return %NAMEUnsignedExtractLane(instance, lane);
117 } 140 }
118 endmacro 141 endmacro
119 142
120 SIMD_UNSIGNED_INT_TYPES(DECLARE_UNSIGNED_INT_FUNCTIONS) 143 SIMD_UNSIGNED_INT_TYPES(DECLARE_UNSIGNED_INT_FUNCTIONS)
121 144
145 macro SIMD_NUMERIC_TYPES(FUNCTION)
146 SIMD_FLOAT_TYPES(FUNCTION)
147 SIMD_INT_TYPES(FUNCTION)
148 endmacro
149
150 macro DECLARE_NUMERIC_FUNCTIONS(NAME, TYPE, LANES)
151 function NAMEReplaceLaneJS(instance, lane, value) {
152 return %NAMEReplaceLane(instance, lane, TO_NUMBER_INLINE(value));
153 }
154
155 function NAMESelectJS(selector, a, b) {
156 return %NAMESelect(selector, a, b);
157 }
158
159 function NAMENegJS(a) {
160 return %NAMENeg(a);
161 }
162
163 function NAMEAddJS(a, b) {
164 return %NAMEAdd(a, b);
165 }
166
167 function NAMESubJS(a, b) {
168 return %NAMESub(a, b);
169 }
170
171 function NAMEMulJS(a, b) {
172 return %NAMEMul(a, b);
173 }
174
175 function NAMEMinJS(a, b) {
176 return %NAMEMin(a, b);
177 }
178
179 function NAMEMaxJS(a, b) {
180 return %NAMEMax(a, b);
181 }
182
183 function NAMELessThanJS(a, b) {
184 return %NAMELessThan(a, b);
185 }
186
187 function NAMELessThanOrEqualJS(a, b) {
188 return %NAMELessThanOrEqual(a, b);
189 }
190
191 function NAMEGreaterThanJS(a, b) {
192 return %NAMEGreaterThan(a, b);
193 }
194
195 function NAMEGreaterThanOrEqualJS(a, b) {
196 return %NAMEGreaterThanOrEqual(a, b);
197 }
198 endmacro
199
200 SIMD_NUMERIC_TYPES(DECLARE_NUMERIC_FUNCTIONS)
201
202 macro SIMD_LOGICAL_TYPES(FUNCTION)
203 SIMD_INT_TYPES(FUNCTION)
204 SIMD_BOOL_TYPES(FUNCTION)
205 endmacro
206
207 macro DECLARE_LOGICAL_FUNCTIONS(NAME, TYPE, LANES)
208 function NAMEAndJS(a, b) {
209 return %NAMEAnd(a, b);
210 }
211
212 function NAMEOrJS(a, b) {
213 return %NAMEOr(a, b);
214 }
215
216 function NAMEXorJS(a, b) {
217 return %NAMEXor(a, b);
218 }
219
220 function NAMENotJS(a) {
221 return %NAMENot(a);
222 }
223 endmacro
224
225 SIMD_LOGICAL_TYPES(DECLARE_LOGICAL_FUNCTIONS)
226
227 macro SIMD_FROM_TYPES(FUNCTION)
228 FUNCTION(Float32x4, Int32x4)
229 FUNCTION(Int32x4, Float32x4)
230 endmacro
231
232 macro DECLARE_FROM_FUNCTIONS(TO, FROM)
233 function TOFromFROMJS(a) {
234 return %TOFromFROM(a);
235 }
236 endmacro
237
238 SIMD_FROM_TYPES(DECLARE_FROM_FUNCTIONS)
239
240 macro SIMD_FROM_BITS_TYPES(FUNCTION)
241 FUNCTION(Float32x4, Int32x4)
242 FUNCTION(Float32x4, Int16x8)
243 FUNCTION(Float32x4, Int8x16)
244 FUNCTION(Int32x4, Float32x4)
245 FUNCTION(Int32x4, Int16x8)
246 FUNCTION(Int32x4, Int8x16)
247 FUNCTION(Int16x8, Float32x4)
248 FUNCTION(Int16x8, Int32x4)
249 FUNCTION(Int16x8, Int8x16)
250 FUNCTION(Int8x16, Float32x4)
251 FUNCTION(Int8x16, Int32x4)
252 FUNCTION(Int8x16, Int16x8)
253 endmacro
254
255 macro DECLARE_FROM_BITS_FUNCTIONS(TO, FROM)
256 function TOFromFROMBitsJS(a) {
257 return %TOFromFROMBits(a);
258 }
259 endmacro
260
261 SIMD_FROM_BITS_TYPES(DECLARE_FROM_BITS_FUNCTIONS)
262
122 //------------------------------------------------------------------- 263 //-------------------------------------------------------------------
123 264
124 function Float32x4Constructor(c0, c1, c2, c3) { 265 function Float32x4Constructor(c0, c1, c2, c3) {
125 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Float32x4"); 266 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Float32x4");
126 return %CreateFloat32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 267 return %CreateFloat32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
127 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3)); 268 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3));
128 } 269 }
129 270
130 271
131 function Float32x4Splat(s) { 272 function Float32x4Splat(s) {
132 return %CreateFloat32x4(s, s, s, s); 273 return %CreateFloat32x4(s, s, s, s);
133 } 274 }
134 275
135 276
277 function Float32x4AbsJS(a) {
278 return %Float32x4Abs(a);
279 }
280
281
282 function Float32x4SqrtJS(a) {
283 return %Float32x4Sqrt(a);
284 }
285
286
287 function Float32x4RecipApproxJS(a) {
288 return %Float32x4RecipApprox(a);
289 }
290
291
292 function Float32x4RecipSqrtApproxJS(a) {
293 return %Float32x4RecipSqrtApprox(a);
294 }
295
296
297 function Float32x4DivJS(a, b) {
298 return %Float32x4Div(a, b);
299 }
300
301
302 function Float32x4MinNumJS(a, b) {
303 return %Float32x4MinNum(a, b);
304 }
305
306
307 function Float32x4MaxNumJS(a, b) {
308 return %Float32x4MaxNum(a, b);
309 }
310
311
312 function Float32x4SwizzleJS(a, c0, c1, c2, c3) {
313 return %Float32x4Swizzle(a, c0, c1, c2, c3);
314 }
315
316
317 function Float32x4ShuffleJS(a, b, c0, c1, c2, c3) {
318 return %Float32x4Shuffle(a, b, c0, c1, c2, c3);
319 }
320
321
136 function Int32x4Constructor(c0, c1, c2, c3) { 322 function Int32x4Constructor(c0, c1, c2, c3) {
137 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int32x4"); 323 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int32x4");
138 return %CreateInt32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 324 return %CreateInt32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
139 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3)); 325 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3));
140 } 326 }
141 327
142 328
143 function Int32x4Splat(s) { 329 function Int32x4Splat(s) {
144 return %CreateInt32x4(s, s, s, s); 330 return %CreateInt32x4(s, s, s, s);
145 } 331 }
146 332
147 333
334 function Int32x4SwizzleJS(a, c0, c1, c2, c3) {
335 return %Int32x4Swizzle(a, c0, c1, c2, c3);
336 }
337
338
339 function Int32x4ShuffleJS(a, b, c0, c1, c2, c3) {
340 return %Int32x4Shuffle(a, b, c0, c1, c2, c3);
341 }
342
343
148 function Bool32x4Constructor(c0, c1, c2, c3) { 344 function Bool32x4Constructor(c0, c1, c2, c3) {
149 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool32x4"); 345 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool32x4");
150 return %CreateBool32x4(c0, c1, c2, c3); 346 return %CreateBool32x4(c0, c1, c2, c3);
151 } 347 }
152 348
153 349
154 function Bool32x4Splat(s) { 350 function Bool32x4Splat(s) {
155 return %CreateBool32x4(s, s, s, s); 351 return %CreateBool32x4(s, s, s, s);
156 } 352 }
157 353
354 function Bool32x4SwizzleJS(a, c0, c1, c2, c3) {
355 return %Bool32x4Swizzle(a, c0, c1, c2, c3);
356 }
357
358
359 function Bool32x4ShuffleJS(a, b, c0, c1, c2, c3) {
360 return %Bool32x4Shuffle(a, b, c0, c1, c2, c3);
361 }
362
158 363
159 function Int16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) { 364 function Int16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
160 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int16x8"); 365 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int16x8");
161 return %CreateInt16x8(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 366 return %CreateInt16x8(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
162 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3), 367 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3),
163 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5), 368 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5),
164 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7)); 369 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7));
165 } 370 }
166 371
167 372
168 function Int16x8Splat(s) { 373 function Int16x8Splat(s) {
169 return %CreateInt16x8(s, s, s, s, s, s, s, s); 374 return %CreateInt16x8(s, s, s, s, s, s, s, s);
170 } 375 }
171 376
172 377
378 function Int16x8SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
379 return %Int16x8Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
380 }
381
382
383 function Int16x8ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
384 return %Int16x8Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
385 }
386
387
173 function Bool16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) { 388 function Bool16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
174 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool16x8"); 389 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool16x8");
175 return %CreateBool16x8(c0, c1, c2, c3, c4, c5, c6, c7); 390 return %CreateBool16x8(c0, c1, c2, c3, c4, c5, c6, c7);
176 } 391 }
177 392
178 393
179 function Bool16x8Splat(s) { 394 function Bool16x8Splat(s) {
180 return %CreateBool16x8(s, s, s, s, s, s, s, s); 395 return %CreateBool16x8(s, s, s, s, s, s, s, s);
181 } 396 }
182 397
183 398
399 function Bool16x8SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
400 return %Bool16x8Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
401 }
402
403
404 function Bool16x8ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
405 return %Bool16x8Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
406 }
407
408
184 function Int8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, 409 function Int8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
185 c12, c13, c14, c15) { 410 c12, c13, c14, c15) {
186 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int8x16"); 411 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int8x16");
187 return %CreateInt8x16(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 412 return %CreateInt8x16(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
188 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3), 413 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3),
189 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5), 414 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5),
190 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7), 415 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7),
191 TO_NUMBER_INLINE(c8), TO_NUMBER_INLINE(c9), 416 TO_NUMBER_INLINE(c8), TO_NUMBER_INLINE(c9),
192 TO_NUMBER_INLINE(c10), TO_NUMBER_INLINE(c11), 417 TO_NUMBER_INLINE(c10), TO_NUMBER_INLINE(c11),
193 TO_NUMBER_INLINE(c12), TO_NUMBER_INLINE(c13), 418 TO_NUMBER_INLINE(c12), TO_NUMBER_INLINE(c13),
194 TO_NUMBER_INLINE(c14), TO_NUMBER_INLINE(c15)); 419 TO_NUMBER_INLINE(c14), TO_NUMBER_INLINE(c15));
195 } 420 }
196 421
197 422
198 function Int8x16Splat(s) { 423 function Int8x16Splat(s) {
199 return %CreateInt8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s); 424 return %CreateInt8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
200 } 425 }
201 426
202 427
428 function Int8x16SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
429 c12, c13, c14, c15) {
430 return %Int8x16Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
431 c12, c13, c14, c15);
432 }
433
434
435 function Int8x16ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
436 c11, c12, c13, c14, c15) {
437 return %Int8x16Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
438 c11, c12, c13, c14, c15);
439 }
440
441
203 function Bool8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, 442 function Bool8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
204 c12, c13, c14, c15) { 443 c12, c13, c14, c15) {
205 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool8x16"); 444 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool8x16");
206 return %CreateBool8x16(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 445 return %CreateBool8x16(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
207 c13, c14, c15); 446 c13, c14, c15);
208 } 447 }
209 448
210 449
211 function Bool8x16Splat(s) { 450 function Bool8x16Splat(s) {
212 return %CreateBool8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s); 451 return %CreateBool8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
213 } 452 }
214 453
215 454
455 function Bool8x16SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
456 c12, c13, c14, c15) {
457 return %Bool8x16Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
458 c12, c13, c14, c15);
459 }
460
461
462 function Bool8x16ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
463 c11, c12, c13, c14, c15) {
464 return %Bool8x16Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
465 c11, c12, c13, c14, c15);
466 }
467
468
216 %AddNamedProperty(GlobalSIMD, symbolToStringTag, 'SIMD', READ_ONLY | DONT_ENUM); 469 %AddNamedProperty(GlobalSIMD, symbolToStringTag, 'SIMD', READ_ONLY | DONT_ENUM);
217 470
218 macro SETUP_SIMD_TYPE(NAME, TYPE, LANES) 471 macro SETUP_SIMD_TYPE(NAME, TYPE, LANES)
219 %SetCode(GlobalNAME, NAMEConstructor); 472 %SetCode(GlobalNAME, NAMEConstructor);
220 %FunctionSetPrototype(GlobalNAME, {}); 473 %FunctionSetPrototype(GlobalNAME, {});
221 %AddNamedProperty(GlobalNAME.prototype, 'constructor', GlobalNAME, 474 %AddNamedProperty(GlobalNAME.prototype, 'constructor', GlobalNAME,
222 DONT_ENUM); 475 DONT_ENUM);
223 %AddNamedProperty(GlobalNAME.prototype, symbolToStringTag, 'NAME', 476 %AddNamedProperty(GlobalNAME.prototype, symbolToStringTag, 'NAME',
224 DONT_ENUM | READ_ONLY); 477 DONT_ENUM | READ_ONLY);
225 utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [ 478 utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [
226 'toLocaleString', NAMEToLocaleString, 479 'toLocaleString', NAMEToLocaleString,
227 'toString', NAMEToString, 480 'toString', NAMEToString,
228 'valueOf', NAMEValueOf, 481 'valueOf', NAMEValueOf,
229 ]); 482 ]);
230 endmacro 483 endmacro
231 484
232 SIMD_TYPES(SETUP_SIMD_TYPE) 485 SIMD_ALL_TYPES(SETUP_SIMD_TYPE)
233 486
234 //------------------------------------------------------------------- 487 //-------------------------------------------------------------------
235 488
236 utils.InstallFunctions(GlobalFloat32x4, DONT_ENUM, [ 489 utils.InstallFunctions(GlobalFloat32x4, DONT_ENUM, [
237 'splat', Float32x4Splat, 490 'splat', Float32x4Splat,
238 'check', Float32x4CheckJS, 491 'check', Float32x4CheckJS,
239 'extractLane', Float32x4ExtractLaneJS, 492 'extractLane', Float32x4ExtractLaneJS,
240 'replaceLane', Float32x4ReplaceLaneJS, 493 'replaceLane', Float32x4ReplaceLaneJS,
494 'neg', Float32x4NegJS,
495 'abs', Float32x4AbsJS,
496 'sqrt', Float32x4SqrtJS,
497 'reciprocalApproximation', Float32x4RecipApproxJS,
498 'reciprocalSqrtApproximation', Float32x4RecipSqrtApproxJS,
499 'add', Float32x4AddJS,
500 'sub', Float32x4SubJS,
501 'mul', Float32x4MulJS,
502 'div', Float32x4DivJS,
503 'min', Float32x4MinJS,
504 'max', Float32x4MaxJS,
505 'minNum', Float32x4MinNumJS,
506 'maxNum', Float32x4MaxNumJS,
507 'lessThan', Float32x4LessThanJS,
508 'lessThanOrEqual', Float32x4LessThanOrEqualJS,
509 'greaterThan', Float32x4GreaterThanJS,
510 'greaterThanOrEqual', Float32x4GreaterThanOrEqualJS,
511 'equal', Float32x4EqualJS,
512 'notEqual', Float32x4NotEqualJS,
513 'select', Float32x4SelectJS,
514 'swizzle', Float32x4SwizzleJS,
515 'shuffle', Float32x4ShuffleJS,
516 'fromInt32x4', Float32x4FromInt32x4JS,
517 'fromInt32x4Bits', Float32x4FromInt32x4BitsJS,
518 'fromInt16x8Bits', Float32x4FromInt16x8BitsJS,
519 'fromInt8x16Bits', Float32x4FromInt8x16BitsJS,
241 ]); 520 ]);
242 521
243 utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [ 522 utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [
244 'splat', Int32x4Splat, 523 'splat', Int32x4Splat,
245 'check', Int32x4CheckJS, 524 'check', Int32x4CheckJS,
246 'extractLane', Int32x4ExtractLaneJS, 525 'extractLane', Int32x4ExtractLaneJS,
247 'replaceLane', Int32x4ReplaceLaneJS, 526 'replaceLane', Int32x4ReplaceLaneJS,
527 'neg', Int32x4NegJS,
528 'add', Int32x4AddJS,
529 'sub', Int32x4SubJS,
530 'mul', Int32x4MulJS,
531 'min', Int32x4MinJS,
532 'max', Int32x4MaxJS,
533 'and', Int32x4AndJS,
534 'or', Int32x4OrJS,
535 'xor', Int32x4XorJS,
536 'not', Int32x4NotJS,
537 'shiftLeftByScalar', Int32x4ShiftLeftByScalarJS,
538 'shiftRightLogicalByScalar', Int32x4ShiftRightLogicalByScalarJS,
539 'shiftRightArithmeticByScalar', Int32x4ShiftRightArithmeticByScalarJS,
540 'lessThan', Int32x4LessThanJS,
541 'lessThanOrEqual', Int32x4LessThanOrEqualJS,
542 'greaterThan', Int32x4GreaterThanJS,
543 'greaterThanOrEqual', Int32x4GreaterThanOrEqualJS,
544 'equal', Int32x4EqualJS,
545 'notEqual', Int32x4NotEqualJS,
546 'select', Int32x4SelectJS,
547 'swizzle', Int32x4SwizzleJS,
548 'shuffle', Int32x4ShuffleJS,
549 'fromFloat32x4', Int32x4FromFloat32x4JS,
550 'fromFloat32x4Bits', Int32x4FromFloat32x4BitsJS,
551 'fromInt16x8Bits', Int32x4FromInt16x8BitsJS,
552 'fromInt8x16Bits', Int32x4FromInt8x16BitsJS,
248 ]); 553 ]);
249 554
250 utils.InstallFunctions(GlobalBool32x4, DONT_ENUM, [ 555 utils.InstallFunctions(GlobalBool32x4, DONT_ENUM, [
251 'splat', Bool32x4Splat, 556 'splat', Bool32x4Splat,
252 'check', Bool32x4CheckJS, 557 'check', Bool32x4CheckJS,
253 'extractLane', Bool32x4ExtractLaneJS, 558 'extractLane', Bool32x4ExtractLaneJS,
254 'replaceLane', Bool32x4ReplaceLaneJS, 559 'replaceLane', Bool32x4ReplaceLaneJS,
560 'and', Bool32x4AndJS,
561 'or', Bool32x4OrJS,
562 'xor', Bool32x4XorJS,
563 'not', Bool32x4NotJS,
564 'anyTrue', Bool32x4AnyTrueJS,
565 'allTrue', Bool32x4AllTrueJS,
566 'equal', Bool32x4EqualJS,
567 'notEqual', Bool32x4NotEqualJS,
568 'swizzle', Bool32x4SwizzleJS,
569 'shuffle', Bool32x4ShuffleJS,
255 ]); 570 ]);
256 571
257 utils.InstallFunctions(GlobalInt16x8, DONT_ENUM, [ 572 utils.InstallFunctions(GlobalInt16x8, DONT_ENUM, [
258 'splat', Int16x8Splat, 573 'splat', Int16x8Splat,
259 'check', Int16x8CheckJS, 574 'check', Int16x8CheckJS,
260 'extractLane', Int16x8ExtractLaneJS, 575 'extractLane', Int16x8ExtractLaneJS,
261 'unsignedExtractLane', Int16x8UnsignedExtractLaneJS, 576 'unsignedExtractLane', Int16x8UnsignedExtractLaneJS,
262 'replaceLane', Int16x8ReplaceLaneJS, 577 'replaceLane', Int16x8ReplaceLaneJS,
578 'neg', Int16x8NegJS,
579 'add', Int16x8AddJS,
580 'sub', Int16x8SubJS,
581 'mul', Int16x8MulJS,
582 'min', Int16x8MinJS,
583 'max', Int16x8MaxJS,
584 'and', Int16x8AndJS,
585 'or', Int16x8OrJS,
586 'xor', Int16x8XorJS,
587 'not', Int16x8NotJS,
588 'shiftLeftByScalar', Int16x8ShiftLeftByScalarJS,
589 'shiftRightLogicalByScalar', Int16x8ShiftRightLogicalByScalarJS,
590 'shiftRightArithmeticByScalar', Int16x8ShiftRightArithmeticByScalarJS,
591 'lessThan', Int16x8LessThanJS,
592 'lessThanOrEqual', Int16x8LessThanOrEqualJS,
593 'greaterThan', Int16x8GreaterThanJS,
594 'greaterThanOrEqual', Int16x8GreaterThanOrEqualJS,
595 'equal', Int16x8EqualJS,
596 'notEqual', Int16x8NotEqualJS,
597 'select', Int16x8SelectJS,
598 'swizzle', Int16x8SwizzleJS,
599 'shuffle', Int16x8ShuffleJS,
600 'fromFloat32x4Bits', Int16x8FromFloat32x4BitsJS,
601 'fromInt32x4Bits', Int16x8FromInt32x4BitsJS,
602 'fromInt8x16Bits', Int16x8FromInt8x16BitsJS,
263 ]); 603 ]);
264 604
265 utils.InstallFunctions(GlobalBool16x8, DONT_ENUM, [ 605 utils.InstallFunctions(GlobalBool16x8, DONT_ENUM, [
266 'splat', Bool16x8Splat, 606 'splat', Bool16x8Splat,
267 'check', Bool16x8CheckJS, 607 'check', Bool16x8CheckJS,
268 'extractLane', Bool16x8ExtractLaneJS, 608 'extractLane', Bool16x8ExtractLaneJS,
269 'replaceLane', Bool16x8ReplaceLaneJS, 609 'replaceLane', Bool16x8ReplaceLaneJS,
610 'and', Bool16x8AndJS,
611 'or', Bool16x8OrJS,
612 'xor', Bool16x8XorJS,
613 'not', Bool16x8NotJS,
614 'anyTrue', Bool16x8AnyTrueJS,
615 'allTrue', Bool16x8AllTrueJS,
616 'equal', Bool16x8EqualJS,
617 'notEqual', Bool16x8NotEqualJS,
618 'swizzle', Bool16x8SwizzleJS,
619 'shuffle', Bool16x8ShuffleJS,
270 ]); 620 ]);
271 621
272 utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [ 622 utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [
273 'splat', Int8x16Splat, 623 'splat', Int8x16Splat,
274 'check', Int8x16CheckJS, 624 'check', Int8x16CheckJS,
275 'extractLane', Int8x16ExtractLaneJS, 625 'extractLane', Int8x16ExtractLaneJS,
276 'unsignedExtractLane', Int8x16UnsignedExtractLaneJS, 626 'unsignedExtractLane', Int8x16UnsignedExtractLaneJS,
277 'replaceLane', Int8x16ReplaceLaneJS, 627 'replaceLane', Int8x16ReplaceLaneJS,
628 'neg', Int8x16NegJS,
629 'add', Int8x16AddJS,
630 'sub', Int8x16SubJS,
631 'mul', Int8x16MulJS,
632 'min', Int8x16MinJS,
633 'max', Int8x16MaxJS,
634 'and', Int8x16AndJS,
635 'or', Int8x16OrJS,
636 'xor', Int8x16XorJS,
637 'not', Int8x16NotJS,
638 'shiftLeftByScalar', Int8x16ShiftLeftByScalarJS,
639 'shiftRightLogicalByScalar', Int8x16ShiftRightLogicalByScalarJS,
640 'shiftRightArithmeticByScalar', Int8x16ShiftRightArithmeticByScalarJS,
641 'lessThan', Int8x16LessThanJS,
642 'lessThanOrEqual', Int8x16LessThanOrEqualJS,
643 'greaterThan', Int8x16GreaterThanJS,
644 'greaterThanOrEqual', Int8x16GreaterThanOrEqualJS,
645 'equal', Int8x16EqualJS,
646 'notEqual', Int8x16NotEqualJS,
647 'select', Int8x16SelectJS,
648 'swizzle', Int8x16SwizzleJS,
649 'shuffle', Int8x16ShuffleJS,
650 'fromFloat32x4Bits', Int8x16FromFloat32x4BitsJS,
651 'fromInt32x4Bits', Int8x16FromInt32x4BitsJS,
652 'fromInt16x8Bits', Int8x16FromInt16x8BitsJS,
278 ]); 653 ]);
279 654
280 utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [ 655 utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [
281 'splat', Bool8x16Splat, 656 'splat', Bool8x16Splat,
282 'check', Bool8x16CheckJS, 657 'check', Bool8x16CheckJS,
283 'extractLane', Bool8x16ExtractLaneJS, 658 'extractLane', Bool8x16ExtractLaneJS,
284 'replaceLane', Bool8x16ReplaceLaneJS, 659 'replaceLane', Bool8x16ReplaceLaneJS,
660 'and', Bool8x16AndJS,
661 'or', Bool8x16OrJS,
662 'xor', Bool8x16XorJS,
663 'not', Bool8x16NotJS,
664 'anyTrue', Bool8x16AnyTrueJS,
665 'allTrue', Bool8x16AllTrueJS,
666 'equal', Bool8x16EqualJS,
667 'notEqual', Bool8x16NotEqualJS,
668 'swizzle', Bool8x16SwizzleJS,
669 'shuffle', Bool8x16ShuffleJS,
285 ]); 670 ]);
286 671
672 utils.Export(function(to) {
673 to.Float32x4ToString = Float32x4ToString;
674 to.Int32x4ToString = Int32x4ToString;
675 to.Bool32x4ToString = Bool32x4ToString;
676 to.Int16x8ToString = Int16x8ToString;
677 to.Bool16x8ToString = Bool16x8ToString;
678 to.Int8x16ToString = Int8x16ToString;
679 to.Bool8x16ToString = Bool8x16ToString;
680 });
681
287 }) 682 })
OLDNEW
« no previous file with comments | « no previous file | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698