Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / v8 / src / simd128.js
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
4 // met:
5 //
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.
15 //
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.
27
28 "use strict";
29
30 // This file relies on the fact that the following declaration has been made
31 // in runtime.js:
32 // var $Array = global.Array;
33
34 var $SIMD = global.SIMD;
35 var $Float32x4 = $SIMD.float32x4;
36 var $Float64x2 = $SIMD.float64x2;
37 var $Int32x4 = $SIMD.int32x4;
38
39 macro SIMD128_DATA_TYPES(FUNCTION)
40 FUNCTION(Float32x4, float32x4)
41 FUNCTION(Float64x2, float64x2)
42 FUNCTION(Int32x4, int32x4)
43 endmacro
44
45 function StringfyFloat32x4(f4) {
46   return "float32x4(" + f4.x + "," + f4.y + "," + f4.z + "," + f4.w + ")";
47 }
48
49 function StringfyFloat64x2(d2) {
50   return "float64x2(" + d2.x + "," + d2.y + ")";
51 }
52
53 function StringfyInt32x4(i4) {
54   return "int32x4(" + i4.x + "," + i4.y + "," + i4.z + "," + i4.w + ")";
55 }
56
57 macro DECLARE_DATA_TYPE_COMMON_FUNCTION(NAME, TYPE)
58 function ThrowNAMETypeError() {
59   throw MakeTypeError("this is not a TYPE value.");
60 }
61
62 function NAMEToString() {
63   if (IsNAMEWrapper(this)) {
64     return ObjectToString.apply(this);
65   } else if (IsNAME(this)) {
66     return StringfyNAME(this);
67   } else {
68     throw MakeTypeError('TYPE_to_string');
69   }
70 }
71
72 function NAMEValueOf() {
73   if (!IsNAME(this) && !IsNAMEWrapper(this)) {
74     ThrowNAMETypeError();
75   }
76   return %_ValueOf(this);
77 }
78 endmacro
79
80 SIMD128_DATA_TYPES(DECLARE_DATA_TYPE_COMMON_FUNCTION)
81
82 macro SIMD128_DATA_TYPE_FUNCTIONS(FUNCTION)
83 FUNCTION(Float32x4, GetX)
84 FUNCTION(Float32x4, GetY)
85 FUNCTION(Float32x4, GetZ)
86 FUNCTION(Float32x4, GetW)
87 FUNCTION(Float32x4, GetSignMask)
88 FUNCTION(Float64x2, GetX)
89 FUNCTION(Float64x2, GetY)
90 FUNCTION(Float64x2, GetSignMask)
91 FUNCTION(Int32x4, GetX)
92 FUNCTION(Int32x4, GetY)
93 FUNCTION(Int32x4, GetZ)
94 FUNCTION(Int32x4, GetW)
95 FUNCTION(Int32x4, GetFlagX)
96 FUNCTION(Int32x4, GetFlagY)
97 FUNCTION(Int32x4, GetFlagZ)
98 FUNCTION(Int32x4, GetFlagW)
99 FUNCTION(Int32x4, GetSignMask)
100 endmacro
101
102 macro DECLARE_DATA_TYPE_FUNCTION(TYPE, FUNCTION)
103 function TYPEFUNCTION() {
104   var x4 = ToTYPE(this);
105   CheckTYPE(x4);
106   return %TYPEFUNCTION(x4);
107 }
108 endmacro
109
110 SIMD128_DATA_TYPE_FUNCTIONS(DECLARE_DATA_TYPE_FUNCTION)
111
112 function Float32x4Constructor(x, y, z, w) {
113   x = TO_NUMBER_INLINE(x);
114   y = TO_NUMBER_INLINE(y);
115   z = TO_NUMBER_INLINE(z);
116   w = TO_NUMBER_INLINE(w);
117
118   var value = %CreateFloat32x4(x, y, z, w);
119   if (%_IsConstructCall()) {
120     %_SetValueOf(this, value);
121   } else {
122     return value;
123   }
124 }
125
126 function Float64x2Constructor(x, y) {
127   x = TO_NUMBER_INLINE(x);
128   y = TO_NUMBER_INLINE(y);
129
130   var value = %CreateFloat64x2(x, y);
131   if (%_IsConstructCall()) {
132     %_SetValueOf(this, value);
133   } else {
134     return value;
135   }
136 }
137
138 function Int32x4Constructor(x, y, z, w) {
139   x = TO_INT32(x);
140   y = TO_INT32(y);
141   z = TO_INT32(z);
142   w = TO_INT32(w);
143
144   var value = %CreateInt32x4(x, y, z, w);
145   if (%_IsConstructCall()) {
146     %_SetValueOf(this, value);
147   } else {
148     return value;
149   }
150 }
151
152 function SetUpFloat32x4() {
153   %CheckIsBootstrapping();
154
155   %SetCode($Float32x4, Float32x4Constructor);
156
157   %FunctionSetPrototype($Float32x4, new $Float32x4(0.0, 0.0, 0.0, 0.0));
158   %SetProperty($Float32x4.prototype, "constructor", $Float32x4, DONT_ENUM);
159
160   InstallGetter($Float32x4.prototype, "x", Float32x4GetX);
161   InstallGetter($Float32x4.prototype, "y", Float32x4GetY);
162   InstallGetter($Float32x4.prototype, "z", Float32x4GetZ);
163   InstallGetter($Float32x4.prototype, "w", Float32x4GetW);
164   InstallGetter($Float32x4.prototype, "signMask", Float32x4GetSignMask);
165   InstallFunctions($Float32x4.prototype, DONT_ENUM, $Array(
166     "toString", Float32x4ToString,
167     "valueOf", Float32x4ValueOf
168   ));
169 }
170
171 function SetUpFloat64x2() {
172   %CheckIsBootstrapping();
173
174   %SetCode($Float64x2, Float64x2Constructor);
175
176   %FunctionSetPrototype($Float64x2, new $Float64x2(0.0, 0.0));
177   %SetProperty($Float64x2.prototype, "constructor", $Float64x2, DONT_ENUM);
178
179   InstallGetter($Float64x2.prototype, "x", Float64x2GetX);
180   InstallGetter($Float64x2.prototype, "y", Float64x2GetY);
181   InstallGetter($Float64x2.prototype, "signMask", Float64x2GetSignMask);
182   InstallFunctions($Float64x2.prototype, DONT_ENUM, $Array(
183     "toString", Float64x2ToString,
184     "valueOf", Float64x2ValueOf
185   ));
186 }
187
188 function SetUpInt32x4() {
189   %CheckIsBootstrapping();
190
191   %SetCode($Int32x4, Int32x4Constructor);
192
193   %FunctionSetPrototype($Int32x4, new $Int32x4(0, 0, 0, 0));
194   %SetProperty($Int32x4.prototype, "constructor", $Int32x4, DONT_ENUM);
195
196   InstallGetter($Int32x4.prototype, "x", Int32x4GetX);
197   InstallGetter($Int32x4.prototype, "y", Int32x4GetY);
198   InstallGetter($Int32x4.prototype, "z", Int32x4GetZ);
199   InstallGetter($Int32x4.prototype, "w", Int32x4GetW);
200   InstallGetter($Int32x4.prototype, "flagX", Int32x4GetFlagX);
201   InstallGetter($Int32x4.prototype, "flagY", Int32x4GetFlagY);
202   InstallGetter($Int32x4.prototype, "flagZ", Int32x4GetFlagZ);
203   InstallGetter($Int32x4.prototype, "flagW", Int32x4GetFlagW);
204   InstallGetter($Int32x4.prototype, "signMask", Int32x4GetSignMask);
205   InstallFunctions($Int32x4.prototype, DONT_ENUM, $Array(
206     "toString", Int32x4ToString,
207     "valueOf", Int32x4ValueOf
208   ));
209 }
210
211 SetUpFloat32x4();
212 SetUpFloat64x2();
213 SetUpInt32x4();
214
215 //------------------------------------------------------------------------------
216
217 macro SIMD128_UNARY_FUNCTIONS(FUNCTION)
218 FUNCTION(Float32x4, Abs)
219 FUNCTION(Float32x4, BitsToInt32x4)
220 FUNCTION(Float32x4, Neg)
221 FUNCTION(Float32x4, Reciprocal)
222 FUNCTION(Float32x4, ReciprocalSqrt)
223 FUNCTION(Float32x4, Sqrt)
224 FUNCTION(Float32x4, ToInt32x4)
225 FUNCTION(Float64x2, Abs)
226 FUNCTION(Float64x2, Neg)
227 FUNCTION(Float64x2, Sqrt)
228 FUNCTION(Int32x4, BitsToFloat32x4)
229 FUNCTION(Int32x4, Neg)
230 FUNCTION(Int32x4, Not)
231 FUNCTION(Int32x4, ToFloat32x4)
232 endmacro
233
234 macro SIMD128_BINARY_FUNCTIONS(FUNCTION)
235 FUNCTION(Float32x4, Add)
236 FUNCTION(Float32x4, Div)
237 FUNCTION(Float32x4, Max)
238 FUNCTION(Float32x4, Min)
239 FUNCTION(Float32x4, Mul)
240 FUNCTION(Float32x4, Sub)
241 FUNCTION(Float32x4, Equal)
242 FUNCTION(Float32x4, NotEqual)
243 FUNCTION(Float32x4, GreaterThanOrEqual)
244 FUNCTION(Float32x4, GreaterThan)
245 FUNCTION(Float32x4, LessThan)
246 FUNCTION(Float32x4, LessThanOrEqual)
247 FUNCTION(Float64x2, Add)
248 FUNCTION(Float64x2, Div)
249 FUNCTION(Float64x2, Max)
250 FUNCTION(Float64x2, Min)
251 FUNCTION(Float64x2, Mul)
252 FUNCTION(Float64x2, Sub)
253 FUNCTION(Int32x4, Add)
254 FUNCTION(Int32x4, And)
255 FUNCTION(Int32x4, Mul)
256 FUNCTION(Int32x4, Or)
257 FUNCTION(Int32x4, Sub)
258 FUNCTION(Int32x4, Xor)
259 FUNCTION(Int32x4, Equal)
260 FUNCTION(Int32x4, GreaterThan)
261 FUNCTION(Int32x4, LessThan)
262 endmacro
263
264 macro SIMD128_BINARY_SHUFFLE_FUNCTIONS(FUNCTION)
265 FUNCTION(Float32x4)
266 FUNCTION(Int32x4)
267 endmacro
268
269 macro FLOAT32x4_BINARY_FUNCTIONS_WITH_FLOAT32_PARAMETER(FUNCTION)
270 FUNCTION(Scale)
271 FUNCTION(WithX)
272 FUNCTION(WithY)
273 FUNCTION(WithZ)
274 FUNCTION(WithW)
275 endmacro
276
277 macro FLOAT64x2_BINARY_FUNCTIONS_WITH_FLOAT64_PARAMETER(FUNCTION)
278 FUNCTION(Scale)
279 FUNCTION(WithX)
280 FUNCTION(WithY)
281 endmacro
282
283 macro INT32x4_BINARY_FUNCTIONS_WITH_INT32_PARAMETER(FUNCTION)
284 FUNCTION(WithX)
285 FUNCTION(WithY)
286 FUNCTION(WithZ)
287 FUNCTION(WithW)
288 endmacro
289
290 macro INT32x4_BINARY_FUNCTIONS_WITH_BOOLEAN_PARAMETER(FUNCTION)
291 FUNCTION(WithFlagX)
292 FUNCTION(WithFlagY)
293 FUNCTION(WithFlagZ)
294 FUNCTION(WithFlagW)
295 endmacro
296
297 macro DECLARE_SIMD_UNARY_FUNCTION(TYPE, FUNCTION)
298 function TYPEFUNCTION(x4) {
299   x4 = ToTYPE(x4);
300   CheckTYPE(x4);
301   return %TYPEFUNCTION(x4);
302 }
303 endmacro
304
305 macro DECLARE_SIMD_BINARY_FUNCTION(TYPE, FUNCTION)
306 function TYPEFUNCTION(a4, b4) {
307   a4 = ToTYPE(a4);
308   CheckTYPE(a4);
309   b4 = ToTYPE(b4);
310   CheckTYPE(b4);
311   return %TYPEFUNCTION(a4, b4);
312 }
313 endmacro
314
315 macro DECLARE_SIMD_BINARY_SHUFFLE_FUNCTION(TYPE)
316 function TYPEShuffle(x4, mask) {
317   x4 = ToTYPE(x4);
318   CheckTYPE(x4);
319   var value = TO_INT32(mask);
320   if ((value < 0) || (value > 0xFF)) {
321     throw MakeRangeError("invalid_simd_shuffle_mask");
322   }
323   return %TYPEShuffle(x4, mask);
324 }
325 endmacro
326
327 macro DECLARE_FLOAT32x4_BINARY_FUNCTION_WITH_FLOAT32_PARAMETER(FUNCTION)
328 function Float32x4FUNCTION(x4, f) {
329   x4 = ToFloat32x4(x4);
330   CheckFloat32x4(x4);
331   f = TO_NUMBER_INLINE(f);
332   return %Float32x4FUNCTION(x4, f);
333 }
334 endmacro
335
336 macro DECLARE_FLOAT64x2_BINARY_FUNCTION_WITH_FLOAT64_PARAMETER(FUNCTION)
337 function Float64x2FUNCTION(x2, f) {
338   x2 = ToFloat64x2(x2);
339   CheckFloat64x2(x2);
340   f = TO_NUMBER_INLINE(f);
341   return %Float64x2FUNCTION(x2, f);
342 }
343 endmacro
344
345 macro DECLARE_INT32x4_BINARY_FUNCTION_WITH_INT32_PARAMETER(FUNCTION)
346 function Int32x4FUNCTION(x4, i) {
347   x4 = ToInt32x4(x4);
348   CheckInt32x4(x4);
349   i = TO_INT32(i);
350   return %Int32x4FUNCTION(x4, i);
351 }
352 endmacro
353
354 macro DECLARE_INT32x4_BINARY_FUNCTION_WITH_BOOLEAN_PARAMETER(FUNCTION)
355 function Int32x4FUNCTION(x4, b) {
356   x4 = ToInt32x4(x4);
357   CheckInt32x4(x4);
358   b = ToBoolean(b);
359   return %Int32x4FUNCTION(x4, b);
360 }
361 endmacro
362
363 SIMD128_UNARY_FUNCTIONS(DECLARE_SIMD_UNARY_FUNCTION)
364 SIMD128_BINARY_FUNCTIONS(DECLARE_SIMD_BINARY_FUNCTION)
365 SIMD128_BINARY_SHUFFLE_FUNCTIONS(DECLARE_SIMD_BINARY_SHUFFLE_FUNCTION)
366 FLOAT32x4_BINARY_FUNCTIONS_WITH_FLOAT32_PARAMETER(DECLARE_FLOAT32x4_BINARY_FUNCTION_WITH_FLOAT32_PARAMETER)
367 FLOAT64x2_BINARY_FUNCTIONS_WITH_FLOAT64_PARAMETER(DECLARE_FLOAT64x2_BINARY_FUNCTION_WITH_FLOAT64_PARAMETER)
368 INT32x4_BINARY_FUNCTIONS_WITH_INT32_PARAMETER(DECLARE_INT32x4_BINARY_FUNCTION_WITH_INT32_PARAMETER)
369 INT32x4_BINARY_FUNCTIONS_WITH_BOOLEAN_PARAMETER(DECLARE_INT32x4_BINARY_FUNCTION_WITH_BOOLEAN_PARAMETER)
370
371 function Float32x4Splat(f) {
372   f = TO_NUMBER_INLINE(f);
373   return %CreateFloat32x4(f, f, f, f);
374 }
375
376 function Float32x4Zero() {
377   return %CreateFloat32x4(0.0, 0.0, 0.0, 0.0);
378 }
379
380 function Float32x4And(a4, b4) {
381   a4 = Float32x4BitsToInt32x4(a4);
382   b4 = Float32x4BitsToInt32x4(b4);
383   return Int32x4BitsToFloat32x4(Int32x4And(a4, b4));
384 }
385
386 function Float32x4Or(a4, b4) {
387   a4 = Float32x4BitsToInt32x4(a4);
388   b4 = Float32x4BitsToInt32x4(b4);
389   return Int32x4BitsToFloat32x4(Int32x4Or(a4, b4));
390 }
391
392 function Float32x4XOr(a4, b4) {
393   a4 = Float32x4BitsToInt32x4(a4);
394   b4 = Float32x4BitsToInt32x4(b4);
395   return Int32x4BitsToFloat32x4(Int32x4Xor(a4, b4));
396 }
397
398 function Float32x4Not(x4) {
399   x4 = Float32x4BitsToInt32x4(x4);
400   return Int32x4BitsToFloat32x4(Int32x4Not(x4));
401 }
402
403 function Float32x4Clamp(x4, lowerLimit, upperLimit) {
404   x4 = ToFloat32x4(x4);
405   CheckFloat32x4(x4);
406   lowerLimit = ToFloat32x4(lowerLimit);
407   CheckFloat32x4(lowerLimit);
408   upperLimit = ToFloat32x4(upperLimit);
409   CheckFloat32x4(upperLimit);
410   return %Float32x4Clamp(x4, lowerLimit, upperLimit);
411 }
412
413 function Float32x4ShuffleMix(a4, b4, mask) {
414   a4 = ToFloat32x4(a4);
415   CheckFloat32x4(a4);
416   b4 = ToFloat32x4(b4);
417   CheckFloat32x4(b4);
418   var value = TO_INT32(mask);
419   if ((value < 0) || (value > 0xFF)) {
420     throw MakeRangeError("invalid_simd_shuffleMix_mask");
421   }
422   return %Float32x4ShuffleMix(a4, b4, mask);
423 }
424
425 function Float64x2Splat(f) {
426   f = TO_NUMBER_INLINE(f);
427   return %CreateFloat64x2(f, f);
428 }
429
430 function Float64x2Zero() {
431   return %CreateFloat64x2(0.0, 0.0);
432 }
433
434 function Float64x2Clamp(x2, lowerLimit, upperLimit) {
435   x2 = ToFloat64x2(x2);
436   CheckFloat64x2(x2);
437   lowerLimit = ToFloat64x2(lowerLimit);
438   CheckFloat64x2(lowerLimit);
439   upperLimit = ToFloat64x2(upperLimit);
440   CheckFloat64x2(upperLimit);
441   return %Float64x2Clamp(x2, lowerLimit, upperLimit);
442 }
443
444 function Int32x4Zero() {
445   return %CreateInt32x4(0, 0, 0, 0);
446 }
447
448 function Int32x4Bool(x, y, z, w) {
449   x = x ? -1 : 0;
450   y = y ? -1 : 0;
451   z = z ? -1 : 0;
452   w = w ? -1 : 0;
453   return %CreateInt32x4(x, y, z, w);
454 }
455
456 function Int32x4Splat(s) {
457   s = TO_INT32(s);
458   return %CreateInt32x4(s, s, s, s);
459 }
460
461 function Int32x4Select(x4, trueValue, falseValue) {
462   x4 = ToInt32x4(x4);
463   CheckInt32x4(x4);
464   trueValue = ToFloat32x4(trueValue);
465   CheckFloat32x4(trueValue);
466   falseValue = ToFloat32x4(falseValue);
467   CheckFloat32x4(falseValue);
468   return %Int32x4Select(x4, trueValue, falseValue);
469 }
470
471 function Int32x4ShiftLeft(t, s) {
472   t = ToInt32x4(t);
473   CheckInt32x4(t);
474   s = TO_NUMBER_INLINE(s);
475   var x = t.x << s;
476   var y = t.y << s;
477   var z = t.z << s;
478   var w = t.w << s;
479   return %CreateInt32x4(x, y, z, w);
480 }
481
482 function Int32x4ShiftRight(t, s) {
483   t = ToInt32x4(t);
484   CheckInt32x4(t);
485   s = TO_NUMBER_INLINE(s);
486   var x = t.x >>> s;
487   var y = t.y >>> s;
488   var z = t.z >>> s;
489   var w = t.w >>> s;
490   return %CreateInt32x4(x, y, z, w);
491 }
492
493 function Int32x4ShiftRightArithmetic(t, s) {
494   t = ToInt32x4(t);
495   CheckInt32x4(t);
496   s = TO_NUMBER_INLINE(s);
497   var x = t.x >> s;
498   var y = t.y >> s;
499   var z = t.z >> s;
500   var w = t.w >> s;
501   return %CreateInt32x4(x, y, z, w);
502 }
503
504 function SetUpSIMD() {
505   %CheckIsBootstrapping();
506
507   %OptimizeObjectForAddingMultipleProperties($SIMD, 258);
508   %SetProperty($SIMD, "XXXX", 0x00, DONT_ENUM | DONT_DELETE | READ_ONLY);
509   %SetProperty($SIMD, "XXXY", 0x40, DONT_ENUM | DONT_DELETE | READ_ONLY);
510   %SetProperty($SIMD, "XXXZ", 0x80, DONT_ENUM | DONT_DELETE | READ_ONLY);
511   %SetProperty($SIMD, "XXXW", 0xC0, DONT_ENUM | DONT_DELETE | READ_ONLY);
512   %SetProperty($SIMD, "XXYX", 0x10, DONT_ENUM | DONT_DELETE | READ_ONLY);
513   %SetProperty($SIMD, "XXYY", 0x50, DONT_ENUM | DONT_DELETE | READ_ONLY);
514   %SetProperty($SIMD, "XXYZ", 0x90, DONT_ENUM | DONT_DELETE | READ_ONLY);
515   %SetProperty($SIMD, "XXYW", 0xD0, DONT_ENUM | DONT_DELETE | READ_ONLY);
516   %SetProperty($SIMD, "XXZX", 0x20, DONT_ENUM | DONT_DELETE | READ_ONLY);
517   %SetProperty($SIMD, "XXZY", 0x60, DONT_ENUM | DONT_DELETE | READ_ONLY);
518   %SetProperty($SIMD, "XXZZ", 0xA0, DONT_ENUM | DONT_DELETE | READ_ONLY);
519   %SetProperty($SIMD, "XXZW", 0xE0, DONT_ENUM | DONT_DELETE | READ_ONLY);
520   %SetProperty($SIMD, "XXWX", 0x30, DONT_ENUM | DONT_DELETE | READ_ONLY);
521   %SetProperty($SIMD, "XXWY", 0x70, DONT_ENUM | DONT_DELETE | READ_ONLY);
522   %SetProperty($SIMD, "XXWZ", 0xB0, DONT_ENUM | DONT_DELETE | READ_ONLY);
523   %SetProperty($SIMD, "XXWW", 0xF0, DONT_ENUM | DONT_DELETE | READ_ONLY);
524   %SetProperty($SIMD, "XYXX", 0x04, DONT_ENUM | DONT_DELETE | READ_ONLY);
525   %SetProperty($SIMD, "XYXY", 0x44, DONT_ENUM | DONT_DELETE | READ_ONLY);
526   %SetProperty($SIMD, "XYXZ", 0x84, DONT_ENUM | DONT_DELETE | READ_ONLY);
527   %SetProperty($SIMD, "XYXW", 0xC4, DONT_ENUM | DONT_DELETE | READ_ONLY);
528   %SetProperty($SIMD, "XYYX", 0x14, DONT_ENUM | DONT_DELETE | READ_ONLY);
529   %SetProperty($SIMD, "XYYY", 0x54, DONT_ENUM | DONT_DELETE | READ_ONLY);
530   %SetProperty($SIMD, "XYYZ", 0x94, DONT_ENUM | DONT_DELETE | READ_ONLY);
531   %SetProperty($SIMD, "XYYW", 0xD4, DONT_ENUM | DONT_DELETE | READ_ONLY);
532   %SetProperty($SIMD, "XYZX", 0x24, DONT_ENUM | DONT_DELETE | READ_ONLY);
533   %SetProperty($SIMD, "XYZY", 0x64, DONT_ENUM | DONT_DELETE | READ_ONLY);
534   %SetProperty($SIMD, "XYZZ", 0xA4, DONT_ENUM | DONT_DELETE | READ_ONLY);
535   %SetProperty($SIMD, "XYZW", 0xE4, DONT_ENUM | DONT_DELETE | READ_ONLY);
536   %SetProperty($SIMD, "XYWX", 0x34, DONT_ENUM | DONT_DELETE | READ_ONLY);
537   %SetProperty($SIMD, "XYWY", 0x74, DONT_ENUM | DONT_DELETE | READ_ONLY);
538   %SetProperty($SIMD, "XYWZ", 0xB4, DONT_ENUM | DONT_DELETE | READ_ONLY);
539   %SetProperty($SIMD, "XYWW", 0xF4, DONT_ENUM | DONT_DELETE | READ_ONLY);
540   %SetProperty($SIMD, "XZXX", 0x08, DONT_ENUM | DONT_DELETE | READ_ONLY);
541   %SetProperty($SIMD, "XZXY", 0x48, DONT_ENUM | DONT_DELETE | READ_ONLY);
542   %SetProperty($SIMD, "XZXZ", 0x88, DONT_ENUM | DONT_DELETE | READ_ONLY);
543   %SetProperty($SIMD, "XZXW", 0xC8, DONT_ENUM | DONT_DELETE | READ_ONLY);
544   %SetProperty($SIMD, "XZYX", 0x18, DONT_ENUM | DONT_DELETE | READ_ONLY);
545   %SetProperty($SIMD, "XZYY", 0x58, DONT_ENUM | DONT_DELETE | READ_ONLY);
546   %SetProperty($SIMD, "XZYZ", 0x98, DONT_ENUM | DONT_DELETE | READ_ONLY);
547   %SetProperty($SIMD, "XZYW", 0xD8, DONT_ENUM | DONT_DELETE | READ_ONLY);
548   %SetProperty($SIMD, "XZZX", 0x28, DONT_ENUM | DONT_DELETE | READ_ONLY);
549   %SetProperty($SIMD, "XZZY", 0x68, DONT_ENUM | DONT_DELETE | READ_ONLY);
550   %SetProperty($SIMD, "XZZZ", 0xA8, DONT_ENUM | DONT_DELETE | READ_ONLY);
551   %SetProperty($SIMD, "XZZW", 0xE8, DONT_ENUM | DONT_DELETE | READ_ONLY);
552   %SetProperty($SIMD, "XZWX", 0x38, DONT_ENUM | DONT_DELETE | READ_ONLY);
553   %SetProperty($SIMD, "XZWY", 0x78, DONT_ENUM | DONT_DELETE | READ_ONLY);
554   %SetProperty($SIMD, "XZWZ", 0xB8, DONT_ENUM | DONT_DELETE | READ_ONLY);
555   %SetProperty($SIMD, "XZWW", 0xF8, DONT_ENUM | DONT_DELETE | READ_ONLY);
556   %SetProperty($SIMD, "XWXX", 0x0C, DONT_ENUM | DONT_DELETE | READ_ONLY);
557   %SetProperty($SIMD, "XWXY", 0x4C, DONT_ENUM | DONT_DELETE | READ_ONLY);
558   %SetProperty($SIMD, "XWXZ", 0x8C, DONT_ENUM | DONT_DELETE | READ_ONLY);
559   %SetProperty($SIMD, "XWXW", 0xCC, DONT_ENUM | DONT_DELETE | READ_ONLY);
560   %SetProperty($SIMD, "XWYX", 0x1C, DONT_ENUM | DONT_DELETE | READ_ONLY);
561   %SetProperty($SIMD, "XWYY", 0x5C, DONT_ENUM | DONT_DELETE | READ_ONLY);
562   %SetProperty($SIMD, "XWYZ", 0x9C, DONT_ENUM | DONT_DELETE | READ_ONLY);
563   %SetProperty($SIMD, "XWYW", 0xDC, DONT_ENUM | DONT_DELETE | READ_ONLY);
564   %SetProperty($SIMD, "XWZX", 0x2C, DONT_ENUM | DONT_DELETE | READ_ONLY);
565   %SetProperty($SIMD, "XWZY", 0x6C, DONT_ENUM | DONT_DELETE | READ_ONLY);
566   %SetProperty($SIMD, "XWZZ", 0xAC, DONT_ENUM | DONT_DELETE | READ_ONLY);
567   %SetProperty($SIMD, "XWZW", 0xEC, DONT_ENUM | DONT_DELETE | READ_ONLY);
568   %SetProperty($SIMD, "XWWX", 0x3C, DONT_ENUM | DONT_DELETE | READ_ONLY);
569   %SetProperty($SIMD, "XWWY", 0x7C, DONT_ENUM | DONT_DELETE | READ_ONLY);
570   %SetProperty($SIMD, "XWWZ", 0xBC, DONT_ENUM | DONT_DELETE | READ_ONLY);
571   %SetProperty($SIMD, "XWWW", 0xFC, DONT_ENUM | DONT_DELETE | READ_ONLY);
572   %SetProperty($SIMD, "YXXX", 0x01, DONT_ENUM | DONT_DELETE | READ_ONLY);
573   %SetProperty($SIMD, "YXXY", 0x41, DONT_ENUM | DONT_DELETE | READ_ONLY);
574   %SetProperty($SIMD, "YXXZ", 0x81, DONT_ENUM | DONT_DELETE | READ_ONLY);
575   %SetProperty($SIMD, "YXXW", 0xC1, DONT_ENUM | DONT_DELETE | READ_ONLY);
576   %SetProperty($SIMD, "YXYX", 0x11, DONT_ENUM | DONT_DELETE | READ_ONLY);
577   %SetProperty($SIMD, "YXYY", 0x51, DONT_ENUM | DONT_DELETE | READ_ONLY);
578   %SetProperty($SIMD, "YXYZ", 0x91, DONT_ENUM | DONT_DELETE | READ_ONLY);
579   %SetProperty($SIMD, "YXYW", 0xD1, DONT_ENUM | DONT_DELETE | READ_ONLY);
580   %SetProperty($SIMD, "YXZX", 0x21, DONT_ENUM | DONT_DELETE | READ_ONLY);
581   %SetProperty($SIMD, "YXZY", 0x61, DONT_ENUM | DONT_DELETE | READ_ONLY);
582   %SetProperty($SIMD, "YXZZ", 0xA1, DONT_ENUM | DONT_DELETE | READ_ONLY);
583   %SetProperty($SIMD, "YXZW", 0xE1, DONT_ENUM | DONT_DELETE | READ_ONLY);
584   %SetProperty($SIMD, "YXWX", 0x31, DONT_ENUM | DONT_DELETE | READ_ONLY);
585   %SetProperty($SIMD, "YXWY", 0x71, DONT_ENUM | DONT_DELETE | READ_ONLY);
586   %SetProperty($SIMD, "YXWZ", 0xB1, DONT_ENUM | DONT_DELETE | READ_ONLY);
587   %SetProperty($SIMD, "YXWW", 0xF1, DONT_ENUM | DONT_DELETE | READ_ONLY);
588   %SetProperty($SIMD, "YYXX", 0x05, DONT_ENUM | DONT_DELETE | READ_ONLY);
589   %SetProperty($SIMD, "YYXY", 0x45, DONT_ENUM | DONT_DELETE | READ_ONLY);
590   %SetProperty($SIMD, "YYXZ", 0x85, DONT_ENUM | DONT_DELETE | READ_ONLY);
591   %SetProperty($SIMD, "YYXW", 0xC5, DONT_ENUM | DONT_DELETE | READ_ONLY);
592   %SetProperty($SIMD, "YYYX", 0x15, DONT_ENUM | DONT_DELETE | READ_ONLY);
593   %SetProperty($SIMD, "YYYY", 0x55, DONT_ENUM | DONT_DELETE | READ_ONLY);
594   %SetProperty($SIMD, "YYYZ", 0x95, DONT_ENUM | DONT_DELETE | READ_ONLY);
595   %SetProperty($SIMD, "YYYW", 0xD5, DONT_ENUM | DONT_DELETE | READ_ONLY);
596   %SetProperty($SIMD, "YYZX", 0x25, DONT_ENUM | DONT_DELETE | READ_ONLY);
597   %SetProperty($SIMD, "YYZY", 0x65, DONT_ENUM | DONT_DELETE | READ_ONLY);
598   %SetProperty($SIMD, "YYZZ", 0xA5, DONT_ENUM | DONT_DELETE | READ_ONLY);
599   %SetProperty($SIMD, "YYZW", 0xE5, DONT_ENUM | DONT_DELETE | READ_ONLY);
600   %SetProperty($SIMD, "YYWX", 0x35, DONT_ENUM | DONT_DELETE | READ_ONLY);
601   %SetProperty($SIMD, "YYWY", 0x75, DONT_ENUM | DONT_DELETE | READ_ONLY);
602   %SetProperty($SIMD, "YYWZ", 0xB5, DONT_ENUM | DONT_DELETE | READ_ONLY);
603   %SetProperty($SIMD, "YYWW", 0xF5, DONT_ENUM | DONT_DELETE | READ_ONLY);
604   %SetProperty($SIMD, "YZXX", 0x09, DONT_ENUM | DONT_DELETE | READ_ONLY);
605   %SetProperty($SIMD, "YZXY", 0x49, DONT_ENUM | DONT_DELETE | READ_ONLY);
606   %SetProperty($SIMD, "YZXZ", 0x89, DONT_ENUM | DONT_DELETE | READ_ONLY);
607   %SetProperty($SIMD, "YZXW", 0xC9, DONT_ENUM | DONT_DELETE | READ_ONLY);
608   %SetProperty($SIMD, "YZYX", 0x19, DONT_ENUM | DONT_DELETE | READ_ONLY);
609   %SetProperty($SIMD, "YZYY", 0x59, DONT_ENUM | DONT_DELETE | READ_ONLY);
610   %SetProperty($SIMD, "YZYZ", 0x99, DONT_ENUM | DONT_DELETE | READ_ONLY);
611   %SetProperty($SIMD, "YZYW", 0xD9, DONT_ENUM | DONT_DELETE | READ_ONLY);
612   %SetProperty($SIMD, "YZZX", 0x29, DONT_ENUM | DONT_DELETE | READ_ONLY);
613   %SetProperty($SIMD, "YZZY", 0x69, DONT_ENUM | DONT_DELETE | READ_ONLY);
614   %SetProperty($SIMD, "YZZZ", 0xA9, DONT_ENUM | DONT_DELETE | READ_ONLY);
615   %SetProperty($SIMD, "YZZW", 0xE9, DONT_ENUM | DONT_DELETE | READ_ONLY);
616   %SetProperty($SIMD, "YZWX", 0x39, DONT_ENUM | DONT_DELETE | READ_ONLY);
617   %SetProperty($SIMD, "YZWY", 0x79, DONT_ENUM | DONT_DELETE | READ_ONLY);
618   %SetProperty($SIMD, "YZWZ", 0xB9, DONT_ENUM | DONT_DELETE | READ_ONLY);
619   %SetProperty($SIMD, "YZWW", 0xF9, DONT_ENUM | DONT_DELETE | READ_ONLY);
620   %SetProperty($SIMD, "YWXX", 0x0D, DONT_ENUM | DONT_DELETE | READ_ONLY);
621   %SetProperty($SIMD, "YWXY", 0x4D, DONT_ENUM | DONT_DELETE | READ_ONLY);
622   %SetProperty($SIMD, "YWXZ", 0x8D, DONT_ENUM | DONT_DELETE | READ_ONLY);
623   %SetProperty($SIMD, "YWXW", 0xCD, DONT_ENUM | DONT_DELETE | READ_ONLY);
624   %SetProperty($SIMD, "YWYX", 0x1D, DONT_ENUM | DONT_DELETE | READ_ONLY);
625   %SetProperty($SIMD, "YWYY", 0x5D, DONT_ENUM | DONT_DELETE | READ_ONLY);
626   %SetProperty($SIMD, "YWYZ", 0x9D, DONT_ENUM | DONT_DELETE | READ_ONLY);
627   %SetProperty($SIMD, "YWYW", 0xDD, DONT_ENUM | DONT_DELETE | READ_ONLY);
628   %SetProperty($SIMD, "YWZX", 0x2D, DONT_ENUM | DONT_DELETE | READ_ONLY);
629   %SetProperty($SIMD, "YWZY", 0x6D, DONT_ENUM | DONT_DELETE | READ_ONLY);
630   %SetProperty($SIMD, "YWZZ", 0xAD, DONT_ENUM | DONT_DELETE | READ_ONLY);
631   %SetProperty($SIMD, "YWZW", 0xED, DONT_ENUM | DONT_DELETE | READ_ONLY);
632   %SetProperty($SIMD, "YWWX", 0x3D, DONT_ENUM | DONT_DELETE | READ_ONLY);
633   %SetProperty($SIMD, "YWWY", 0x7D, DONT_ENUM | DONT_DELETE | READ_ONLY);
634   %SetProperty($SIMD, "YWWZ", 0xBD, DONT_ENUM | DONT_DELETE | READ_ONLY);
635   %SetProperty($SIMD, "YWWW", 0xFD, DONT_ENUM | DONT_DELETE | READ_ONLY);
636   %SetProperty($SIMD, "ZXXX", 0x02, DONT_ENUM | DONT_DELETE | READ_ONLY);
637   %SetProperty($SIMD, "ZXXY", 0x42, DONT_ENUM | DONT_DELETE | READ_ONLY);
638   %SetProperty($SIMD, "ZXXZ", 0x82, DONT_ENUM | DONT_DELETE | READ_ONLY);
639   %SetProperty($SIMD, "ZXXW", 0xC2, DONT_ENUM | DONT_DELETE | READ_ONLY);
640   %SetProperty($SIMD, "ZXYX", 0x12, DONT_ENUM | DONT_DELETE | READ_ONLY);
641   %SetProperty($SIMD, "ZXYY", 0x52, DONT_ENUM | DONT_DELETE | READ_ONLY);
642   %SetProperty($SIMD, "ZXYZ", 0x92, DONT_ENUM | DONT_DELETE | READ_ONLY);
643   %SetProperty($SIMD, "ZXYW", 0xD2, DONT_ENUM | DONT_DELETE | READ_ONLY);
644   %SetProperty($SIMD, "ZXZX", 0x22, DONT_ENUM | DONT_DELETE | READ_ONLY);
645   %SetProperty($SIMD, "ZXZY", 0x62, DONT_ENUM | DONT_DELETE | READ_ONLY);
646   %SetProperty($SIMD, "ZXZZ", 0xA2, DONT_ENUM | DONT_DELETE | READ_ONLY);
647   %SetProperty($SIMD, "ZXZW", 0xE2, DONT_ENUM | DONT_DELETE | READ_ONLY);
648   %SetProperty($SIMD, "ZXWX", 0x32, DONT_ENUM | DONT_DELETE | READ_ONLY);
649   %SetProperty($SIMD, "ZXWY", 0x72, DONT_ENUM | DONT_DELETE | READ_ONLY);
650   %SetProperty($SIMD, "ZXWZ", 0xB2, DONT_ENUM | DONT_DELETE | READ_ONLY);
651   %SetProperty($SIMD, "ZXWW", 0xF2, DONT_ENUM | DONT_DELETE | READ_ONLY);
652   %SetProperty($SIMD, "ZYXX", 0x06, DONT_ENUM | DONT_DELETE | READ_ONLY);
653   %SetProperty($SIMD, "ZYXY", 0x46, DONT_ENUM | DONT_DELETE | READ_ONLY);
654   %SetProperty($SIMD, "ZYXZ", 0x86, DONT_ENUM | DONT_DELETE | READ_ONLY);
655   %SetProperty($SIMD, "ZYXW", 0xC6, DONT_ENUM | DONT_DELETE | READ_ONLY);
656   %SetProperty($SIMD, "ZYYX", 0x16, DONT_ENUM | DONT_DELETE | READ_ONLY);
657   %SetProperty($SIMD, "ZYYY", 0x56, DONT_ENUM | DONT_DELETE | READ_ONLY);
658   %SetProperty($SIMD, "ZYYZ", 0x96, DONT_ENUM | DONT_DELETE | READ_ONLY);
659   %SetProperty($SIMD, "ZYYW", 0xD6, DONT_ENUM | DONT_DELETE | READ_ONLY);
660   %SetProperty($SIMD, "ZYZX", 0x26, DONT_ENUM | DONT_DELETE | READ_ONLY);
661   %SetProperty($SIMD, "ZYZY", 0x66, DONT_ENUM | DONT_DELETE | READ_ONLY);
662   %SetProperty($SIMD, "ZYZZ", 0xA6, DONT_ENUM | DONT_DELETE | READ_ONLY);
663   %SetProperty($SIMD, "ZYZW", 0xE6, DONT_ENUM | DONT_DELETE | READ_ONLY);
664   %SetProperty($SIMD, "ZYWX", 0x36, DONT_ENUM | DONT_DELETE | READ_ONLY);
665   %SetProperty($SIMD, "ZYWY", 0x76, DONT_ENUM | DONT_DELETE | READ_ONLY);
666   %SetProperty($SIMD, "ZYWZ", 0xB6, DONT_ENUM | DONT_DELETE | READ_ONLY);
667   %SetProperty($SIMD, "ZYWW", 0xF6, DONT_ENUM | DONT_DELETE | READ_ONLY);
668   %SetProperty($SIMD, "ZZXX", 0x0A, DONT_ENUM | DONT_DELETE | READ_ONLY);
669   %SetProperty($SIMD, "ZZXY", 0x4A, DONT_ENUM | DONT_DELETE | READ_ONLY);
670   %SetProperty($SIMD, "ZZXZ", 0x8A, DONT_ENUM | DONT_DELETE | READ_ONLY);
671   %SetProperty($SIMD, "ZZXW", 0xCA, DONT_ENUM | DONT_DELETE | READ_ONLY);
672   %SetProperty($SIMD, "ZZYX", 0x1A, DONT_ENUM | DONT_DELETE | READ_ONLY);
673   %SetProperty($SIMD, "ZZYY", 0x5A, DONT_ENUM | DONT_DELETE | READ_ONLY);
674   %SetProperty($SIMD, "ZZYZ", 0x9A, DONT_ENUM | DONT_DELETE | READ_ONLY);
675   %SetProperty($SIMD, "ZZYW", 0xDA, DONT_ENUM | DONT_DELETE | READ_ONLY);
676   %SetProperty($SIMD, "ZZZX", 0x2A, DONT_ENUM | DONT_DELETE | READ_ONLY);
677   %SetProperty($SIMD, "ZZZY", 0x6A, DONT_ENUM | DONT_DELETE | READ_ONLY);
678   %SetProperty($SIMD, "ZZZZ", 0xAA, DONT_ENUM | DONT_DELETE | READ_ONLY);
679   %SetProperty($SIMD, "ZZZW", 0xEA, DONT_ENUM | DONT_DELETE | READ_ONLY);
680   %SetProperty($SIMD, "ZZWX", 0x3A, DONT_ENUM | DONT_DELETE | READ_ONLY);
681   %SetProperty($SIMD, "ZZWY", 0x7A, DONT_ENUM | DONT_DELETE | READ_ONLY);
682   %SetProperty($SIMD, "ZZWZ", 0xBA, DONT_ENUM | DONT_DELETE | READ_ONLY);
683   %SetProperty($SIMD, "ZZWW", 0xFA, DONT_ENUM | DONT_DELETE | READ_ONLY);
684   %SetProperty($SIMD, "ZWXX", 0x0E, DONT_ENUM | DONT_DELETE | READ_ONLY);
685   %SetProperty($SIMD, "ZWXY", 0x4E, DONT_ENUM | DONT_DELETE | READ_ONLY);
686   %SetProperty($SIMD, "ZWXZ", 0x8E, DONT_ENUM | DONT_DELETE | READ_ONLY);
687   %SetProperty($SIMD, "ZWXW", 0xCE, DONT_ENUM | DONT_DELETE | READ_ONLY);
688   %SetProperty($SIMD, "ZWYX", 0x1E, DONT_ENUM | DONT_DELETE | READ_ONLY);
689   %SetProperty($SIMD, "ZWYY", 0x5E, DONT_ENUM | DONT_DELETE | READ_ONLY);
690   %SetProperty($SIMD, "ZWYZ", 0x9E, DONT_ENUM | DONT_DELETE | READ_ONLY);
691   %SetProperty($SIMD, "ZWYW", 0xDE, DONT_ENUM | DONT_DELETE | READ_ONLY);
692   %SetProperty($SIMD, "ZWZX", 0x2E, DONT_ENUM | DONT_DELETE | READ_ONLY);
693   %SetProperty($SIMD, "ZWZY", 0x6E, DONT_ENUM | DONT_DELETE | READ_ONLY);
694   %SetProperty($SIMD, "ZWZZ", 0xAE, DONT_ENUM | DONT_DELETE | READ_ONLY);
695   %SetProperty($SIMD, "ZWZW", 0xEE, DONT_ENUM | DONT_DELETE | READ_ONLY);
696   %SetProperty($SIMD, "ZWWX", 0x3E, DONT_ENUM | DONT_DELETE | READ_ONLY);
697   %SetProperty($SIMD, "ZWWY", 0x7E, DONT_ENUM | DONT_DELETE | READ_ONLY);
698   %SetProperty($SIMD, "ZWWZ", 0xBE, DONT_ENUM | DONT_DELETE | READ_ONLY);
699   %SetProperty($SIMD, "ZWWW", 0xFE, DONT_ENUM | DONT_DELETE | READ_ONLY);
700   %SetProperty($SIMD, "WXXX", 0x03, DONT_ENUM | DONT_DELETE | READ_ONLY);
701   %SetProperty($SIMD, "WXXY", 0x43, DONT_ENUM | DONT_DELETE | READ_ONLY);
702   %SetProperty($SIMD, "WXXZ", 0x83, DONT_ENUM | DONT_DELETE | READ_ONLY);
703   %SetProperty($SIMD, "WXXW", 0xC3, DONT_ENUM | DONT_DELETE | READ_ONLY);
704   %SetProperty($SIMD, "WXYX", 0x13, DONT_ENUM | DONT_DELETE | READ_ONLY);
705   %SetProperty($SIMD, "WXYY", 0x53, DONT_ENUM | DONT_DELETE | READ_ONLY);
706   %SetProperty($SIMD, "WXYZ", 0x93, DONT_ENUM | DONT_DELETE | READ_ONLY);
707   %SetProperty($SIMD, "WXYW", 0xD3, DONT_ENUM | DONT_DELETE | READ_ONLY);
708   %SetProperty($SIMD, "WXZX", 0x23, DONT_ENUM | DONT_DELETE | READ_ONLY);
709   %SetProperty($SIMD, "WXZY", 0x63, DONT_ENUM | DONT_DELETE | READ_ONLY);
710   %SetProperty($SIMD, "WXZZ", 0xA3, DONT_ENUM | DONT_DELETE | READ_ONLY);
711   %SetProperty($SIMD, "WXZW", 0xE3, DONT_ENUM | DONT_DELETE | READ_ONLY);
712   %SetProperty($SIMD, "WXWX", 0x33, DONT_ENUM | DONT_DELETE | READ_ONLY);
713   %SetProperty($SIMD, "WXWY", 0x73, DONT_ENUM | DONT_DELETE | READ_ONLY);
714   %SetProperty($SIMD, "WXWZ", 0xB3, DONT_ENUM | DONT_DELETE | READ_ONLY);
715   %SetProperty($SIMD, "WXWW", 0xF3, DONT_ENUM | DONT_DELETE | READ_ONLY);
716   %SetProperty($SIMD, "WYXX", 0x07, DONT_ENUM | DONT_DELETE | READ_ONLY);
717   %SetProperty($SIMD, "WYXY", 0x47, DONT_ENUM | DONT_DELETE | READ_ONLY);
718   %SetProperty($SIMD, "WYXZ", 0x87, DONT_ENUM | DONT_DELETE | READ_ONLY);
719   %SetProperty($SIMD, "WYXW", 0xC7, DONT_ENUM | DONT_DELETE | READ_ONLY);
720   %SetProperty($SIMD, "WYYX", 0x17, DONT_ENUM | DONT_DELETE | READ_ONLY);
721   %SetProperty($SIMD, "WYYY", 0x57, DONT_ENUM | DONT_DELETE | READ_ONLY);
722   %SetProperty($SIMD, "WYYZ", 0x97, DONT_ENUM | DONT_DELETE | READ_ONLY);
723   %SetProperty($SIMD, "WYYW", 0xD7, DONT_ENUM | DONT_DELETE | READ_ONLY);
724   %SetProperty($SIMD, "WYZX", 0x27, DONT_ENUM | DONT_DELETE | READ_ONLY);
725   %SetProperty($SIMD, "WYZY", 0x67, DONT_ENUM | DONT_DELETE | READ_ONLY);
726   %SetProperty($SIMD, "WYZZ", 0xA7, DONT_ENUM | DONT_DELETE | READ_ONLY);
727   %SetProperty($SIMD, "WYZW", 0xE7, DONT_ENUM | DONT_DELETE | READ_ONLY);
728   %SetProperty($SIMD, "WYWX", 0x37, DONT_ENUM | DONT_DELETE | READ_ONLY);
729   %SetProperty($SIMD, "WYWY", 0x77, DONT_ENUM | DONT_DELETE | READ_ONLY);
730   %SetProperty($SIMD, "WYWZ", 0xB7, DONT_ENUM | DONT_DELETE | READ_ONLY);
731   %SetProperty($SIMD, "WYWW", 0xF7, DONT_ENUM | DONT_DELETE | READ_ONLY);
732   %SetProperty($SIMD, "WZXX", 0x0B, DONT_ENUM | DONT_DELETE | READ_ONLY);
733   %SetProperty($SIMD, "WZXY", 0x4B, DONT_ENUM | DONT_DELETE | READ_ONLY);
734   %SetProperty($SIMD, "WZXZ", 0x8B, DONT_ENUM | DONT_DELETE | READ_ONLY);
735   %SetProperty($SIMD, "WZXW", 0xCB, DONT_ENUM | DONT_DELETE | READ_ONLY);
736   %SetProperty($SIMD, "WZYX", 0x1B, DONT_ENUM | DONT_DELETE | READ_ONLY);
737   %SetProperty($SIMD, "WZYY", 0x5B, DONT_ENUM | DONT_DELETE | READ_ONLY);
738   %SetProperty($SIMD, "WZYZ", 0x9B, DONT_ENUM | DONT_DELETE | READ_ONLY);
739   %SetProperty($SIMD, "WZYW", 0xDB, DONT_ENUM | DONT_DELETE | READ_ONLY);
740   %SetProperty($SIMD, "WZZX", 0x2B, DONT_ENUM | DONT_DELETE | READ_ONLY);
741   %SetProperty($SIMD, "WZZY", 0x6B, DONT_ENUM | DONT_DELETE | READ_ONLY);
742   %SetProperty($SIMD, "WZZZ", 0xAB, DONT_ENUM | DONT_DELETE | READ_ONLY);
743   %SetProperty($SIMD, "WZZW", 0xEB, DONT_ENUM | DONT_DELETE | READ_ONLY);
744   %SetProperty($SIMD, "WZWX", 0x3B, DONT_ENUM | DONT_DELETE | READ_ONLY);
745   %SetProperty($SIMD, "WZWY", 0x7B, DONT_ENUM | DONT_DELETE | READ_ONLY);
746   %SetProperty($SIMD, "WZWZ", 0xBB, DONT_ENUM | DONT_DELETE | READ_ONLY);
747   %SetProperty($SIMD, "WZWW", 0xFB, DONT_ENUM | DONT_DELETE | READ_ONLY);
748   %SetProperty($SIMD, "WWXX", 0x0F, DONT_ENUM | DONT_DELETE | READ_ONLY);
749   %SetProperty($SIMD, "WWXY", 0x4F, DONT_ENUM | DONT_DELETE | READ_ONLY);
750   %SetProperty($SIMD, "WWXZ", 0x8F, DONT_ENUM | DONT_DELETE | READ_ONLY);
751   %SetProperty($SIMD, "WWXW", 0xCF, DONT_ENUM | DONT_DELETE | READ_ONLY);
752   %SetProperty($SIMD, "WWYX", 0x1F, DONT_ENUM | DONT_DELETE | READ_ONLY);
753   %SetProperty($SIMD, "WWYY", 0x5F, DONT_ENUM | DONT_DELETE | READ_ONLY);
754   %SetProperty($SIMD, "WWYZ", 0x9F, DONT_ENUM | DONT_DELETE | READ_ONLY);
755   %SetProperty($SIMD, "WWYW", 0xDF, DONT_ENUM | DONT_DELETE | READ_ONLY);
756   %SetProperty($SIMD, "WWZX", 0x2F, DONT_ENUM | DONT_DELETE | READ_ONLY);
757   %SetProperty($SIMD, "WWZY", 0x6F, DONT_ENUM | DONT_DELETE | READ_ONLY);
758   %SetProperty($SIMD, "WWZZ", 0xAF, DONT_ENUM | DONT_DELETE | READ_ONLY);
759   %SetProperty($SIMD, "WWZW", 0xEF, DONT_ENUM | DONT_DELETE | READ_ONLY);
760   %SetProperty($SIMD, "WWWX", 0x3F, DONT_ENUM | DONT_DELETE | READ_ONLY);
761   %SetProperty($SIMD, "WWWY", 0x7F, DONT_ENUM | DONT_DELETE | READ_ONLY);
762   %SetProperty($SIMD, "WWWZ", 0xBF, DONT_ENUM | DONT_DELETE | READ_ONLY);
763   %SetProperty($SIMD, "WWWW", 0xFF, DONT_ENUM | DONT_DELETE | READ_ONLY);
764
765   %ToFastProperties($SIMD);
766
767   // Set up non-enumerable properties of the SIMD float32x4 object.
768   InstallFunctions($SIMD.float32x4, DONT_ENUM, $Array(
769     // Float32x4 operations
770     "splat", Float32x4Splat,
771     "zero", Float32x4Zero,
772     // Unary
773     "abs", Float32x4Abs,
774     "bitsToInt32x4", Float32x4BitsToInt32x4,
775     "neg", Float32x4Neg,
776     "reciprocal", Float32x4Reciprocal,
777     "reciprocalSqrt", Float32x4ReciprocalSqrt,
778     "sqrt", Float32x4Sqrt,
779     "toInt32x4", Float32x4ToInt32x4,
780     // Binary
781     "add", Float32x4Add,
782     "div", Float32x4Div,
783     "max", Float32x4Max,
784     "min", Float32x4Min,
785     "mul", Float32x4Mul,
786     "sub", Float32x4Sub,
787     "lessThan", Float32x4LessThan,
788     "lessThanOrEqual", Float32x4LessThanOrEqual,
789     "equal", Float32x4Equal,
790     "notEqual", Float32x4NotEqual,
791     "greaterThanOrEqual", Float32x4GreaterThanOrEqual,
792     "greaterThan", Float32x4GreaterThan,
793     "and", Float32x4And,
794     "or", Float32x4Or,
795     "xor", Float32x4XOr,
796     "not", Float32x4Not,
797     "scale", Float32x4Scale,
798     "withX", Float32x4WithX,
799     "withY", Float32x4WithY,
800     "withZ", Float32x4WithZ,
801     "withW", Float32x4WithW,
802     "shuffle", Float32x4Shuffle,
803     // Ternary
804     "clamp", Float32x4Clamp,
805     "shuffleMix", Float32x4ShuffleMix
806   ));
807
808   // Set up non-enumerable properties of the SIMD float64x2 object.
809   InstallFunctions($SIMD.float64x2, DONT_ENUM, $Array(
810     // Float64x2 operations
811     "splat", Float64x2Splat,
812     "zero", Float64x2Zero,
813     // Unary
814     "abs", Float64x2Abs,
815     "neg", Float64x2Neg,
816     "sqrt", Float64x2Sqrt,
817     // Binary
818     "add", Float64x2Add,
819     "div", Float64x2Div,
820     "max", Float64x2Max,
821     "min", Float64x2Min,
822     "mul", Float64x2Mul,
823     "sub", Float64x2Sub,
824     "scale", Float64x2Scale,
825     "withX", Float64x2WithX,
826     "withY", Float64x2WithY,
827     // Ternary
828     "clamp", Float64x2Clamp
829   ));
830
831   // Set up non-enumerable properties of the SIMD int32x4 object.
832   InstallFunctions($SIMD.int32x4, DONT_ENUM, $Array(
833     // Int32x4 operations
834     "zero", Int32x4Zero,
835     "splat", Int32x4Splat,
836     "bool", Int32x4Bool,
837     // Unary
838     "bitsToFloat32x4", Int32x4BitsToFloat32x4,
839     "neg", Int32x4Neg,
840     "not", Int32x4Not,
841     "toFloat32x4", Int32x4ToFloat32x4,
842     // Binary
843     "add", Int32x4Add,
844     "and", Int32x4And,
845     "mul", Int32x4Mul,
846     "or", Int32x4Or,
847     "sub", Int32x4Sub,
848     "xor", Int32x4Xor,
849     "shuffle", Int32x4Shuffle,
850     "withX", Int32x4WithX,
851     "withY", Int32x4WithY,
852     "withZ", Int32x4WithZ,
853     "withW", Int32x4WithW,
854     "withFlagX", Int32x4WithFlagX,
855     "withFlagY", Int32x4WithFlagY,
856     "withFlagZ", Int32x4WithFlagZ,
857     "withFlagW", Int32x4WithFlagW,
858     "greaterThan", Int32x4GreaterThan,
859     "equal", Int32x4Equal,
860     "lessThan", Int32x4LessThan,
861     "shiftLeft", Int32x4ShiftLeft,
862     "shiftRight", Int32x4ShiftRight,
863     "shiftRightArithmetic", Int32x4ShiftRightArithmetic,
864     // Ternary
865     "select", Int32x4Select
866   ));
867
868   %SetInlineBuiltinFlag(Float32x4And);
869   %SetInlineBuiltinFlag(Float32x4Or);
870   %SetInlineBuiltinFlag(Float32x4XOr);
871   %SetInlineBuiltinFlag(Float32x4Not);
872 }
873
874 SetUpSIMD();
875
876 //------------------------------------------------------------------------------
877
878 macro SIMD128_TYPED_ARRAYS(FUNCTION)
879 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize.
880 FUNCTION(10, Float32x4Array, 16)
881 FUNCTION(11, Float64x2Array, 16)
882 FUNCTION(12, Int32x4Array, 16)
883 endmacro
884
885 macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
886   function NAMEConstructByArrayBuffer(obj, buffer, byteOffset, length) {
887     if (!IS_UNDEFINED(byteOffset)) {
888         byteOffset =
889             ToPositiveInteger(byteOffset,  "invalid_typed_array_length");
890     }
891     if (!IS_UNDEFINED(length)) {
892         length = ToPositiveInteger(length, "invalid_typed_array_length");
893     }
894
895     var bufferByteLength = %_ArrayBufferGetByteLength(buffer);
896     var offset;
897     if (IS_UNDEFINED(byteOffset)) {
898       offset = 0;
899     } else {
900       offset = byteOffset;
901
902       if (offset % ELEMENT_SIZE !== 0) {
903         throw MakeRangeError("invalid_typed_array_alignment",
904             ["start offset", "NAME", ELEMENT_SIZE]);
905       }
906       if (offset > bufferByteLength) {
907         throw MakeRangeError("invalid_typed_array_offset");
908       }
909     }
910
911     var newByteLength;
912     var newLength;
913     if (IS_UNDEFINED(length)) {
914       if (bufferByteLength % ELEMENT_SIZE !== 0) {
915         throw MakeRangeError("invalid_typed_array_alignment",
916           ["byte length", "NAME", ELEMENT_SIZE]);
917       }
918       newByteLength = bufferByteLength - offset;
919       newLength = newByteLength / ELEMENT_SIZE;
920     } else {
921       var newLength = length;
922       newByteLength = newLength * ELEMENT_SIZE;
923     }
924     if ((offset + newByteLength > bufferByteLength)
925         || (newLength > %_MaxSmi())) {
926       throw MakeRangeError("invalid_typed_array_length");
927     }
928     %_TypedArrayInitialize(obj, ARRAY_ID, buffer, offset, newByteLength);
929   }
930
931   function NAMEConstructByLength(obj, length) {
932     var l = IS_UNDEFINED(length) ?
933       0 : ToPositiveInteger(length, "invalid_typed_array_length");
934     if (l > %_MaxSmi()) {
935       throw MakeRangeError("invalid_typed_array_length");
936     }
937     var byteLength = l * ELEMENT_SIZE;
938     if (byteLength > %_TypedArrayMaxSizeInHeap()) {
939       var buffer = new $ArrayBuffer(byteLength);
940       %_TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
941     } else {
942       %_TypedArrayInitialize(obj, ARRAY_ID, null, 0, byteLength);
943     }
944   }
945
946   function NAMEConstructByArrayLike(obj, arrayLike) {
947     var length = arrayLike.length;
948     var l = ToPositiveInteger(length, "invalid_typed_array_length");
949
950     if (l > %_MaxSmi()) {
951       throw MakeRangeError("invalid_typed_array_length");
952     }
953     if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) {
954       for (var i = 0; i < l; i++) {
955         // It is crucial that we let any execptions from arrayLike[i]
956         // propagate outside the function.
957         obj[i] = arrayLike[i];
958       }
959     }
960   }
961
962   function NAMEConstructor(arg1, arg2, arg3) {
963     if (%_IsConstructCall()) {
964       if (IS_ARRAYBUFFER(arg1)) {
965         NAMEConstructByArrayBuffer(this, arg1, arg2, arg3);
966       } else if (IS_NUMBER(arg1) || IS_STRING(arg1) ||
967                  IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) {
968         NAMEConstructByLength(this, arg1);
969       } else {
970         NAMEConstructByArrayLike(this, arg1);
971       }
972     } else {
973       throw MakeTypeError("constructor_not_function", ["NAME"])
974     }
975   }
976
977   function NAME_GetBuffer() {
978     if (!(%_ClassOf(this) === 'NAME')) {
979       throw MakeTypeError('incompatible_method_receiver',
980                           ["NAME.buffer", this]);
981     }
982     return %TypedArrayGetBuffer(this);
983   }
984
985   function NAME_GetByteLength() {
986     if (!(%_ClassOf(this) === 'NAME')) {
987       throw MakeTypeError('incompatible_method_receiver',
988                           ["NAME.byteLength", this]);
989     }
990     return %_ArrayBufferViewGetByteLength(this);
991   }
992
993   function NAME_GetByteOffset() {
994     if (!(%_ClassOf(this) === 'NAME')) {
995       throw MakeTypeError('incompatible_method_receiver',
996                           ["NAME.byteOffset", this]);
997     }
998     return %_ArrayBufferViewGetByteOffset(this);
999   }
1000
1001   function NAME_GetLength() {
1002     if (!(%_ClassOf(this) === 'NAME')) {
1003       throw MakeTypeError('incompatible_method_receiver',
1004                           ["NAME.length", this]);
1005     }
1006     return %_TypedArrayGetLength(this);
1007   }
1008
1009   var $NAME = global.NAME;
1010
1011   function NAMESubArray(begin, end) {
1012     if (!(%_ClassOf(this) === 'NAME')) {
1013       throw MakeTypeError('incompatible_method_receiver',
1014                           ["NAME.subarray", this]);
1015     }
1016     var beginInt = TO_INTEGER(begin);
1017     if (!IS_UNDEFINED(end)) {
1018       end = TO_INTEGER(end);
1019     }
1020
1021     var srcLength = %_TypedArrayGetLength(this);
1022     if (beginInt < 0) {
1023       beginInt = MathMax(0, srcLength + beginInt);
1024     } else {
1025       beginInt = MathMin(srcLength, beginInt);
1026     }
1027
1028     var endInt = IS_UNDEFINED(end) ? srcLength : end;
1029     if (endInt < 0) {
1030       endInt = MathMax(0, srcLength + endInt);
1031     } else {
1032       endInt = MathMin(endInt, srcLength);
1033     }
1034     if (endInt < beginInt) {
1035       endInt = beginInt;
1036     }
1037     var newLength = endInt - beginInt;
1038     var beginByteOffset =
1039         %_ArrayBufferViewGetByteOffset(this) + beginInt * ELEMENT_SIZE;
1040     return new $NAME(%TypedArrayGetBuffer(this),
1041                      beginByteOffset, newLength);
1042   }
1043 endmacro
1044
1045 SIMD128_TYPED_ARRAYS(TYPED_ARRAY_CONSTRUCTOR)
1046
1047 function SetupSIMD128TypedArrays() {
1048 macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
1049   %CheckIsBootstrapping();
1050   %SetCode(global.NAME, NAMEConstructor);
1051   %FunctionSetPrototype(global.NAME, new $Object());
1052
1053   %SetProperty(global.NAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE,
1054                READ_ONLY | DONT_ENUM | DONT_DELETE);
1055   %SetProperty(global.NAME.prototype,
1056                "constructor", global.NAME, DONT_ENUM);
1057   %SetProperty(global.NAME.prototype,
1058                "BYTES_PER_ELEMENT", ELEMENT_SIZE,
1059                READ_ONLY | DONT_ENUM | DONT_DELETE);
1060   InstallGetter(global.NAME.prototype, "buffer", NAME_GetBuffer);
1061   InstallGetter(global.NAME.prototype, "byteOffset", NAME_GetByteOffset);
1062   InstallGetter(global.NAME.prototype, "byteLength", NAME_GetByteLength);
1063   InstallGetter(global.NAME.prototype, "length", NAME_GetLength);
1064
1065   InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array(
1066         "subarray", NAMESubArray,
1067         "set", TypedArraySet
1068   ));
1069 endmacro
1070
1071 SIMD128_TYPED_ARRAYS(SETUP_TYPED_ARRAY)
1072 }
1073
1074 SetupSIMD128TypedArrays();
1075
1076 macro DECLARE_TYPED_ARRAY_FUNCTION(NAME)
1077 function NAMEArrayGet(i) {
1078   return this[i];
1079 }
1080
1081 function NAMEArraySet(i, v) {
1082   v = ToNAME(v);
1083   CheckNAME(v);
1084   this[i] = v;
1085 }
1086
1087 function SetUpNAMEArray() {
1088   InstallFunctions(global.NAMEArray.prototype, DONT_ENUM, $Array(
1089     "getAt", NAMEArrayGet,
1090     "setAt", NAMEArraySet
1091   ));
1092 }
1093 endmacro
1094
1095 DECLARE_TYPED_ARRAY_FUNCTION(Float32x4)
1096 DECLARE_TYPED_ARRAY_FUNCTION(Float64x2)
1097 DECLARE_TYPED_ARRAY_FUNCTION(Int32x4)
1098
1099 SetUpFloat32x4Array();
1100 SetUpFloat64x2Array();
1101 SetUpInt32x4Array();