1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 // This file relies on the fact that the following declaration has been made
32 // var $Array = global.Array;
34 var $SIMD = global.SIMD;
35 var $Float32x4 = $SIMD.float32x4;
36 var $Float64x2 = $SIMD.float64x2;
37 var $Int32x4 = $SIMD.int32x4;
39 macro SIMD128_DATA_TYPES(FUNCTION)
40 FUNCTION(Float32x4, float32x4)
41 FUNCTION(Float64x2, float64x2)
42 FUNCTION(Int32x4, int32x4)
45 macro DECLARE_DATA_TYPE_COMMON_FUNCTION(NAME, TYPE)
46 function ThrowNAMETypeError() {
47 throw MakeTypeError("this is not a TYPE object.");
50 function CheckNAME(arg) {
51 if (!(arg instanceof $NAME))
56 SIMD128_DATA_TYPES(DECLARE_DATA_TYPE_COMMON_FUNCTION)
58 function StringfyFloat32x4JS() {
60 return "float32x4(" + this.x + "," + this.y + "," + this.z + "," + this.w + ")";
63 function StringfyFloat64x2JS() {
65 return "float64x2(" + this.x + "," + this.y + ")";
68 function StringfyInt32x4JS() {
70 return "int32x4(" + this.x + "," + this.y + "," + this.z + "," + this.w + ")";
73 macro SIMD128_DATA_TYPE_FUNCTIONS(FUNCTION)
74 FUNCTION(Float32x4, GetX)
75 FUNCTION(Float32x4, GetY)
76 FUNCTION(Float32x4, GetZ)
77 FUNCTION(Float32x4, GetW)
78 FUNCTION(Float32x4, GetSignMask)
79 FUNCTION(Float64x2, GetX)
80 FUNCTION(Float64x2, GetY)
81 FUNCTION(Float64x2, GetSignMask)
82 FUNCTION(Int32x4, GetX)
83 FUNCTION(Int32x4, GetY)
84 FUNCTION(Int32x4, GetZ)
85 FUNCTION(Int32x4, GetW)
86 FUNCTION(Int32x4, GetFlagX)
87 FUNCTION(Int32x4, GetFlagY)
88 FUNCTION(Int32x4, GetFlagZ)
89 FUNCTION(Int32x4, GetFlagW)
90 FUNCTION(Int32x4, GetSignMask)
93 macro DECLARE_DATA_TYPE_FUNCTION(TYPE, FUNCTION)
94 function TYPEFUNCTIONJS() {
96 return %TYPEFUNCTION(this);
100 SIMD128_DATA_TYPE_FUNCTIONS(DECLARE_DATA_TYPE_FUNCTION)
102 function Float32x4Constructor(x, y, z, w) {
103 if (arguments.length == 1) {
105 return %CreateFloat32x4(x.x, x.y, x.z, x.w);
107 x = TO_NUMBER_INLINE(x);
108 y = TO_NUMBER_INLINE(y);
109 z = TO_NUMBER_INLINE(z);
110 w = TO_NUMBER_INLINE(w);
111 return %CreateFloat32x4(x, y, z, w);
115 function Float64x2Constructor(x, y) {
116 if (arguments.length == 1) {
118 return %CreateFloat64x2(x.x, x.y);
120 x = TO_NUMBER_INLINE(x);
121 y = TO_NUMBER_INLINE(y);
122 return %CreateFloat64x2(x, y);
126 function Int32x4Constructor(x, y, z, w) {
127 if (arguments.length == 1) {
129 return %CreateInt32x4(x.x, x.y, x.z, x.w);
135 return %CreateInt32x4(x, y, z, w);
139 function SetUpFloat32x4() {
140 %CheckIsBootstrapping();
142 %SetCode($Float32x4, Float32x4Constructor);
144 %FunctionSetPrototype($Float32x4, new $Object());
145 %AddNamedProperty($Float32x4.prototype, "constructor", $Float32x4, DONT_ENUM);
147 InstallGetter($Float32x4.prototype, "x", Float32x4GetXJS);
148 InstallGetter($Float32x4.prototype, "y", Float32x4GetYJS);
149 InstallGetter($Float32x4.prototype, "z", Float32x4GetZJS);
150 InstallGetter($Float32x4.prototype, "w", Float32x4GetWJS);
151 InstallGetter($Float32x4.prototype, "signMask", Float32x4GetSignMaskJS);
152 InstallFunctions($Float32x4.prototype, DONT_ENUM, $Array(
153 "toString", StringfyFloat32x4JS
157 function SetUpFloat64x2() {
158 %CheckIsBootstrapping();
160 %SetCode($Float64x2, Float64x2Constructor);
162 %FunctionSetPrototype($Float64x2, new $Object());
163 %AddNamedProperty($Float64x2.prototype, "constructor", $Float64x2, DONT_ENUM);
165 InstallGetter($Float64x2.prototype, "x", Float64x2GetXJS);
166 InstallGetter($Float64x2.prototype, "y", Float64x2GetYJS);
167 InstallGetter($Float64x2.prototype, "signMask", Float64x2GetSignMaskJS);
168 InstallFunctions($Float64x2.prototype, DONT_ENUM, $Array(
169 "toString", StringfyFloat64x2JS
173 function SetUpInt32x4() {
174 %CheckIsBootstrapping();
176 %SetCode($Int32x4, Int32x4Constructor);
178 %FunctionSetPrototype($Int32x4, new $Object());
179 %AddNamedProperty($Int32x4.prototype, "constructor", $Int32x4, DONT_ENUM);
181 InstallGetter($Int32x4.prototype, "x", Int32x4GetXJS);
182 InstallGetter($Int32x4.prototype, "y", Int32x4GetYJS);
183 InstallGetter($Int32x4.prototype, "z", Int32x4GetZJS);
184 InstallGetter($Int32x4.prototype, "w", Int32x4GetWJS);
185 InstallGetter($Int32x4.prototype, "flagX", Int32x4GetFlagXJS);
186 InstallGetter($Int32x4.prototype, "flagY", Int32x4GetFlagYJS);
187 InstallGetter($Int32x4.prototype, "flagZ", Int32x4GetFlagZJS);
188 InstallGetter($Int32x4.prototype, "flagW", Int32x4GetFlagWJS);
189 InstallGetter($Int32x4.prototype, "signMask", Int32x4GetSignMaskJS);
190 InstallFunctions($Int32x4.prototype, DONT_ENUM, $Array(
191 "toString", StringfyInt32x4JS
199 //------------------------------------------------------------------------------
200 macro SIMD128_UNARY_FUNCTIONS(FUNCTION)
201 FUNCTION(Float32x4, Abs)
202 FUNCTION(Float32x4, BitsToInt32x4)
203 FUNCTION(Float32x4, Neg)
204 FUNCTION(Float32x4, Reciprocal)
205 FUNCTION(Float32x4, ReciprocalSqrt)
206 FUNCTION(Float32x4, Sqrt)
207 FUNCTION(Float32x4, ToInt32x4)
208 FUNCTION(Float64x2, Abs)
209 FUNCTION(Float64x2, Neg)
210 FUNCTION(Float64x2, Sqrt)
211 FUNCTION(Int32x4, BitsToFloat32x4)
212 FUNCTION(Int32x4, Neg)
213 FUNCTION(Int32x4, Not)
214 FUNCTION(Int32x4, ToFloat32x4)
217 macro SIMD128_BINARY_FUNCTIONS(FUNCTION)
218 FUNCTION(Float32x4, Add)
219 FUNCTION(Float32x4, Div)
220 FUNCTION(Float32x4, Max)
221 FUNCTION(Float32x4, Min)
222 FUNCTION(Float32x4, Mul)
223 FUNCTION(Float32x4, Sub)
224 FUNCTION(Float32x4, Equal)
225 FUNCTION(Float32x4, NotEqual)
226 FUNCTION(Float32x4, GreaterThanOrEqual)
227 FUNCTION(Float32x4, GreaterThan)
228 FUNCTION(Float32x4, LessThan)
229 FUNCTION(Float32x4, LessThanOrEqual)
230 FUNCTION(Float64x2, Add)
231 FUNCTION(Float64x2, Div)
232 FUNCTION(Float64x2, Max)
233 FUNCTION(Float64x2, Min)
234 FUNCTION(Float64x2, Mul)
235 FUNCTION(Float64x2, Sub)
236 FUNCTION(Int32x4, Add)
237 FUNCTION(Int32x4, And)
238 FUNCTION(Int32x4, Mul)
239 FUNCTION(Int32x4, Or)
240 FUNCTION(Int32x4, Sub)
241 FUNCTION(Int32x4, Xor)
242 FUNCTION(Int32x4, Equal)
243 FUNCTION(Int32x4, GreaterThan)
244 FUNCTION(Int32x4, LessThan)
247 macro SIMD128_BINARY_SHUFFLE_FUNCTIONS(FUNCTION)
252 macro FLOAT32x4_BINARY_FUNCTIONS_WITH_FLOAT32_PARAMETER(FUNCTION)
260 macro FLOAT64x2_BINARY_FUNCTIONS_WITH_FLOAT64_PARAMETER(FUNCTION)
266 macro INT32x4_BINARY_FUNCTIONS_WITH_INT32_PARAMETER(FUNCTION)
273 macro INT32x4_BINARY_FUNCTIONS_WITH_BOOLEAN_PARAMETER(FUNCTION)
280 macro DECLARE_SIMD_UNARY_FUNCTION(TYPE, FUNCTION)
281 function TYPEFUNCTIONJS(x4) {
283 return %TYPEFUNCTION(x4);
287 macro DECLARE_SIMD_BINARY_FUNCTION(TYPE, FUNCTION)
288 function TYPEFUNCTIONJS(a4, b4) {
291 return %TYPEFUNCTION(a4, b4);
295 macro DECLARE_SIMD_BINARY_SHUFFLE_FUNCTION(TYPE)
296 function TYPEShuffleJS(x4, mask) {
298 var value = TO_INT32(mask);
299 if ((value < 0) || (value > 0xFF)) {
300 throw MakeRangeError("invalid_simd_shuffle_mask");
302 return %TYPEShuffle(x4, mask);
306 macro DECLARE_FLOAT32x4_BINARY_FUNCTION_WITH_FLOAT32_PARAMETER(FUNCTION)
307 function Float32x4FUNCTIONJS(x4, f) {
309 f = TO_NUMBER_INLINE(f);
310 return %Float32x4FUNCTION(x4, f);
314 macro DECLARE_FLOAT64x2_BINARY_FUNCTION_WITH_FLOAT64_PARAMETER(FUNCTION)
315 function Float64x2FUNCTIONJS(x2, f) {
317 f = TO_NUMBER_INLINE(f);
318 return %Float64x2FUNCTION(x2, f);
322 macro DECLARE_INT32x4_BINARY_FUNCTION_WITH_INT32_PARAMETER(FUNCTION)
323 function Int32x4FUNCTIONJS(x4, i) {
326 return %Int32x4FUNCTION(x4, i);
330 macro DECLARE_INT32x4_BINARY_FUNCTION_WITH_BOOLEAN_PARAMETER(FUNCTION)
331 function Int32x4FUNCTIONJS(x4, b) {
334 return %Int32x4FUNCTION(x4, b);
338 SIMD128_UNARY_FUNCTIONS(DECLARE_SIMD_UNARY_FUNCTION)
339 SIMD128_BINARY_FUNCTIONS(DECLARE_SIMD_BINARY_FUNCTION)
340 SIMD128_BINARY_SHUFFLE_FUNCTIONS(DECLARE_SIMD_BINARY_SHUFFLE_FUNCTION)
341 FLOAT32x4_BINARY_FUNCTIONS_WITH_FLOAT32_PARAMETER(DECLARE_FLOAT32x4_BINARY_FUNCTION_WITH_FLOAT32_PARAMETER)
342 FLOAT64x2_BINARY_FUNCTIONS_WITH_FLOAT64_PARAMETER(DECLARE_FLOAT64x2_BINARY_FUNCTION_WITH_FLOAT64_PARAMETER)
343 INT32x4_BINARY_FUNCTIONS_WITH_INT32_PARAMETER(DECLARE_INT32x4_BINARY_FUNCTION_WITH_INT32_PARAMETER)
344 INT32x4_BINARY_FUNCTIONS_WITH_BOOLEAN_PARAMETER(DECLARE_INT32x4_BINARY_FUNCTION_WITH_BOOLEAN_PARAMETER)
346 function NotImplementedJS() {
347 throw MakeTypeError("Not implemented.");
350 function Float32x4SplatJS(f) {
351 f = TO_NUMBER_INLINE(f);
352 return %CreateFloat32x4(f, f, f, f);
355 function Float32x4ZeroJS() {
356 return %CreateFloat32x4(0.0, 0.0, 0.0, 0.0);
359 function Float32x4AndJS(a4, b4) {
360 a4 = Float32x4BitsToInt32x4JS(a4);
361 b4 = Float32x4BitsToInt32x4JS(b4);
362 return Int32x4BitsToFloat32x4JS(Int32x4AndJS(a4, b4));
365 function Float32x4OrJS(a4, b4) {
366 a4 = Float32x4BitsToInt32x4JS(a4);
367 b4 = Float32x4BitsToInt32x4JS(b4);
368 return Int32x4BitsToFloat32x4JS(Int32x4OrJS(a4, b4));
371 function Float32x4XorJS(a4, b4) {
372 a4 = Float32x4BitsToInt32x4JS(a4);
373 b4 = Float32x4BitsToInt32x4JS(b4);
374 return Int32x4BitsToFloat32x4JS(Int32x4XorJS(a4, b4));
377 function Float32x4NotJS(x4) {
378 x4 = Float32x4BitsToInt32x4JS(x4);
379 return Int32x4BitsToFloat32x4JS(Int32x4NotJS(x4));
382 function Float32x4ClampJS(x4, lowerLimit, upperLimit) {
384 CheckFloat32x4(lowerLimit);
385 CheckFloat32x4(upperLimit);
386 return %Float32x4Clamp(x4, lowerLimit, upperLimit);
389 function Float32x4ShuffleMixJS(a4, b4, mask) {
392 var value = TO_INT32(mask);
393 if ((value < 0) || (value > 0xFF)) {
394 throw MakeRangeError("invalid_simd_shuffleMix_mask");
396 return %Float32x4ShuffleMix(a4, b4, mask);
399 function Float32x4SelectJS(x4, trueValue, falseValue) {
401 CheckFloat32x4(trueValue);
402 CheckFloat32x4(falseValue);
403 return %Float32x4Select(x4, trueValue, falseValue);
406 function Float64x2SplatJS(f) {
407 f = TO_NUMBER_INLINE(f);
408 return %CreateFloat64x2(f, f);
411 function Float64x2ZeroJS() {
412 return %CreateFloat64x2(0.0, 0.0);
415 function Float64x2ClampJS(x2, lowerLimit, upperLimit) {
417 CheckFloat64x2(lowerLimit);
418 CheckFloat64x2(upperLimit);
419 return %Float64x2Clamp(x2, lowerLimit, upperLimit);
422 function Int32x4ZeroJS() {
423 return %CreateInt32x4(0, 0, 0, 0);
426 function Int32x4BoolJS(x, y, z, w) {
431 return %CreateInt32x4(x, y, z, w);
434 function Int32x4SplatJS(s) {
436 return %CreateInt32x4(s, s, s, s);
439 function Int32x4SelectJS(x4, trueValue, falseValue) {
441 CheckInt32x4(trueValue);
442 CheckInt32x4(falseValue);
443 return %Int32x4Select(x4, trueValue, falseValue);
446 function Int32x4ShiftLeftJS(t, s) {
448 s = TO_NUMBER_INLINE(s);
453 return %CreateInt32x4(x, y, z, w);
456 function Int32x4ShiftRightJS(t, s) {
458 s = TO_NUMBER_INLINE(s);
463 return %CreateInt32x4(x, y, z, w);
466 function Int32x4ShiftRightArithmeticJS(t, s) {
468 s = TO_NUMBER_INLINE(s);
473 return %CreateInt32x4(x, y, z, w);
476 function SetUpSIMD() {
477 %CheckIsBootstrapping();
479 %OptimizeObjectForAddingMultipleProperties($SIMD, 258);
480 %AddNamedProperty($SIMD, "XXXX", 0x00, DONT_ENUM | DONT_DELETE | READ_ONLY);
481 %AddNamedProperty($SIMD, "XXXY", 0x40, DONT_ENUM | DONT_DELETE | READ_ONLY);
482 %AddNamedProperty($SIMD, "XXXZ", 0x80, DONT_ENUM | DONT_DELETE | READ_ONLY);
483 %AddNamedProperty($SIMD, "XXXW", 0xC0, DONT_ENUM | DONT_DELETE | READ_ONLY);
484 %AddNamedProperty($SIMD, "XXYX", 0x10, DONT_ENUM | DONT_DELETE | READ_ONLY);
485 %AddNamedProperty($SIMD, "XXYY", 0x50, DONT_ENUM | DONT_DELETE | READ_ONLY);
486 %AddNamedProperty($SIMD, "XXYZ", 0x90, DONT_ENUM | DONT_DELETE | READ_ONLY);
487 %AddNamedProperty($SIMD, "XXYW", 0xD0, DONT_ENUM | DONT_DELETE | READ_ONLY);
488 %AddNamedProperty($SIMD, "XXZX", 0x20, DONT_ENUM | DONT_DELETE | READ_ONLY);
489 %AddNamedProperty($SIMD, "XXZY", 0x60, DONT_ENUM | DONT_DELETE | READ_ONLY);
490 %AddNamedProperty($SIMD, "XXZZ", 0xA0, DONT_ENUM | DONT_DELETE | READ_ONLY);
491 %AddNamedProperty($SIMD, "XXZW", 0xE0, DONT_ENUM | DONT_DELETE | READ_ONLY);
492 %AddNamedProperty($SIMD, "XXWX", 0x30, DONT_ENUM | DONT_DELETE | READ_ONLY);
493 %AddNamedProperty($SIMD, "XXWY", 0x70, DONT_ENUM | DONT_DELETE | READ_ONLY);
494 %AddNamedProperty($SIMD, "XXWZ", 0xB0, DONT_ENUM | DONT_DELETE | READ_ONLY);
495 %AddNamedProperty($SIMD, "XXWW", 0xF0, DONT_ENUM | DONT_DELETE | READ_ONLY);
496 %AddNamedProperty($SIMD, "XYXX", 0x04, DONT_ENUM | DONT_DELETE | READ_ONLY);
497 %AddNamedProperty($SIMD, "XYXY", 0x44, DONT_ENUM | DONT_DELETE | READ_ONLY);
498 %AddNamedProperty($SIMD, "XYXZ", 0x84, DONT_ENUM | DONT_DELETE | READ_ONLY);
499 %AddNamedProperty($SIMD, "XYXW", 0xC4, DONT_ENUM | DONT_DELETE | READ_ONLY);
500 %AddNamedProperty($SIMD, "XYYX", 0x14, DONT_ENUM | DONT_DELETE | READ_ONLY);
501 %AddNamedProperty($SIMD, "XYYY", 0x54, DONT_ENUM | DONT_DELETE | READ_ONLY);
502 %AddNamedProperty($SIMD, "XYYZ", 0x94, DONT_ENUM | DONT_DELETE | READ_ONLY);
503 %AddNamedProperty($SIMD, "XYYW", 0xD4, DONT_ENUM | DONT_DELETE | READ_ONLY);
504 %AddNamedProperty($SIMD, "XYZX", 0x24, DONT_ENUM | DONT_DELETE | READ_ONLY);
505 %AddNamedProperty($SIMD, "XYZY", 0x64, DONT_ENUM | DONT_DELETE | READ_ONLY);
506 %AddNamedProperty($SIMD, "XYZZ", 0xA4, DONT_ENUM | DONT_DELETE | READ_ONLY);
507 %AddNamedProperty($SIMD, "XYZW", 0xE4, DONT_ENUM | DONT_DELETE | READ_ONLY);
508 %AddNamedProperty($SIMD, "XYWX", 0x34, DONT_ENUM | DONT_DELETE | READ_ONLY);
509 %AddNamedProperty($SIMD, "XYWY", 0x74, DONT_ENUM | DONT_DELETE | READ_ONLY);
510 %AddNamedProperty($SIMD, "XYWZ", 0xB4, DONT_ENUM | DONT_DELETE | READ_ONLY);
511 %AddNamedProperty($SIMD, "XYWW", 0xF4, DONT_ENUM | DONT_DELETE | READ_ONLY);
512 %AddNamedProperty($SIMD, "XZXX", 0x08, DONT_ENUM | DONT_DELETE | READ_ONLY);
513 %AddNamedProperty($SIMD, "XZXY", 0x48, DONT_ENUM | DONT_DELETE | READ_ONLY);
514 %AddNamedProperty($SIMD, "XZXZ", 0x88, DONT_ENUM | DONT_DELETE | READ_ONLY);
515 %AddNamedProperty($SIMD, "XZXW", 0xC8, DONT_ENUM | DONT_DELETE | READ_ONLY);
516 %AddNamedProperty($SIMD, "XZYX", 0x18, DONT_ENUM | DONT_DELETE | READ_ONLY);
517 %AddNamedProperty($SIMD, "XZYY", 0x58, DONT_ENUM | DONT_DELETE | READ_ONLY);
518 %AddNamedProperty($SIMD, "XZYZ", 0x98, DONT_ENUM | DONT_DELETE | READ_ONLY);
519 %AddNamedProperty($SIMD, "XZYW", 0xD8, DONT_ENUM | DONT_DELETE | READ_ONLY);
520 %AddNamedProperty($SIMD, "XZZX", 0x28, DONT_ENUM | DONT_DELETE | READ_ONLY);
521 %AddNamedProperty($SIMD, "XZZY", 0x68, DONT_ENUM | DONT_DELETE | READ_ONLY);
522 %AddNamedProperty($SIMD, "XZZZ", 0xA8, DONT_ENUM | DONT_DELETE | READ_ONLY);
523 %AddNamedProperty($SIMD, "XZZW", 0xE8, DONT_ENUM | DONT_DELETE | READ_ONLY);
524 %AddNamedProperty($SIMD, "XZWX", 0x38, DONT_ENUM | DONT_DELETE | READ_ONLY);
525 %AddNamedProperty($SIMD, "XZWY", 0x78, DONT_ENUM | DONT_DELETE | READ_ONLY);
526 %AddNamedProperty($SIMD, "XZWZ", 0xB8, DONT_ENUM | DONT_DELETE | READ_ONLY);
527 %AddNamedProperty($SIMD, "XZWW", 0xF8, DONT_ENUM | DONT_DELETE | READ_ONLY);
528 %AddNamedProperty($SIMD, "XWXX", 0x0C, DONT_ENUM | DONT_DELETE | READ_ONLY);
529 %AddNamedProperty($SIMD, "XWXY", 0x4C, DONT_ENUM | DONT_DELETE | READ_ONLY);
530 %AddNamedProperty($SIMD, "XWXZ", 0x8C, DONT_ENUM | DONT_DELETE | READ_ONLY);
531 %AddNamedProperty($SIMD, "XWXW", 0xCC, DONT_ENUM | DONT_DELETE | READ_ONLY);
532 %AddNamedProperty($SIMD, "XWYX", 0x1C, DONT_ENUM | DONT_DELETE | READ_ONLY);
533 %AddNamedProperty($SIMD, "XWYY", 0x5C, DONT_ENUM | DONT_DELETE | READ_ONLY);
534 %AddNamedProperty($SIMD, "XWYZ", 0x9C, DONT_ENUM | DONT_DELETE | READ_ONLY);
535 %AddNamedProperty($SIMD, "XWYW", 0xDC, DONT_ENUM | DONT_DELETE | READ_ONLY);
536 %AddNamedProperty($SIMD, "XWZX", 0x2C, DONT_ENUM | DONT_DELETE | READ_ONLY);
537 %AddNamedProperty($SIMD, "XWZY", 0x6C, DONT_ENUM | DONT_DELETE | READ_ONLY);
538 %AddNamedProperty($SIMD, "XWZZ", 0xAC, DONT_ENUM | DONT_DELETE | READ_ONLY);
539 %AddNamedProperty($SIMD, "XWZW", 0xEC, DONT_ENUM | DONT_DELETE | READ_ONLY);
540 %AddNamedProperty($SIMD, "XWWX", 0x3C, DONT_ENUM | DONT_DELETE | READ_ONLY);
541 %AddNamedProperty($SIMD, "XWWY", 0x7C, DONT_ENUM | DONT_DELETE | READ_ONLY);
542 %AddNamedProperty($SIMD, "XWWZ", 0xBC, DONT_ENUM | DONT_DELETE | READ_ONLY);
543 %AddNamedProperty($SIMD, "XWWW", 0xFC, DONT_ENUM | DONT_DELETE | READ_ONLY);
544 %AddNamedProperty($SIMD, "YXXX", 0x01, DONT_ENUM | DONT_DELETE | READ_ONLY);
545 %AddNamedProperty($SIMD, "YXXY", 0x41, DONT_ENUM | DONT_DELETE | READ_ONLY);
546 %AddNamedProperty($SIMD, "YXXZ", 0x81, DONT_ENUM | DONT_DELETE | READ_ONLY);
547 %AddNamedProperty($SIMD, "YXXW", 0xC1, DONT_ENUM | DONT_DELETE | READ_ONLY);
548 %AddNamedProperty($SIMD, "YXYX", 0x11, DONT_ENUM | DONT_DELETE | READ_ONLY);
549 %AddNamedProperty($SIMD, "YXYY", 0x51, DONT_ENUM | DONT_DELETE | READ_ONLY);
550 %AddNamedProperty($SIMD, "YXYZ", 0x91, DONT_ENUM | DONT_DELETE | READ_ONLY);
551 %AddNamedProperty($SIMD, "YXYW", 0xD1, DONT_ENUM | DONT_DELETE | READ_ONLY);
552 %AddNamedProperty($SIMD, "YXZX", 0x21, DONT_ENUM | DONT_DELETE | READ_ONLY);
553 %AddNamedProperty($SIMD, "YXZY", 0x61, DONT_ENUM | DONT_DELETE | READ_ONLY);
554 %AddNamedProperty($SIMD, "YXZZ", 0xA1, DONT_ENUM | DONT_DELETE | READ_ONLY);
555 %AddNamedProperty($SIMD, "YXZW", 0xE1, DONT_ENUM | DONT_DELETE | READ_ONLY);
556 %AddNamedProperty($SIMD, "YXWX", 0x31, DONT_ENUM | DONT_DELETE | READ_ONLY);
557 %AddNamedProperty($SIMD, "YXWY", 0x71, DONT_ENUM | DONT_DELETE | READ_ONLY);
558 %AddNamedProperty($SIMD, "YXWZ", 0xB1, DONT_ENUM | DONT_DELETE | READ_ONLY);
559 %AddNamedProperty($SIMD, "YXWW", 0xF1, DONT_ENUM | DONT_DELETE | READ_ONLY);
560 %AddNamedProperty($SIMD, "YYXX", 0x05, DONT_ENUM | DONT_DELETE | READ_ONLY);
561 %AddNamedProperty($SIMD, "YYXY", 0x45, DONT_ENUM | DONT_DELETE | READ_ONLY);
562 %AddNamedProperty($SIMD, "YYXZ", 0x85, DONT_ENUM | DONT_DELETE | READ_ONLY);
563 %AddNamedProperty($SIMD, "YYXW", 0xC5, DONT_ENUM | DONT_DELETE | READ_ONLY);
564 %AddNamedProperty($SIMD, "YYYX", 0x15, DONT_ENUM | DONT_DELETE | READ_ONLY);
565 %AddNamedProperty($SIMD, "YYYY", 0x55, DONT_ENUM | DONT_DELETE | READ_ONLY);
566 %AddNamedProperty($SIMD, "YYYZ", 0x95, DONT_ENUM | DONT_DELETE | READ_ONLY);
567 %AddNamedProperty($SIMD, "YYYW", 0xD5, DONT_ENUM | DONT_DELETE | READ_ONLY);
568 %AddNamedProperty($SIMD, "YYZX", 0x25, DONT_ENUM | DONT_DELETE | READ_ONLY);
569 %AddNamedProperty($SIMD, "YYZY", 0x65, DONT_ENUM | DONT_DELETE | READ_ONLY);
570 %AddNamedProperty($SIMD, "YYZZ", 0xA5, DONT_ENUM | DONT_DELETE | READ_ONLY);
571 %AddNamedProperty($SIMD, "YYZW", 0xE5, DONT_ENUM | DONT_DELETE | READ_ONLY);
572 %AddNamedProperty($SIMD, "YYWX", 0x35, DONT_ENUM | DONT_DELETE | READ_ONLY);
573 %AddNamedProperty($SIMD, "YYWY", 0x75, DONT_ENUM | DONT_DELETE | READ_ONLY);
574 %AddNamedProperty($SIMD, "YYWZ", 0xB5, DONT_ENUM | DONT_DELETE | READ_ONLY);
575 %AddNamedProperty($SIMD, "YYWW", 0xF5, DONT_ENUM | DONT_DELETE | READ_ONLY);
576 %AddNamedProperty($SIMD, "YZXX", 0x09, DONT_ENUM | DONT_DELETE | READ_ONLY);
577 %AddNamedProperty($SIMD, "YZXY", 0x49, DONT_ENUM | DONT_DELETE | READ_ONLY);
578 %AddNamedProperty($SIMD, "YZXZ", 0x89, DONT_ENUM | DONT_DELETE | READ_ONLY);
579 %AddNamedProperty($SIMD, "YZXW", 0xC9, DONT_ENUM | DONT_DELETE | READ_ONLY);
580 %AddNamedProperty($SIMD, "YZYX", 0x19, DONT_ENUM | DONT_DELETE | READ_ONLY);
581 %AddNamedProperty($SIMD, "YZYY", 0x59, DONT_ENUM | DONT_DELETE | READ_ONLY);
582 %AddNamedProperty($SIMD, "YZYZ", 0x99, DONT_ENUM | DONT_DELETE | READ_ONLY);
583 %AddNamedProperty($SIMD, "YZYW", 0xD9, DONT_ENUM | DONT_DELETE | READ_ONLY);
584 %AddNamedProperty($SIMD, "YZZX", 0x29, DONT_ENUM | DONT_DELETE | READ_ONLY);
585 %AddNamedProperty($SIMD, "YZZY", 0x69, DONT_ENUM | DONT_DELETE | READ_ONLY);
586 %AddNamedProperty($SIMD, "YZZZ", 0xA9, DONT_ENUM | DONT_DELETE | READ_ONLY);
587 %AddNamedProperty($SIMD, "YZZW", 0xE9, DONT_ENUM | DONT_DELETE | READ_ONLY);
588 %AddNamedProperty($SIMD, "YZWX", 0x39, DONT_ENUM | DONT_DELETE | READ_ONLY);
589 %AddNamedProperty($SIMD, "YZWY", 0x79, DONT_ENUM | DONT_DELETE | READ_ONLY);
590 %AddNamedProperty($SIMD, "YZWZ", 0xB9, DONT_ENUM | DONT_DELETE | READ_ONLY);
591 %AddNamedProperty($SIMD, "YZWW", 0xF9, DONT_ENUM | DONT_DELETE | READ_ONLY);
592 %AddNamedProperty($SIMD, "YWXX", 0x0D, DONT_ENUM | DONT_DELETE | READ_ONLY);
593 %AddNamedProperty($SIMD, "YWXY", 0x4D, DONT_ENUM | DONT_DELETE | READ_ONLY);
594 %AddNamedProperty($SIMD, "YWXZ", 0x8D, DONT_ENUM | DONT_DELETE | READ_ONLY);
595 %AddNamedProperty($SIMD, "YWXW", 0xCD, DONT_ENUM | DONT_DELETE | READ_ONLY);
596 %AddNamedProperty($SIMD, "YWYX", 0x1D, DONT_ENUM | DONT_DELETE | READ_ONLY);
597 %AddNamedProperty($SIMD, "YWYY", 0x5D, DONT_ENUM | DONT_DELETE | READ_ONLY);
598 %AddNamedProperty($SIMD, "YWYZ", 0x9D, DONT_ENUM | DONT_DELETE | READ_ONLY);
599 %AddNamedProperty($SIMD, "YWYW", 0xDD, DONT_ENUM | DONT_DELETE | READ_ONLY);
600 %AddNamedProperty($SIMD, "YWZX", 0x2D, DONT_ENUM | DONT_DELETE | READ_ONLY);
601 %AddNamedProperty($SIMD, "YWZY", 0x6D, DONT_ENUM | DONT_DELETE | READ_ONLY);
602 %AddNamedProperty($SIMD, "YWZZ", 0xAD, DONT_ENUM | DONT_DELETE | READ_ONLY);
603 %AddNamedProperty($SIMD, "YWZW", 0xED, DONT_ENUM | DONT_DELETE | READ_ONLY);
604 %AddNamedProperty($SIMD, "YWWX", 0x3D, DONT_ENUM | DONT_DELETE | READ_ONLY);
605 %AddNamedProperty($SIMD, "YWWY", 0x7D, DONT_ENUM | DONT_DELETE | READ_ONLY);
606 %AddNamedProperty($SIMD, "YWWZ", 0xBD, DONT_ENUM | DONT_DELETE | READ_ONLY);
607 %AddNamedProperty($SIMD, "YWWW", 0xFD, DONT_ENUM | DONT_DELETE | READ_ONLY);
608 %AddNamedProperty($SIMD, "ZXXX", 0x02, DONT_ENUM | DONT_DELETE | READ_ONLY);
609 %AddNamedProperty($SIMD, "ZXXY", 0x42, DONT_ENUM | DONT_DELETE | READ_ONLY);
610 %AddNamedProperty($SIMD, "ZXXZ", 0x82, DONT_ENUM | DONT_DELETE | READ_ONLY);
611 %AddNamedProperty($SIMD, "ZXXW", 0xC2, DONT_ENUM | DONT_DELETE | READ_ONLY);
612 %AddNamedProperty($SIMD, "ZXYX", 0x12, DONT_ENUM | DONT_DELETE | READ_ONLY);
613 %AddNamedProperty($SIMD, "ZXYY", 0x52, DONT_ENUM | DONT_DELETE | READ_ONLY);
614 %AddNamedProperty($SIMD, "ZXYZ", 0x92, DONT_ENUM | DONT_DELETE | READ_ONLY);
615 %AddNamedProperty($SIMD, "ZXYW", 0xD2, DONT_ENUM | DONT_DELETE | READ_ONLY);
616 %AddNamedProperty($SIMD, "ZXZX", 0x22, DONT_ENUM | DONT_DELETE | READ_ONLY);
617 %AddNamedProperty($SIMD, "ZXZY", 0x62, DONT_ENUM | DONT_DELETE | READ_ONLY);
618 %AddNamedProperty($SIMD, "ZXZZ", 0xA2, DONT_ENUM | DONT_DELETE | READ_ONLY);
619 %AddNamedProperty($SIMD, "ZXZW", 0xE2, DONT_ENUM | DONT_DELETE | READ_ONLY);
620 %AddNamedProperty($SIMD, "ZXWX", 0x32, DONT_ENUM | DONT_DELETE | READ_ONLY);
621 %AddNamedProperty($SIMD, "ZXWY", 0x72, DONT_ENUM | DONT_DELETE | READ_ONLY);
622 %AddNamedProperty($SIMD, "ZXWZ", 0xB2, DONT_ENUM | DONT_DELETE | READ_ONLY);
623 %AddNamedProperty($SIMD, "ZXWW", 0xF2, DONT_ENUM | DONT_DELETE | READ_ONLY);
624 %AddNamedProperty($SIMD, "ZYXX", 0x06, DONT_ENUM | DONT_DELETE | READ_ONLY);
625 %AddNamedProperty($SIMD, "ZYXY", 0x46, DONT_ENUM | DONT_DELETE | READ_ONLY);
626 %AddNamedProperty($SIMD, "ZYXZ", 0x86, DONT_ENUM | DONT_DELETE | READ_ONLY);
627 %AddNamedProperty($SIMD, "ZYXW", 0xC6, DONT_ENUM | DONT_DELETE | READ_ONLY);
628 %AddNamedProperty($SIMD, "ZYYX", 0x16, DONT_ENUM | DONT_DELETE | READ_ONLY);
629 %AddNamedProperty($SIMD, "ZYYY", 0x56, DONT_ENUM | DONT_DELETE | READ_ONLY);
630 %AddNamedProperty($SIMD, "ZYYZ", 0x96, DONT_ENUM | DONT_DELETE | READ_ONLY);
631 %AddNamedProperty($SIMD, "ZYYW", 0xD6, DONT_ENUM | DONT_DELETE | READ_ONLY);
632 %AddNamedProperty($SIMD, "ZYZX", 0x26, DONT_ENUM | DONT_DELETE | READ_ONLY);
633 %AddNamedProperty($SIMD, "ZYZY", 0x66, DONT_ENUM | DONT_DELETE | READ_ONLY);
634 %AddNamedProperty($SIMD, "ZYZZ", 0xA6, DONT_ENUM | DONT_DELETE | READ_ONLY);
635 %AddNamedProperty($SIMD, "ZYZW", 0xE6, DONT_ENUM | DONT_DELETE | READ_ONLY);
636 %AddNamedProperty($SIMD, "ZYWX", 0x36, DONT_ENUM | DONT_DELETE | READ_ONLY);
637 %AddNamedProperty($SIMD, "ZYWY", 0x76, DONT_ENUM | DONT_DELETE | READ_ONLY);
638 %AddNamedProperty($SIMD, "ZYWZ", 0xB6, DONT_ENUM | DONT_DELETE | READ_ONLY);
639 %AddNamedProperty($SIMD, "ZYWW", 0xF6, DONT_ENUM | DONT_DELETE | READ_ONLY);
640 %AddNamedProperty($SIMD, "ZZXX", 0x0A, DONT_ENUM | DONT_DELETE | READ_ONLY);
641 %AddNamedProperty($SIMD, "ZZXY", 0x4A, DONT_ENUM | DONT_DELETE | READ_ONLY);
642 %AddNamedProperty($SIMD, "ZZXZ", 0x8A, DONT_ENUM | DONT_DELETE | READ_ONLY);
643 %AddNamedProperty($SIMD, "ZZXW", 0xCA, DONT_ENUM | DONT_DELETE | READ_ONLY);
644 %AddNamedProperty($SIMD, "ZZYX", 0x1A, DONT_ENUM | DONT_DELETE | READ_ONLY);
645 %AddNamedProperty($SIMD, "ZZYY", 0x5A, DONT_ENUM | DONT_DELETE | READ_ONLY);
646 %AddNamedProperty($SIMD, "ZZYZ", 0x9A, DONT_ENUM | DONT_DELETE | READ_ONLY);
647 %AddNamedProperty($SIMD, "ZZYW", 0xDA, DONT_ENUM | DONT_DELETE | READ_ONLY);
648 %AddNamedProperty($SIMD, "ZZZX", 0x2A, DONT_ENUM | DONT_DELETE | READ_ONLY);
649 %AddNamedProperty($SIMD, "ZZZY", 0x6A, DONT_ENUM | DONT_DELETE | READ_ONLY);
650 %AddNamedProperty($SIMD, "ZZZZ", 0xAA, DONT_ENUM | DONT_DELETE | READ_ONLY);
651 %AddNamedProperty($SIMD, "ZZZW", 0xEA, DONT_ENUM | DONT_DELETE | READ_ONLY);
652 %AddNamedProperty($SIMD, "ZZWX", 0x3A, DONT_ENUM | DONT_DELETE | READ_ONLY);
653 %AddNamedProperty($SIMD, "ZZWY", 0x7A, DONT_ENUM | DONT_DELETE | READ_ONLY);
654 %AddNamedProperty($SIMD, "ZZWZ", 0xBA, DONT_ENUM | DONT_DELETE | READ_ONLY);
655 %AddNamedProperty($SIMD, "ZZWW", 0xFA, DONT_ENUM | DONT_DELETE | READ_ONLY);
656 %AddNamedProperty($SIMD, "ZWXX", 0x0E, DONT_ENUM | DONT_DELETE | READ_ONLY);
657 %AddNamedProperty($SIMD, "ZWXY", 0x4E, DONT_ENUM | DONT_DELETE | READ_ONLY);
658 %AddNamedProperty($SIMD, "ZWXZ", 0x8E, DONT_ENUM | DONT_DELETE | READ_ONLY);
659 %AddNamedProperty($SIMD, "ZWXW", 0xCE, DONT_ENUM | DONT_DELETE | READ_ONLY);
660 %AddNamedProperty($SIMD, "ZWYX", 0x1E, DONT_ENUM | DONT_DELETE | READ_ONLY);
661 %AddNamedProperty($SIMD, "ZWYY", 0x5E, DONT_ENUM | DONT_DELETE | READ_ONLY);
662 %AddNamedProperty($SIMD, "ZWYZ", 0x9E, DONT_ENUM | DONT_DELETE | READ_ONLY);
663 %AddNamedProperty($SIMD, "ZWYW", 0xDE, DONT_ENUM | DONT_DELETE | READ_ONLY);
664 %AddNamedProperty($SIMD, "ZWZX", 0x2E, DONT_ENUM | DONT_DELETE | READ_ONLY);
665 %AddNamedProperty($SIMD, "ZWZY", 0x6E, DONT_ENUM | DONT_DELETE | READ_ONLY);
666 %AddNamedProperty($SIMD, "ZWZZ", 0xAE, DONT_ENUM | DONT_DELETE | READ_ONLY);
667 %AddNamedProperty($SIMD, "ZWZW", 0xEE, DONT_ENUM | DONT_DELETE | READ_ONLY);
668 %AddNamedProperty($SIMD, "ZWWX", 0x3E, DONT_ENUM | DONT_DELETE | READ_ONLY);
669 %AddNamedProperty($SIMD, "ZWWY", 0x7E, DONT_ENUM | DONT_DELETE | READ_ONLY);
670 %AddNamedProperty($SIMD, "ZWWZ", 0xBE, DONT_ENUM | DONT_DELETE | READ_ONLY);
671 %AddNamedProperty($SIMD, "ZWWW", 0xFE, DONT_ENUM | DONT_DELETE | READ_ONLY);
672 %AddNamedProperty($SIMD, "WXXX", 0x03, DONT_ENUM | DONT_DELETE | READ_ONLY);
673 %AddNamedProperty($SIMD, "WXXY", 0x43, DONT_ENUM | DONT_DELETE | READ_ONLY);
674 %AddNamedProperty($SIMD, "WXXZ", 0x83, DONT_ENUM | DONT_DELETE | READ_ONLY);
675 %AddNamedProperty($SIMD, "WXXW", 0xC3, DONT_ENUM | DONT_DELETE | READ_ONLY);
676 %AddNamedProperty($SIMD, "WXYX", 0x13, DONT_ENUM | DONT_DELETE | READ_ONLY);
677 %AddNamedProperty($SIMD, "WXYY", 0x53, DONT_ENUM | DONT_DELETE | READ_ONLY);
678 %AddNamedProperty($SIMD, "WXYZ", 0x93, DONT_ENUM | DONT_DELETE | READ_ONLY);
679 %AddNamedProperty($SIMD, "WXYW", 0xD3, DONT_ENUM | DONT_DELETE | READ_ONLY);
680 %AddNamedProperty($SIMD, "WXZX", 0x23, DONT_ENUM | DONT_DELETE | READ_ONLY);
681 %AddNamedProperty($SIMD, "WXZY", 0x63, DONT_ENUM | DONT_DELETE | READ_ONLY);
682 %AddNamedProperty($SIMD, "WXZZ", 0xA3, DONT_ENUM | DONT_DELETE | READ_ONLY);
683 %AddNamedProperty($SIMD, "WXZW", 0xE3, DONT_ENUM | DONT_DELETE | READ_ONLY);
684 %AddNamedProperty($SIMD, "WXWX", 0x33, DONT_ENUM | DONT_DELETE | READ_ONLY);
685 %AddNamedProperty($SIMD, "WXWY", 0x73, DONT_ENUM | DONT_DELETE | READ_ONLY);
686 %AddNamedProperty($SIMD, "WXWZ", 0xB3, DONT_ENUM | DONT_DELETE | READ_ONLY);
687 %AddNamedProperty($SIMD, "WXWW", 0xF3, DONT_ENUM | DONT_DELETE | READ_ONLY);
688 %AddNamedProperty($SIMD, "WYXX", 0x07, DONT_ENUM | DONT_DELETE | READ_ONLY);
689 %AddNamedProperty($SIMD, "WYXY", 0x47, DONT_ENUM | DONT_DELETE | READ_ONLY);
690 %AddNamedProperty($SIMD, "WYXZ", 0x87, DONT_ENUM | DONT_DELETE | READ_ONLY);
691 %AddNamedProperty($SIMD, "WYXW", 0xC7, DONT_ENUM | DONT_DELETE | READ_ONLY);
692 %AddNamedProperty($SIMD, "WYYX", 0x17, DONT_ENUM | DONT_DELETE | READ_ONLY);
693 %AddNamedProperty($SIMD, "WYYY", 0x57, DONT_ENUM | DONT_DELETE | READ_ONLY);
694 %AddNamedProperty($SIMD, "WYYZ", 0x97, DONT_ENUM | DONT_DELETE | READ_ONLY);
695 %AddNamedProperty($SIMD, "WYYW", 0xD7, DONT_ENUM | DONT_DELETE | READ_ONLY);
696 %AddNamedProperty($SIMD, "WYZX", 0x27, DONT_ENUM | DONT_DELETE | READ_ONLY);
697 %AddNamedProperty($SIMD, "WYZY", 0x67, DONT_ENUM | DONT_DELETE | READ_ONLY);
698 %AddNamedProperty($SIMD, "WYZZ", 0xA7, DONT_ENUM | DONT_DELETE | READ_ONLY);
699 %AddNamedProperty($SIMD, "WYZW", 0xE7, DONT_ENUM | DONT_DELETE | READ_ONLY);
700 %AddNamedProperty($SIMD, "WYWX", 0x37, DONT_ENUM | DONT_DELETE | READ_ONLY);
701 %AddNamedProperty($SIMD, "WYWY", 0x77, DONT_ENUM | DONT_DELETE | READ_ONLY);
702 %AddNamedProperty($SIMD, "WYWZ", 0xB7, DONT_ENUM | DONT_DELETE | READ_ONLY);
703 %AddNamedProperty($SIMD, "WYWW", 0xF7, DONT_ENUM | DONT_DELETE | READ_ONLY);
704 %AddNamedProperty($SIMD, "WZXX", 0x0B, DONT_ENUM | DONT_DELETE | READ_ONLY);
705 %AddNamedProperty($SIMD, "WZXY", 0x4B, DONT_ENUM | DONT_DELETE | READ_ONLY);
706 %AddNamedProperty($SIMD, "WZXZ", 0x8B, DONT_ENUM | DONT_DELETE | READ_ONLY);
707 %AddNamedProperty($SIMD, "WZXW", 0xCB, DONT_ENUM | DONT_DELETE | READ_ONLY);
708 %AddNamedProperty($SIMD, "WZYX", 0x1B, DONT_ENUM | DONT_DELETE | READ_ONLY);
709 %AddNamedProperty($SIMD, "WZYY", 0x5B, DONT_ENUM | DONT_DELETE | READ_ONLY);
710 %AddNamedProperty($SIMD, "WZYZ", 0x9B, DONT_ENUM | DONT_DELETE | READ_ONLY);
711 %AddNamedProperty($SIMD, "WZYW", 0xDB, DONT_ENUM | DONT_DELETE | READ_ONLY);
712 %AddNamedProperty($SIMD, "WZZX", 0x2B, DONT_ENUM | DONT_DELETE | READ_ONLY);
713 %AddNamedProperty($SIMD, "WZZY", 0x6B, DONT_ENUM | DONT_DELETE | READ_ONLY);
714 %AddNamedProperty($SIMD, "WZZZ", 0xAB, DONT_ENUM | DONT_DELETE | READ_ONLY);
715 %AddNamedProperty($SIMD, "WZZW", 0xEB, DONT_ENUM | DONT_DELETE | READ_ONLY);
716 %AddNamedProperty($SIMD, "WZWX", 0x3B, DONT_ENUM | DONT_DELETE | READ_ONLY);
717 %AddNamedProperty($SIMD, "WZWY", 0x7B, DONT_ENUM | DONT_DELETE | READ_ONLY);
718 %AddNamedProperty($SIMD, "WZWZ", 0xBB, DONT_ENUM | DONT_DELETE | READ_ONLY);
719 %AddNamedProperty($SIMD, "WZWW", 0xFB, DONT_ENUM | DONT_DELETE | READ_ONLY);
720 %AddNamedProperty($SIMD, "WWXX", 0x0F, DONT_ENUM | DONT_DELETE | READ_ONLY);
721 %AddNamedProperty($SIMD, "WWXY", 0x4F, DONT_ENUM | DONT_DELETE | READ_ONLY);
722 %AddNamedProperty($SIMD, "WWXZ", 0x8F, DONT_ENUM | DONT_DELETE | READ_ONLY);
723 %AddNamedProperty($SIMD, "WWXW", 0xCF, DONT_ENUM | DONT_DELETE | READ_ONLY);
724 %AddNamedProperty($SIMD, "WWYX", 0x1F, DONT_ENUM | DONT_DELETE | READ_ONLY);
725 %AddNamedProperty($SIMD, "WWYY", 0x5F, DONT_ENUM | DONT_DELETE | READ_ONLY);
726 %AddNamedProperty($SIMD, "WWYZ", 0x9F, DONT_ENUM | DONT_DELETE | READ_ONLY);
727 %AddNamedProperty($SIMD, "WWYW", 0xDF, DONT_ENUM | DONT_DELETE | READ_ONLY);
728 %AddNamedProperty($SIMD, "WWZX", 0x2F, DONT_ENUM | DONT_DELETE | READ_ONLY);
729 %AddNamedProperty($SIMD, "WWZY", 0x6F, DONT_ENUM | DONT_DELETE | READ_ONLY);
730 %AddNamedProperty($SIMD, "WWZZ", 0xAF, DONT_ENUM | DONT_DELETE | READ_ONLY);
731 %AddNamedProperty($SIMD, "WWZW", 0xEF, DONT_ENUM | DONT_DELETE | READ_ONLY);
732 %AddNamedProperty($SIMD, "WWWX", 0x3F, DONT_ENUM | DONT_DELETE | READ_ONLY);
733 %AddNamedProperty($SIMD, "WWWY", 0x7F, DONT_ENUM | DONT_DELETE | READ_ONLY);
734 %AddNamedProperty($SIMD, "WWWZ", 0xBF, DONT_ENUM | DONT_DELETE | READ_ONLY);
735 %AddNamedProperty($SIMD, "WWWW", 0xFF, DONT_ENUM | DONT_DELETE | READ_ONLY);
737 %ToFastProperties($SIMD);
739 // Set up non-enumerable properties of the SIMD float32x4 object.
740 InstallFunctions($SIMD.float32x4, DONT_ENUM, $Array(
741 // Float32x4 operations
742 "load", NotImplementedJS,
743 "loadX", NotImplementedJS,
744 "loadXY", NotImplementedJS,
745 "loadXYZ", NotImplementedJS,
746 "store", NotImplementedJS,
747 "storeX", NotImplementedJS,
748 "storeXY", NotImplementedJS,
749 "storeXYZ", NotImplementedJS,
750 "splat", Float32x4SplatJS,
751 "zero", Float32x4ZeroJS,
753 "abs", Float32x4AbsJS,
754 "fromInt32x4", Int32x4ToFloat32x4JS,
755 "fromInt32x4Bits", Int32x4BitsToFloat32x4JS,
756 "neg", Float32x4NegJS,
757 "reciprocal", Float32x4ReciprocalJS,
758 "reciprocalSqrt", Float32x4ReciprocalSqrtJS,
759 "sqrt", Float32x4SqrtJS,
761 "add", Float32x4AddJS,
762 "div", Float32x4DivJS,
763 "max", Float32x4MaxJS,
764 "min", Float32x4MinJS,
765 "mul", Float32x4MulJS,
766 "sub", Float32x4SubJS,
767 "lessThan", Float32x4LessThanJS,
768 "lessThanOrEqual", Float32x4LessThanOrEqualJS,
769 "equal", Float32x4EqualJS,
770 "notEqual", Float32x4NotEqualJS,
771 "greaterThanOrEqual", Float32x4GreaterThanOrEqualJS,
772 "greaterThan", Float32x4GreaterThanJS,
773 "and", Float32x4AndJS,
775 "xor", Float32x4XorJS,
776 "not", Float32x4NotJS,
777 "scale", Float32x4ScaleJS,
778 "withX", Float32x4WithXJS,
779 "withY", Float32x4WithYJS,
780 "withZ", Float32x4WithZJS,
781 "withW", Float32x4WithWJS,
782 "shuffle", Float32x4ShuffleJS,
784 "clamp", Float32x4ClampJS,
785 "shuffleMix", Float32x4ShuffleMixJS,
786 "select", Float32x4SelectJS
789 // Set up non-enumerable properties of the SIMD float64x2 object.
790 InstallFunctions($SIMD.float64x2, DONT_ENUM, $Array(
791 // Float64x2 operations
792 "load", NotImplementedJS,
793 "loadX", NotImplementedJS,
794 "store", NotImplementedJS,
795 "storeX", NotImplementedJS,
796 "splat", Float64x2SplatJS,
797 "zero", Float64x2ZeroJS,
799 "abs", Float64x2AbsJS,
800 "neg", Float64x2NegJS,
801 "sqrt", Float64x2SqrtJS,
803 "add", Float64x2AddJS,
804 "div", Float64x2DivJS,
805 "max", Float64x2MaxJS,
806 "min", Float64x2MinJS,
807 "mul", Float64x2MulJS,
808 "sub", Float64x2SubJS,
809 "scale", Float64x2ScaleJS,
810 "withX", Float64x2WithXJS,
811 "withY", Float64x2WithYJS,
813 "clamp", Float64x2ClampJS
816 // Set up non-enumerable properties of the SIMD int32x4 object.
817 InstallFunctions($SIMD.int32x4, DONT_ENUM, $Array(
818 // Int32x4 operations
819 "load", NotImplementedJS,
820 "loadX", NotImplementedJS,
821 "loadXY", NotImplementedJS,
822 "loadXYZ", NotImplementedJS,
823 "store", NotImplementedJS,
824 "storeX", NotImplementedJS,
825 "storeXY", NotImplementedJS,
826 "storeXYZ", NotImplementedJS,
827 "zero", Int32x4ZeroJS,
828 "splat", Int32x4SplatJS,
829 "bool", Int32x4BoolJS,
831 "fromFloat32x4", Float32x4ToInt32x4JS,
832 "fromFloat32x4Bits", Float32x4BitsToInt32x4JS,
842 "shuffle", Int32x4ShuffleJS,
843 "withX", Int32x4WithXJS,
844 "withY", Int32x4WithYJS,
845 "withZ", Int32x4WithZJS,
846 "withW", Int32x4WithWJS,
847 "withFlagX", Int32x4WithFlagXJS,
848 "withFlagY", Int32x4WithFlagYJS,
849 "withFlagZ", Int32x4WithFlagZJS,
850 "withFlagW", Int32x4WithFlagWJS,
851 "greaterThan", Int32x4GreaterThanJS,
852 "equal", Int32x4EqualJS,
853 "lessThan", Int32x4LessThanJS,
854 "shiftLeft", Int32x4ShiftLeftJS,
855 "shiftRight", Int32x4ShiftRightJS,
856 "shiftRightArithmetic", Int32x4ShiftRightArithmeticJS,
858 "select", Int32x4SelectJS
864 //------------------------------------------------------------------------------
865 macro SIMD128_TYPED_ARRAYS(FUNCTION)
866 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize.
867 FUNCTION(10, Float32x4Array, 16)
868 FUNCTION(11, Float64x2Array, 16)
869 FUNCTION(12, Int32x4Array, 16)
872 macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
873 function NAMEConstructByArrayBuffer(obj, buffer, byteOffset, length) {
874 if (!IS_UNDEFINED(byteOffset)) {
876 ToPositiveInteger(byteOffset, "invalid_typed_array_length");
878 if (!IS_UNDEFINED(length)) {
879 length = ToPositiveInteger(length, "invalid_typed_array_length");
882 var bufferByteLength = %_ArrayBufferGetByteLength(buffer);
884 if (IS_UNDEFINED(byteOffset)) {
889 if (offset % ELEMENT_SIZE !== 0) {
890 throw MakeRangeError("invalid_typed_array_alignment",
891 ["start offset", "NAME", ELEMENT_SIZE]);
893 if (offset > bufferByteLength) {
894 throw MakeRangeError("invalid_typed_array_offset");
900 if (IS_UNDEFINED(length)) {
901 if (bufferByteLength % ELEMENT_SIZE !== 0) {
902 throw MakeRangeError("invalid_typed_array_alignment",
903 ["byte length", "NAME", ELEMENT_SIZE]);
905 newByteLength = bufferByteLength - offset;
906 newLength = newByteLength / ELEMENT_SIZE;
908 var newLength = length;
909 newByteLength = newLength * ELEMENT_SIZE;
911 if ((offset + newByteLength > bufferByteLength)
912 || (newLength > %_MaxSmi())) {
913 throw MakeRangeError("invalid_typed_array_length");
915 %_TypedArrayInitialize(obj, ARRAY_ID, buffer, offset, newByteLength);
918 function NAMEConstructByLength(obj, length) {
919 var l = IS_UNDEFINED(length) ?
920 0 : ToPositiveInteger(length, "invalid_typed_array_length");
921 if (l > %_MaxSmi()) {
922 throw MakeRangeError("invalid_typed_array_length");
924 var byteLength = l * ELEMENT_SIZE;
925 if (byteLength > %_TypedArrayMaxSizeInHeap()) {
926 var buffer = new $ArrayBuffer(byteLength);
927 %_TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
929 %_TypedArrayInitialize(obj, ARRAY_ID, null, 0, byteLength);
933 function NAMEConstructByArrayLike(obj, arrayLike) {
934 var length = arrayLike.length;
935 var l = ToPositiveInteger(length, "invalid_typed_array_length");
937 if (l > %_MaxSmi()) {
938 throw MakeRangeError("invalid_typed_array_length");
940 if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) {
941 for (var i = 0; i < l; i++) {
942 // It is crucial that we let any execptions from arrayLike[i]
943 // propagate outside the function.
944 obj[i] = arrayLike[i];
949 function NAMEConstructor(arg1, arg2, arg3) {
950 if (%_IsConstructCall()) {
951 if (IS_ARRAYBUFFER(arg1)) {
952 NAMEConstructByArrayBuffer(this, arg1, arg2, arg3);
953 } else if (IS_NUMBER(arg1) || IS_STRING(arg1) ||
954 IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) {
955 NAMEConstructByLength(this, arg1);
957 NAMEConstructByArrayLike(this, arg1);
960 throw MakeTypeError("constructor_not_function", ["NAME"])
964 function NAME_GetBuffer() {
965 if (!(%_ClassOf(this) === 'NAME')) {
966 throw MakeTypeError('incompatible_method_receiver',
967 ["NAME.buffer", this]);
969 return %TypedArrayGetBuffer(this);
972 function NAME_GetByteLength() {
973 if (!(%_ClassOf(this) === 'NAME')) {
974 throw MakeTypeError('incompatible_method_receiver',
975 ["NAME.byteLength", this]);
977 return %_ArrayBufferViewGetByteLength(this);
980 function NAME_GetByteOffset() {
981 if (!(%_ClassOf(this) === 'NAME')) {
982 throw MakeTypeError('incompatible_method_receiver',
983 ["NAME.byteOffset", this]);
985 return %_ArrayBufferViewGetByteOffset(this);
988 function NAME_GetLength() {
989 if (!(%_ClassOf(this) === 'NAME')) {
990 throw MakeTypeError('incompatible_method_receiver',
991 ["NAME.length", this]);
993 return %_TypedArrayGetLength(this);
996 var $NAME = global.NAME;
998 function NAMESubArray(begin, end) {
999 if (!(%_ClassOf(this) === 'NAME')) {
1000 throw MakeTypeError('incompatible_method_receiver',
1001 ["NAME.subarray", this]);
1003 var beginInt = TO_INTEGER(begin);
1004 if (!IS_UNDEFINED(end)) {
1005 end = TO_INTEGER(end);
1008 var srcLength = %_TypedArrayGetLength(this);
1010 beginInt = $MathMax(0, srcLength + beginInt);
1012 beginInt = $MathMin(srcLength, beginInt);
1015 var endInt = IS_UNDEFINED(end) ? srcLength : end;
1017 endInt = $MathMax(0, srcLength + endInt);
1019 endInt = $MathMin(endInt, srcLength);
1021 if (endInt < beginInt) {
1024 var newLength = endInt - beginInt;
1025 var beginByteOffset =
1026 %_ArrayBufferViewGetByteOffset(this) + beginInt * ELEMENT_SIZE;
1027 return new $NAME(%TypedArrayGetBuffer(this),
1028 beginByteOffset, newLength);
1032 SIMD128_TYPED_ARRAYS(TYPED_ARRAY_CONSTRUCTOR)
1034 function SetupSIMD128TypedArrays() {
1035 macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
1036 %CheckIsBootstrapping();
1037 %SetCode(global.NAME, NAMEConstructor);
1038 %FunctionSetPrototype(global.NAME, new $Object());
1040 %AddNamedProperty(global.NAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE,
1041 READ_ONLY | DONT_ENUM | DONT_DELETE);
1042 %AddNamedProperty(global.NAME.prototype,
1043 "constructor", global.NAME, DONT_ENUM);
1044 %AddNamedProperty(global.NAME.prototype,
1045 "BYTES_PER_ELEMENT", ELEMENT_SIZE,
1046 READ_ONLY | DONT_ENUM | DONT_DELETE);
1047 InstallGetter(global.NAME.prototype, "buffer", NAME_GetBuffer);
1048 InstallGetter(global.NAME.prototype, "byteOffset", NAME_GetByteOffset);
1049 InstallGetter(global.NAME.prototype, "byteLength", NAME_GetByteLength);
1050 InstallGetter(global.NAME.prototype, "length", NAME_GetLength);
1052 InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array(
1053 "subarray", NAMESubArray,
1054 "set", TypedArraySet
1058 SIMD128_TYPED_ARRAYS(SETUP_TYPED_ARRAY)
1061 SetupSIMD128TypedArrays();
1063 macro DECLARE_TYPED_ARRAY_FUNCTION(NAME)
1064 function NAMEArrayGet(i) {
1068 function NAMEArraySet(i, v) {
1073 function SetUpNAMEArray() {
1074 InstallFunctions(global.NAMEArray.prototype, DONT_ENUM, $Array(
1075 "getAt", NAMEArrayGet,
1076 "setAt", NAMEArraySet
1081 DECLARE_TYPED_ARRAY_FUNCTION(Float32x4)
1082 DECLARE_TYPED_ARRAY_FUNCTION(Float64x2)
1083 DECLARE_TYPED_ARRAY_FUNCTION(Int32x4)
1085 SetUpFloat32x4Array();
1086 SetUpFloat64x2Array();
1087 SetUpInt32x4Array();
1089 // --------------------SIMD128 Access in Typed Array -----------------
1090 var $Uint8Array = global.Uint8Array;
1091 var $Int8Array = global.Int8Array;
1092 var $Uint16Array = global.Uint16Array;
1093 var $Int16Array = global.Int16Array;
1094 var $Uint32Array = global.Uint32Array;
1095 var $Int32Array = global.Int32Array;
1096 var $Float32Array = global.Float32Array;
1097 var $Float64Array = global.Float64Array;
1099 macro DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, TYPE, LANES, NBYTES)
1100 function VIEWGetTYPELANESJS(index) {
1101 if (!(%_ClassOf(this) === 'VIEW')) {
1102 throw MakeTypeError('incompatible_method_receiver',
1103 ["VIEW._getTYPELANES", this]);
1106 if (%_ArgumentsLength() < 1) {
1107 throw MakeTypeError('invalid_argument');
1109 if (!IS_NUMBER(index)) {
1110 throw MakeTypeError('The 2nd argument must be a Number.');
1112 var offset = TO_INTEGER(index) * tarray.BYTES_PER_ELEMENT;
1113 if (offset < 0 || (offset + NBYTES) > tarray.byteLength)
1114 throw MakeRangeError('The value of index is invalid.');
1115 var arraybuffer = tarray.buffer;
1116 return %TYPELoadLANES(arraybuffer, offset);
1119 function VIEWSetTYPELANESJS(index, value) {
1120 if (!(%_ClassOf(this) === 'VIEW')) {
1121 throw MakeTypeError('incompatible_method_receiver',
1122 ["VIEW._setTYPELANES", this]);
1125 if (%_ArgumentsLength() < 2) {
1126 throw MakeTypeError('invalid_argument');
1128 if (!IS_NUMBER(index)) {
1129 throw MakeTypeError('The 2nd argument must be a Number.');
1132 var offset = TO_INTEGER(index) * tarray.BYTES_PER_ELEMENT;
1133 if (offset < 0 || (offset + NBYTES) > tarray.byteLength)
1134 throw MakeRangeError('The value of index is invalid.');
1135 var arraybuffer = tarray.buffer;
1136 %TYPEStoreLANES(arraybuffer, offset, value);
1140 macro DECLARE_VIEW_SIMD_LOAD_AND_STORE_FUNCTION(VIEW)
1141 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Float32x4, XYZW, 12)
1142 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Float32x4, XYZ, 12)
1143 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Float32x4, XY, 8)
1144 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Float32x4, X, 4)
1145 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Float64x2, XY, 16)
1146 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Float64x2, X, 8)
1147 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Int32x4, XYZW, 16)
1148 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Int32x4, XYZ, 12)
1149 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Int32x4, XY, 8)
1150 DECLARE_TYPED_ARRAY_SIMD_LOAD_AND_STORE_FUNCTION(VIEW, Int32x4, X, 4)
1153 DECLARE_VIEW_SIMD_LOAD_AND_STORE_FUNCTION(Uint8Array)
1154 DECLARE_VIEW_SIMD_LOAD_AND_STORE_FUNCTION(Int8Array)
1155 DECLARE_VIEW_SIMD_LOAD_AND_STORE_FUNCTION(Uint16Array)
1156 DECLARE_VIEW_SIMD_LOAD_AND_STORE_FUNCTION(Int16Array)
1157 DECLARE_VIEW_SIMD_LOAD_AND_STORE_FUNCTION(Uint32Array)
1158 DECLARE_VIEW_SIMD_LOAD_AND_STORE_FUNCTION(Int32Array)
1159 DECLARE_VIEW_SIMD_LOAD_AND_STORE_FUNCTION(Float32Array)
1160 DECLARE_VIEW_SIMD_LOAD_AND_STORE_FUNCTION(Float64Array)
1162 function SetupTypedArraysSimdLoadStore() {
1163 %CheckIsBootstrapping();
1165 macro DECLARE_INSTALL_SIMD_LOAD_AND_STORE_FUNCTION(VIEW)
1166 InstallFunctions($VIEW.prototype, DONT_ENUM, $Array(
1167 "_getFloat32x4X", VIEWGetFloat32x4XJS,
1168 "_setFloat32x4X", VIEWSetFloat32x4XJS,
1169 "_getFloat32x4XY", VIEWGetFloat32x4XYJS,
1170 "_setFloat32x4XY", VIEWSetFloat32x4XYJS,
1171 "_getFloat32x4XYZ", VIEWGetFloat32x4XYZJS,
1172 "_setFloat32x4XYZ", VIEWSetFloat32x4XYZJS,
1173 "_getFloat32x4XYZW", VIEWGetFloat32x4XYZWJS,
1174 "_setFloat32x4XYZW", VIEWSetFloat32x4XYZWJS,
1175 "_getFloat64x2X", VIEWGetFloat64x2XJS,
1176 "_setFloat64x2X", VIEWSetFloat64x2XJS,
1177 "_getFloat64x2XY", VIEWGetFloat64x2XYJS,
1178 "_setFloat64x2XY", VIEWSetFloat64x2XYJS,
1179 "_getInt32x4X", VIEWGetInt32x4XJS,
1180 "_setInt32x4X", VIEWSetInt32x4XJS,
1181 "_getInt32x4XY", VIEWGetInt32x4XYJS,
1182 "_setInt32x4XY", VIEWSetInt32x4XYJS,
1183 "_getInt32x4XYZ", VIEWGetInt32x4XYZJS,
1184 "_setInt32x4XYZ", VIEWSetInt32x4XYZJS,
1185 "_getInt32x4XYZW", VIEWGetInt32x4XYZWJS,
1186 "_setInt32x4XYZW", VIEWSetInt32x4XYZWJS
1190 DECLARE_INSTALL_SIMD_LOAD_AND_STORE_FUNCTION(Uint8Array)
1191 DECLARE_INSTALL_SIMD_LOAD_AND_STORE_FUNCTION(Int8Array)
1192 DECLARE_INSTALL_SIMD_LOAD_AND_STORE_FUNCTION(Uint16Array)
1193 DECLARE_INSTALL_SIMD_LOAD_AND_STORE_FUNCTION(Int16Array)
1194 DECLARE_INSTALL_SIMD_LOAD_AND_STORE_FUNCTION(Uint32Array)
1195 DECLARE_INSTALL_SIMD_LOAD_AND_STORE_FUNCTION(Int32Array)
1196 DECLARE_INSTALL_SIMD_LOAD_AND_STORE_FUNCTION(Float32Array)
1197 DECLARE_INSTALL_SIMD_LOAD_AND_STORE_FUNCTION(Float64Array)
1200 SetupTypedArraysSimdLoadStore();