2ac352fede6b367ba8af310a5902fd3cd6c79cc0
[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 macro DECLARE_DATA_TYPE_COMMON_FUNCTION(NAME, TYPE)
46 function ThrowNAMETypeError() {
47   throw MakeTypeError("this is not a TYPE object.");
48 }
49
50 function CheckNAME(arg) {
51   if (!(arg instanceof $NAME))
52     ThrowNAMETypeError();
53 }
54 endmacro
55
56 SIMD128_DATA_TYPES(DECLARE_DATA_TYPE_COMMON_FUNCTION)
57
58 function StringfyFloat32x4JS() {
59   CheckFloat32x4(this);
60   return "float32x4(" + this.x + "," + this.y + "," + this.z + "," + this.w + ")";
61 }
62
63 function StringfyFloat64x2JS() {
64   CheckFloat64x2(this);
65   return "float64x2(" + this.x + "," + this.y + ")";
66 }
67
68 function StringfyInt32x4JS() {
69   CheckInt32x4(this);
70   return "int32x4(" + this.x + "," + this.y + "," + this.z + "," + this.w + ")";
71 }
72
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)
91 endmacro
92
93 macro DECLARE_DATA_TYPE_FUNCTION(TYPE, FUNCTION)
94 function TYPEFUNCTIONJS() {
95   CheckTYPE(this);
96   return %TYPEFUNCTION(this);
97 }
98 endmacro
99
100 SIMD128_DATA_TYPE_FUNCTIONS(DECLARE_DATA_TYPE_FUNCTION)
101
102 function Float32x4Constructor(x, y, z, w) {
103   if (arguments.length == 1) {
104     CheckFloat32x4(x);
105     return %CreateFloat32x4(x.x, x.y, x.z, x.w);
106   } else {
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);
112   }
113 }
114
115 function Float64x2Constructor(x, y) {
116   if (arguments.length == 1) {
117     CheckFloat64x2(x);
118     return %CreateFloat64x2(x.x, x.y);
119   } else {
120     x = TO_NUMBER_INLINE(x);
121     y = TO_NUMBER_INLINE(y);
122     return %CreateFloat64x2(x, y);
123   }
124 }
125
126 function Int32x4Constructor(x, y, z, w) {
127   if (arguments.length == 1) {
128     CheckInt32x4(x);
129     return %CreateInt32x4(x.x, x.y, x.z, x.w);
130   } else {
131     x = TO_INT32(x);
132     y = TO_INT32(y);
133     z = TO_INT32(z);
134     w = TO_INT32(w);
135     return %CreateInt32x4(x, y, z, w);
136   }
137 }
138
139 function SetUpFloat32x4() {
140   %CheckIsBootstrapping();
141
142   %SetCode($Float32x4, Float32x4Constructor);
143
144   %FunctionSetPrototype($Float32x4, new $Object());
145   %AddNamedProperty($Float32x4.prototype, "constructor", $Float32x4, DONT_ENUM);
146
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
154   ));
155 }
156
157 function SetUpFloat64x2() {
158   %CheckIsBootstrapping();
159
160   %SetCode($Float64x2, Float64x2Constructor);
161
162   %FunctionSetPrototype($Float64x2, new $Object());
163   %AddNamedProperty($Float64x2.prototype, "constructor", $Float64x2, DONT_ENUM);
164
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
170   ));
171 }
172
173 function SetUpInt32x4() {
174   %CheckIsBootstrapping();
175
176   %SetCode($Int32x4, Int32x4Constructor);
177
178   %FunctionSetPrototype($Int32x4, new $Object());
179   %AddNamedProperty($Int32x4.prototype, "constructor", $Int32x4, DONT_ENUM);
180
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
192   ));
193 }
194
195 SetUpFloat32x4();
196 SetUpFloat64x2();
197 SetUpInt32x4();
198
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)
215 endmacro
216
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)
245 endmacro
246
247 macro SIMD128_BINARY_SHUFFLE_FUNCTIONS(FUNCTION)
248 FUNCTION(Float32x4)
249 FUNCTION(Int32x4)
250 endmacro
251
252 macro FLOAT32x4_BINARY_FUNCTIONS_WITH_FLOAT32_PARAMETER(FUNCTION)
253 FUNCTION(Scale)
254 FUNCTION(WithX)
255 FUNCTION(WithY)
256 FUNCTION(WithZ)
257 FUNCTION(WithW)
258 endmacro
259
260 macro FLOAT64x2_BINARY_FUNCTIONS_WITH_FLOAT64_PARAMETER(FUNCTION)
261 FUNCTION(Scale)
262 FUNCTION(WithX)
263 FUNCTION(WithY)
264 endmacro
265
266 macro INT32x4_BINARY_FUNCTIONS_WITH_INT32_PARAMETER(FUNCTION)
267 FUNCTION(WithX)
268 FUNCTION(WithY)
269 FUNCTION(WithZ)
270 FUNCTION(WithW)
271 endmacro
272
273 macro INT32x4_BINARY_FUNCTIONS_WITH_BOOLEAN_PARAMETER(FUNCTION)
274 FUNCTION(WithFlagX)
275 FUNCTION(WithFlagY)
276 FUNCTION(WithFlagZ)
277 FUNCTION(WithFlagW)
278 endmacro
279
280 macro DECLARE_SIMD_UNARY_FUNCTION(TYPE, FUNCTION)
281 function TYPEFUNCTIONJS(x4) {
282   CheckTYPE(x4);
283   return %TYPEFUNCTION(x4);
284 }
285 endmacro
286
287 macro DECLARE_SIMD_BINARY_FUNCTION(TYPE, FUNCTION)
288 function TYPEFUNCTIONJS(a4, b4) {
289   CheckTYPE(a4);
290   CheckTYPE(b4);
291   return %TYPEFUNCTION(a4, b4);
292 }
293 endmacro
294
295 macro DECLARE_SIMD_BINARY_SHUFFLE_FUNCTION(TYPE)
296 function TYPEShuffleJS(x4, mask) {
297   CheckTYPE(x4);
298   var value = TO_INT32(mask);
299   if ((value < 0) || (value > 0xFF)) {
300     throw MakeRangeError("invalid_simd_shuffle_mask");
301   }
302   return %TYPEShuffle(x4, mask);
303 }
304 endmacro
305
306 macro DECLARE_FLOAT32x4_BINARY_FUNCTION_WITH_FLOAT32_PARAMETER(FUNCTION)
307 function Float32x4FUNCTIONJS(x4, f) {
308   CheckFloat32x4(x4);
309   f = TO_NUMBER_INLINE(f);
310   return %Float32x4FUNCTION(x4, f);
311 }
312 endmacro
313
314 macro DECLARE_FLOAT64x2_BINARY_FUNCTION_WITH_FLOAT64_PARAMETER(FUNCTION)
315 function Float64x2FUNCTIONJS(x2, f) {
316   CheckFloat64x2(x2);
317   f = TO_NUMBER_INLINE(f);
318   return %Float64x2FUNCTION(x2, f);
319 }
320 endmacro
321
322 macro DECLARE_INT32x4_BINARY_FUNCTION_WITH_INT32_PARAMETER(FUNCTION)
323 function Int32x4FUNCTIONJS(x4, i) {
324   CheckInt32x4(x4);
325   i = TO_INT32(i);
326   return %Int32x4FUNCTION(x4, i);
327 }
328 endmacro
329
330 macro DECLARE_INT32x4_BINARY_FUNCTION_WITH_BOOLEAN_PARAMETER(FUNCTION)
331 function Int32x4FUNCTIONJS(x4, b) {
332   CheckInt32x4(x4);
333   b = ToBoolean(b);
334   return %Int32x4FUNCTION(x4, b);
335 }
336 endmacro
337
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)
345
346 function Float32x4SplatJS(f) {
347   f = TO_NUMBER_INLINE(f);
348   return %CreateFloat32x4(f, f, f, f);
349 }
350
351 function Float32x4ZeroJS() {
352   return %CreateFloat32x4(0.0, 0.0, 0.0, 0.0);
353 }
354
355 function Float32x4AndJS(a4, b4) {
356   a4 = Float32x4BitsToInt32x4JS(a4);
357   b4 = Float32x4BitsToInt32x4JS(b4);
358   return Int32x4BitsToFloat32x4JS(Int32x4AndJS(a4, b4));
359 }
360
361 function Float32x4OrJS(a4, b4) {
362   a4 = Float32x4BitsToInt32x4JS(a4);
363   b4 = Float32x4BitsToInt32x4JS(b4);
364   return Int32x4BitsToFloat32x4JS(Int32x4OrJS(a4, b4));
365 }
366
367 function Float32x4XorJS(a4, b4) {
368   a4 = Float32x4BitsToInt32x4JS(a4);
369   b4 = Float32x4BitsToInt32x4JS(b4);
370   return Int32x4BitsToFloat32x4JS(Int32x4XorJS(a4, b4));
371 }
372
373 function Float32x4NotJS(x4) {
374   x4 = Float32x4BitsToInt32x4JS(x4);
375   return Int32x4BitsToFloat32x4JS(Int32x4NotJS(x4));
376 }
377
378 function Float32x4ClampJS(x4, lowerLimit, upperLimit) {
379   CheckFloat32x4(x4);
380   CheckFloat32x4(lowerLimit);
381   CheckFloat32x4(upperLimit);
382   return %Float32x4Clamp(x4, lowerLimit, upperLimit);
383 }
384
385 function Float32x4ShuffleMixJS(a4, b4, mask) {
386   CheckFloat32x4(a4);
387   CheckFloat32x4(b4);
388   var value = TO_INT32(mask);
389   if ((value < 0) || (value > 0xFF)) {
390     throw MakeRangeError("invalid_simd_shuffleMix_mask");
391   }
392   return %Float32x4ShuffleMix(a4, b4, mask);
393 }
394
395 function Float32x4SelectJS(x4, trueValue, falseValue) {
396   CheckInt32x4(x4);
397   CheckFloat32x4(trueValue);
398   CheckFloat32x4(falseValue);
399   return %Float32x4Select(x4, trueValue, falseValue);
400 }
401
402 function Float64x2SplatJS(f) {
403   f = TO_NUMBER_INLINE(f);
404   return %CreateFloat64x2(f, f);
405 }
406
407 function Float64x2ZeroJS() {
408   return %CreateFloat64x2(0.0, 0.0);
409 }
410
411 function Float64x2ClampJS(x2, lowerLimit, upperLimit) {
412   CheckFloat64x2(x2);
413   CheckFloat64x2(lowerLimit);
414   CheckFloat64x2(upperLimit);
415   return %Float64x2Clamp(x2, lowerLimit, upperLimit);
416 }
417
418 function Int32x4ZeroJS() {
419   return %CreateInt32x4(0, 0, 0, 0);
420 }
421
422 function Int32x4BoolJS(x, y, z, w) {
423   x = x ? -1 : 0;
424   y = y ? -1 : 0;
425   z = z ? -1 : 0;
426   w = w ? -1 : 0;
427   return %CreateInt32x4(x, y, z, w);
428 }
429
430 function Int32x4SplatJS(s) {
431   s = TO_INT32(s);
432   return %CreateInt32x4(s, s, s, s);
433 }
434
435 function Int32x4SelectJS(x4, trueValue, falseValue) {
436   CheckInt32x4(x4);
437   CheckInt32x4(trueValue);
438   CheckInt32x4(falseValue);
439   return %Int32x4Select(x4, trueValue, falseValue);
440 }
441
442 function Int32x4ShiftLeftJS(t, s) {
443   CheckInt32x4(t);
444   s = TO_NUMBER_INLINE(s);
445   var x = t.x << s;
446   var y = t.y << s;
447   var z = t.z << s;
448   var w = t.w << s;
449   return %CreateInt32x4(x, y, z, w);
450 }
451
452 function Int32x4ShiftRightJS(t, s) {
453   CheckInt32x4(t);
454   s = TO_NUMBER_INLINE(s);
455   var x = t.x >>> s;
456   var y = t.y >>> s;
457   var z = t.z >>> s;
458   var w = t.w >>> s;
459   return %CreateInt32x4(x, y, z, w);
460 }
461
462 function Int32x4ShiftRightArithmeticJS(t, s) {
463   CheckInt32x4(t);
464   s = TO_NUMBER_INLINE(s);
465   var x = t.x >> s;
466   var y = t.y >> s;
467   var z = t.z >> s;
468   var w = t.w >> s;
469   return %CreateInt32x4(x, y, z, w);
470 }
471
472 function SetUpSIMD() {
473   %CheckIsBootstrapping();
474
475   %OptimizeObjectForAddingMultipleProperties($SIMD, 258);
476   %AddNamedProperty($SIMD, "XXXX", 0x00, DONT_ENUM | DONT_DELETE | READ_ONLY);
477   %AddNamedProperty($SIMD, "XXXY", 0x40, DONT_ENUM | DONT_DELETE | READ_ONLY);
478   %AddNamedProperty($SIMD, "XXXZ", 0x80, DONT_ENUM | DONT_DELETE | READ_ONLY);
479   %AddNamedProperty($SIMD, "XXXW", 0xC0, DONT_ENUM | DONT_DELETE | READ_ONLY);
480   %AddNamedProperty($SIMD, "XXYX", 0x10, DONT_ENUM | DONT_DELETE | READ_ONLY);
481   %AddNamedProperty($SIMD, "XXYY", 0x50, DONT_ENUM | DONT_DELETE | READ_ONLY);
482   %AddNamedProperty($SIMD, "XXYZ", 0x90, DONT_ENUM | DONT_DELETE | READ_ONLY);
483   %AddNamedProperty($SIMD, "XXYW", 0xD0, DONT_ENUM | DONT_DELETE | READ_ONLY);
484   %AddNamedProperty($SIMD, "XXZX", 0x20, DONT_ENUM | DONT_DELETE | READ_ONLY);
485   %AddNamedProperty($SIMD, "XXZY", 0x60, DONT_ENUM | DONT_DELETE | READ_ONLY);
486   %AddNamedProperty($SIMD, "XXZZ", 0xA0, DONT_ENUM | DONT_DELETE | READ_ONLY);
487   %AddNamedProperty($SIMD, "XXZW", 0xE0, DONT_ENUM | DONT_DELETE | READ_ONLY);
488   %AddNamedProperty($SIMD, "XXWX", 0x30, DONT_ENUM | DONT_DELETE | READ_ONLY);
489   %AddNamedProperty($SIMD, "XXWY", 0x70, DONT_ENUM | DONT_DELETE | READ_ONLY);
490   %AddNamedProperty($SIMD, "XXWZ", 0xB0, DONT_ENUM | DONT_DELETE | READ_ONLY);
491   %AddNamedProperty($SIMD, "XXWW", 0xF0, DONT_ENUM | DONT_DELETE | READ_ONLY);
492   %AddNamedProperty($SIMD, "XYXX", 0x04, DONT_ENUM | DONT_DELETE | READ_ONLY);
493   %AddNamedProperty($SIMD, "XYXY", 0x44, DONT_ENUM | DONT_DELETE | READ_ONLY);
494   %AddNamedProperty($SIMD, "XYXZ", 0x84, DONT_ENUM | DONT_DELETE | READ_ONLY);
495   %AddNamedProperty($SIMD, "XYXW", 0xC4, DONT_ENUM | DONT_DELETE | READ_ONLY);
496   %AddNamedProperty($SIMD, "XYYX", 0x14, DONT_ENUM | DONT_DELETE | READ_ONLY);
497   %AddNamedProperty($SIMD, "XYYY", 0x54, DONT_ENUM | DONT_DELETE | READ_ONLY);
498   %AddNamedProperty($SIMD, "XYYZ", 0x94, DONT_ENUM | DONT_DELETE | READ_ONLY);
499   %AddNamedProperty($SIMD, "XYYW", 0xD4, DONT_ENUM | DONT_DELETE | READ_ONLY);
500   %AddNamedProperty($SIMD, "XYZX", 0x24, DONT_ENUM | DONT_DELETE | READ_ONLY);
501   %AddNamedProperty($SIMD, "XYZY", 0x64, DONT_ENUM | DONT_DELETE | READ_ONLY);
502   %AddNamedProperty($SIMD, "XYZZ", 0xA4, DONT_ENUM | DONT_DELETE | READ_ONLY);
503   %AddNamedProperty($SIMD, "XYZW", 0xE4, DONT_ENUM | DONT_DELETE | READ_ONLY);
504   %AddNamedProperty($SIMD, "XYWX", 0x34, DONT_ENUM | DONT_DELETE | READ_ONLY);
505   %AddNamedProperty($SIMD, "XYWY", 0x74, DONT_ENUM | DONT_DELETE | READ_ONLY);
506   %AddNamedProperty($SIMD, "XYWZ", 0xB4, DONT_ENUM | DONT_DELETE | READ_ONLY);
507   %AddNamedProperty($SIMD, "XYWW", 0xF4, DONT_ENUM | DONT_DELETE | READ_ONLY);
508   %AddNamedProperty($SIMD, "XZXX", 0x08, DONT_ENUM | DONT_DELETE | READ_ONLY);
509   %AddNamedProperty($SIMD, "XZXY", 0x48, DONT_ENUM | DONT_DELETE | READ_ONLY);
510   %AddNamedProperty($SIMD, "XZXZ", 0x88, DONT_ENUM | DONT_DELETE | READ_ONLY);
511   %AddNamedProperty($SIMD, "XZXW", 0xC8, DONT_ENUM | DONT_DELETE | READ_ONLY);
512   %AddNamedProperty($SIMD, "XZYX", 0x18, DONT_ENUM | DONT_DELETE | READ_ONLY);
513   %AddNamedProperty($SIMD, "XZYY", 0x58, DONT_ENUM | DONT_DELETE | READ_ONLY);
514   %AddNamedProperty($SIMD, "XZYZ", 0x98, DONT_ENUM | DONT_DELETE | READ_ONLY);
515   %AddNamedProperty($SIMD, "XZYW", 0xD8, DONT_ENUM | DONT_DELETE | READ_ONLY);
516   %AddNamedProperty($SIMD, "XZZX", 0x28, DONT_ENUM | DONT_DELETE | READ_ONLY);
517   %AddNamedProperty($SIMD, "XZZY", 0x68, DONT_ENUM | DONT_DELETE | READ_ONLY);
518   %AddNamedProperty($SIMD, "XZZZ", 0xA8, DONT_ENUM | DONT_DELETE | READ_ONLY);
519   %AddNamedProperty($SIMD, "XZZW", 0xE8, DONT_ENUM | DONT_DELETE | READ_ONLY);
520   %AddNamedProperty($SIMD, "XZWX", 0x38, DONT_ENUM | DONT_DELETE | READ_ONLY);
521   %AddNamedProperty($SIMD, "XZWY", 0x78, DONT_ENUM | DONT_DELETE | READ_ONLY);
522   %AddNamedProperty($SIMD, "XZWZ", 0xB8, DONT_ENUM | DONT_DELETE | READ_ONLY);
523   %AddNamedProperty($SIMD, "XZWW", 0xF8, DONT_ENUM | DONT_DELETE | READ_ONLY);
524   %AddNamedProperty($SIMD, "XWXX", 0x0C, DONT_ENUM | DONT_DELETE | READ_ONLY);
525   %AddNamedProperty($SIMD, "XWXY", 0x4C, DONT_ENUM | DONT_DELETE | READ_ONLY);
526   %AddNamedProperty($SIMD, "XWXZ", 0x8C, DONT_ENUM | DONT_DELETE | READ_ONLY);
527   %AddNamedProperty($SIMD, "XWXW", 0xCC, DONT_ENUM | DONT_DELETE | READ_ONLY);
528   %AddNamedProperty($SIMD, "XWYX", 0x1C, DONT_ENUM | DONT_DELETE | READ_ONLY);
529   %AddNamedProperty($SIMD, "XWYY", 0x5C, DONT_ENUM | DONT_DELETE | READ_ONLY);
530   %AddNamedProperty($SIMD, "XWYZ", 0x9C, DONT_ENUM | DONT_DELETE | READ_ONLY);
531   %AddNamedProperty($SIMD, "XWYW", 0xDC, DONT_ENUM | DONT_DELETE | READ_ONLY);
532   %AddNamedProperty($SIMD, "XWZX", 0x2C, DONT_ENUM | DONT_DELETE | READ_ONLY);
533   %AddNamedProperty($SIMD, "XWZY", 0x6C, DONT_ENUM | DONT_DELETE | READ_ONLY);
534   %AddNamedProperty($SIMD, "XWZZ", 0xAC, DONT_ENUM | DONT_DELETE | READ_ONLY);
535   %AddNamedProperty($SIMD, "XWZW", 0xEC, DONT_ENUM | DONT_DELETE | READ_ONLY);
536   %AddNamedProperty($SIMD, "XWWX", 0x3C, DONT_ENUM | DONT_DELETE | READ_ONLY);
537   %AddNamedProperty($SIMD, "XWWY", 0x7C, DONT_ENUM | DONT_DELETE | READ_ONLY);
538   %AddNamedProperty($SIMD, "XWWZ", 0xBC, DONT_ENUM | DONT_DELETE | READ_ONLY);
539   %AddNamedProperty($SIMD, "XWWW", 0xFC, DONT_ENUM | DONT_DELETE | READ_ONLY);
540   %AddNamedProperty($SIMD, "YXXX", 0x01, DONT_ENUM | DONT_DELETE | READ_ONLY);
541   %AddNamedProperty($SIMD, "YXXY", 0x41, DONT_ENUM | DONT_DELETE | READ_ONLY);
542   %AddNamedProperty($SIMD, "YXXZ", 0x81, DONT_ENUM | DONT_DELETE | READ_ONLY);
543   %AddNamedProperty($SIMD, "YXXW", 0xC1, DONT_ENUM | DONT_DELETE | READ_ONLY);
544   %AddNamedProperty($SIMD, "YXYX", 0x11, DONT_ENUM | DONT_DELETE | READ_ONLY);
545   %AddNamedProperty($SIMD, "YXYY", 0x51, DONT_ENUM | DONT_DELETE | READ_ONLY);
546   %AddNamedProperty($SIMD, "YXYZ", 0x91, DONT_ENUM | DONT_DELETE | READ_ONLY);
547   %AddNamedProperty($SIMD, "YXYW", 0xD1, DONT_ENUM | DONT_DELETE | READ_ONLY);
548   %AddNamedProperty($SIMD, "YXZX", 0x21, DONT_ENUM | DONT_DELETE | READ_ONLY);
549   %AddNamedProperty($SIMD, "YXZY", 0x61, DONT_ENUM | DONT_DELETE | READ_ONLY);
550   %AddNamedProperty($SIMD, "YXZZ", 0xA1, DONT_ENUM | DONT_DELETE | READ_ONLY);
551   %AddNamedProperty($SIMD, "YXZW", 0xE1, DONT_ENUM | DONT_DELETE | READ_ONLY);
552   %AddNamedProperty($SIMD, "YXWX", 0x31, DONT_ENUM | DONT_DELETE | READ_ONLY);
553   %AddNamedProperty($SIMD, "YXWY", 0x71, DONT_ENUM | DONT_DELETE | READ_ONLY);
554   %AddNamedProperty($SIMD, "YXWZ", 0xB1, DONT_ENUM | DONT_DELETE | READ_ONLY);
555   %AddNamedProperty($SIMD, "YXWW", 0xF1, DONT_ENUM | DONT_DELETE | READ_ONLY);
556   %AddNamedProperty($SIMD, "YYXX", 0x05, DONT_ENUM | DONT_DELETE | READ_ONLY);
557   %AddNamedProperty($SIMD, "YYXY", 0x45, DONT_ENUM | DONT_DELETE | READ_ONLY);
558   %AddNamedProperty($SIMD, "YYXZ", 0x85, DONT_ENUM | DONT_DELETE | READ_ONLY);
559   %AddNamedProperty($SIMD, "YYXW", 0xC5, DONT_ENUM | DONT_DELETE | READ_ONLY);
560   %AddNamedProperty($SIMD, "YYYX", 0x15, DONT_ENUM | DONT_DELETE | READ_ONLY);
561   %AddNamedProperty($SIMD, "YYYY", 0x55, DONT_ENUM | DONT_DELETE | READ_ONLY);
562   %AddNamedProperty($SIMD, "YYYZ", 0x95, DONT_ENUM | DONT_DELETE | READ_ONLY);
563   %AddNamedProperty($SIMD, "YYYW", 0xD5, DONT_ENUM | DONT_DELETE | READ_ONLY);
564   %AddNamedProperty($SIMD, "YYZX", 0x25, DONT_ENUM | DONT_DELETE | READ_ONLY);
565   %AddNamedProperty($SIMD, "YYZY", 0x65, DONT_ENUM | DONT_DELETE | READ_ONLY);
566   %AddNamedProperty($SIMD, "YYZZ", 0xA5, DONT_ENUM | DONT_DELETE | READ_ONLY);
567   %AddNamedProperty($SIMD, "YYZW", 0xE5, DONT_ENUM | DONT_DELETE | READ_ONLY);
568   %AddNamedProperty($SIMD, "YYWX", 0x35, DONT_ENUM | DONT_DELETE | READ_ONLY);
569   %AddNamedProperty($SIMD, "YYWY", 0x75, DONT_ENUM | DONT_DELETE | READ_ONLY);
570   %AddNamedProperty($SIMD, "YYWZ", 0xB5, DONT_ENUM | DONT_DELETE | READ_ONLY);
571   %AddNamedProperty($SIMD, "YYWW", 0xF5, DONT_ENUM | DONT_DELETE | READ_ONLY);
572   %AddNamedProperty($SIMD, "YZXX", 0x09, DONT_ENUM | DONT_DELETE | READ_ONLY);
573   %AddNamedProperty($SIMD, "YZXY", 0x49, DONT_ENUM | DONT_DELETE | READ_ONLY);
574   %AddNamedProperty($SIMD, "YZXZ", 0x89, DONT_ENUM | DONT_DELETE | READ_ONLY);
575   %AddNamedProperty($SIMD, "YZXW", 0xC9, DONT_ENUM | DONT_DELETE | READ_ONLY);
576   %AddNamedProperty($SIMD, "YZYX", 0x19, DONT_ENUM | DONT_DELETE | READ_ONLY);
577   %AddNamedProperty($SIMD, "YZYY", 0x59, DONT_ENUM | DONT_DELETE | READ_ONLY);
578   %AddNamedProperty($SIMD, "YZYZ", 0x99, DONT_ENUM | DONT_DELETE | READ_ONLY);
579   %AddNamedProperty($SIMD, "YZYW", 0xD9, DONT_ENUM | DONT_DELETE | READ_ONLY);
580   %AddNamedProperty($SIMD, "YZZX", 0x29, DONT_ENUM | DONT_DELETE | READ_ONLY);
581   %AddNamedProperty($SIMD, "YZZY", 0x69, DONT_ENUM | DONT_DELETE | READ_ONLY);
582   %AddNamedProperty($SIMD, "YZZZ", 0xA9, DONT_ENUM | DONT_DELETE | READ_ONLY);
583   %AddNamedProperty($SIMD, "YZZW", 0xE9, DONT_ENUM | DONT_DELETE | READ_ONLY);
584   %AddNamedProperty($SIMD, "YZWX", 0x39, DONT_ENUM | DONT_DELETE | READ_ONLY);
585   %AddNamedProperty($SIMD, "YZWY", 0x79, DONT_ENUM | DONT_DELETE | READ_ONLY);
586   %AddNamedProperty($SIMD, "YZWZ", 0xB9, DONT_ENUM | DONT_DELETE | READ_ONLY);
587   %AddNamedProperty($SIMD, "YZWW", 0xF9, DONT_ENUM | DONT_DELETE | READ_ONLY);
588   %AddNamedProperty($SIMD, "YWXX", 0x0D, DONT_ENUM | DONT_DELETE | READ_ONLY);
589   %AddNamedProperty($SIMD, "YWXY", 0x4D, DONT_ENUM | DONT_DELETE | READ_ONLY);
590   %AddNamedProperty($SIMD, "YWXZ", 0x8D, DONT_ENUM | DONT_DELETE | READ_ONLY);
591   %AddNamedProperty($SIMD, "YWXW", 0xCD, DONT_ENUM | DONT_DELETE | READ_ONLY);
592   %AddNamedProperty($SIMD, "YWYX", 0x1D, DONT_ENUM | DONT_DELETE | READ_ONLY);
593   %AddNamedProperty($SIMD, "YWYY", 0x5D, DONT_ENUM | DONT_DELETE | READ_ONLY);
594   %AddNamedProperty($SIMD, "YWYZ", 0x9D, DONT_ENUM | DONT_DELETE | READ_ONLY);
595   %AddNamedProperty($SIMD, "YWYW", 0xDD, DONT_ENUM | DONT_DELETE | READ_ONLY);
596   %AddNamedProperty($SIMD, "YWZX", 0x2D, DONT_ENUM | DONT_DELETE | READ_ONLY);
597   %AddNamedProperty($SIMD, "YWZY", 0x6D, DONT_ENUM | DONT_DELETE | READ_ONLY);
598   %AddNamedProperty($SIMD, "YWZZ", 0xAD, DONT_ENUM | DONT_DELETE | READ_ONLY);
599   %AddNamedProperty($SIMD, "YWZW", 0xED, DONT_ENUM | DONT_DELETE | READ_ONLY);
600   %AddNamedProperty($SIMD, "YWWX", 0x3D, DONT_ENUM | DONT_DELETE | READ_ONLY);
601   %AddNamedProperty($SIMD, "YWWY", 0x7D, DONT_ENUM | DONT_DELETE | READ_ONLY);
602   %AddNamedProperty($SIMD, "YWWZ", 0xBD, DONT_ENUM | DONT_DELETE | READ_ONLY);
603   %AddNamedProperty($SIMD, "YWWW", 0xFD, DONT_ENUM | DONT_DELETE | READ_ONLY);
604   %AddNamedProperty($SIMD, "ZXXX", 0x02, DONT_ENUM | DONT_DELETE | READ_ONLY);
605   %AddNamedProperty($SIMD, "ZXXY", 0x42, DONT_ENUM | DONT_DELETE | READ_ONLY);
606   %AddNamedProperty($SIMD, "ZXXZ", 0x82, DONT_ENUM | DONT_DELETE | READ_ONLY);
607   %AddNamedProperty($SIMD, "ZXXW", 0xC2, DONT_ENUM | DONT_DELETE | READ_ONLY);
608   %AddNamedProperty($SIMD, "ZXYX", 0x12, DONT_ENUM | DONT_DELETE | READ_ONLY);
609   %AddNamedProperty($SIMD, "ZXYY", 0x52, DONT_ENUM | DONT_DELETE | READ_ONLY);
610   %AddNamedProperty($SIMD, "ZXYZ", 0x92, DONT_ENUM | DONT_DELETE | READ_ONLY);
611   %AddNamedProperty($SIMD, "ZXYW", 0xD2, DONT_ENUM | DONT_DELETE | READ_ONLY);
612   %AddNamedProperty($SIMD, "ZXZX", 0x22, DONT_ENUM | DONT_DELETE | READ_ONLY);
613   %AddNamedProperty($SIMD, "ZXZY", 0x62, DONT_ENUM | DONT_DELETE | READ_ONLY);
614   %AddNamedProperty($SIMD, "ZXZZ", 0xA2, DONT_ENUM | DONT_DELETE | READ_ONLY);
615   %AddNamedProperty($SIMD, "ZXZW", 0xE2, DONT_ENUM | DONT_DELETE | READ_ONLY);
616   %AddNamedProperty($SIMD, "ZXWX", 0x32, DONT_ENUM | DONT_DELETE | READ_ONLY);
617   %AddNamedProperty($SIMD, "ZXWY", 0x72, DONT_ENUM | DONT_DELETE | READ_ONLY);
618   %AddNamedProperty($SIMD, "ZXWZ", 0xB2, DONT_ENUM | DONT_DELETE | READ_ONLY);
619   %AddNamedProperty($SIMD, "ZXWW", 0xF2, DONT_ENUM | DONT_DELETE | READ_ONLY);
620   %AddNamedProperty($SIMD, "ZYXX", 0x06, DONT_ENUM | DONT_DELETE | READ_ONLY);
621   %AddNamedProperty($SIMD, "ZYXY", 0x46, DONT_ENUM | DONT_DELETE | READ_ONLY);
622   %AddNamedProperty($SIMD, "ZYXZ", 0x86, DONT_ENUM | DONT_DELETE | READ_ONLY);
623   %AddNamedProperty($SIMD, "ZYXW", 0xC6, DONT_ENUM | DONT_DELETE | READ_ONLY);
624   %AddNamedProperty($SIMD, "ZYYX", 0x16, DONT_ENUM | DONT_DELETE | READ_ONLY);
625   %AddNamedProperty($SIMD, "ZYYY", 0x56, DONT_ENUM | DONT_DELETE | READ_ONLY);
626   %AddNamedProperty($SIMD, "ZYYZ", 0x96, DONT_ENUM | DONT_DELETE | READ_ONLY);
627   %AddNamedProperty($SIMD, "ZYYW", 0xD6, DONT_ENUM | DONT_DELETE | READ_ONLY);
628   %AddNamedProperty($SIMD, "ZYZX", 0x26, DONT_ENUM | DONT_DELETE | READ_ONLY);
629   %AddNamedProperty($SIMD, "ZYZY", 0x66, DONT_ENUM | DONT_DELETE | READ_ONLY);
630   %AddNamedProperty($SIMD, "ZYZZ", 0xA6, DONT_ENUM | DONT_DELETE | READ_ONLY);
631   %AddNamedProperty($SIMD, "ZYZW", 0xE6, DONT_ENUM | DONT_DELETE | READ_ONLY);
632   %AddNamedProperty($SIMD, "ZYWX", 0x36, DONT_ENUM | DONT_DELETE | READ_ONLY);
633   %AddNamedProperty($SIMD, "ZYWY", 0x76, DONT_ENUM | DONT_DELETE | READ_ONLY);
634   %AddNamedProperty($SIMD, "ZYWZ", 0xB6, DONT_ENUM | DONT_DELETE | READ_ONLY);
635   %AddNamedProperty($SIMD, "ZYWW", 0xF6, DONT_ENUM | DONT_DELETE | READ_ONLY);
636   %AddNamedProperty($SIMD, "ZZXX", 0x0A, DONT_ENUM | DONT_DELETE | READ_ONLY);
637   %AddNamedProperty($SIMD, "ZZXY", 0x4A, DONT_ENUM | DONT_DELETE | READ_ONLY);
638   %AddNamedProperty($SIMD, "ZZXZ", 0x8A, DONT_ENUM | DONT_DELETE | READ_ONLY);
639   %AddNamedProperty($SIMD, "ZZXW", 0xCA, DONT_ENUM | DONT_DELETE | READ_ONLY);
640   %AddNamedProperty($SIMD, "ZZYX", 0x1A, DONT_ENUM | DONT_DELETE | READ_ONLY);
641   %AddNamedProperty($SIMD, "ZZYY", 0x5A, DONT_ENUM | DONT_DELETE | READ_ONLY);
642   %AddNamedProperty($SIMD, "ZZYZ", 0x9A, DONT_ENUM | DONT_DELETE | READ_ONLY);
643   %AddNamedProperty($SIMD, "ZZYW", 0xDA, DONT_ENUM | DONT_DELETE | READ_ONLY);
644   %AddNamedProperty($SIMD, "ZZZX", 0x2A, DONT_ENUM | DONT_DELETE | READ_ONLY);
645   %AddNamedProperty($SIMD, "ZZZY", 0x6A, DONT_ENUM | DONT_DELETE | READ_ONLY);
646   %AddNamedProperty($SIMD, "ZZZZ", 0xAA, DONT_ENUM | DONT_DELETE | READ_ONLY);
647   %AddNamedProperty($SIMD, "ZZZW", 0xEA, DONT_ENUM | DONT_DELETE | READ_ONLY);
648   %AddNamedProperty($SIMD, "ZZWX", 0x3A, DONT_ENUM | DONT_DELETE | READ_ONLY);
649   %AddNamedProperty($SIMD, "ZZWY", 0x7A, DONT_ENUM | DONT_DELETE | READ_ONLY);
650   %AddNamedProperty($SIMD, "ZZWZ", 0xBA, DONT_ENUM | DONT_DELETE | READ_ONLY);
651   %AddNamedProperty($SIMD, "ZZWW", 0xFA, DONT_ENUM | DONT_DELETE | READ_ONLY);
652   %AddNamedProperty($SIMD, "ZWXX", 0x0E, DONT_ENUM | DONT_DELETE | READ_ONLY);
653   %AddNamedProperty($SIMD, "ZWXY", 0x4E, DONT_ENUM | DONT_DELETE | READ_ONLY);
654   %AddNamedProperty($SIMD, "ZWXZ", 0x8E, DONT_ENUM | DONT_DELETE | READ_ONLY);
655   %AddNamedProperty($SIMD, "ZWXW", 0xCE, DONT_ENUM | DONT_DELETE | READ_ONLY);
656   %AddNamedProperty($SIMD, "ZWYX", 0x1E, DONT_ENUM | DONT_DELETE | READ_ONLY);
657   %AddNamedProperty($SIMD, "ZWYY", 0x5E, DONT_ENUM | DONT_DELETE | READ_ONLY);
658   %AddNamedProperty($SIMD, "ZWYZ", 0x9E, DONT_ENUM | DONT_DELETE | READ_ONLY);
659   %AddNamedProperty($SIMD, "ZWYW", 0xDE, DONT_ENUM | DONT_DELETE | READ_ONLY);
660   %AddNamedProperty($SIMD, "ZWZX", 0x2E, DONT_ENUM | DONT_DELETE | READ_ONLY);
661   %AddNamedProperty($SIMD, "ZWZY", 0x6E, DONT_ENUM | DONT_DELETE | READ_ONLY);
662   %AddNamedProperty($SIMD, "ZWZZ", 0xAE, DONT_ENUM | DONT_DELETE | READ_ONLY);
663   %AddNamedProperty($SIMD, "ZWZW", 0xEE, DONT_ENUM | DONT_DELETE | READ_ONLY);
664   %AddNamedProperty($SIMD, "ZWWX", 0x3E, DONT_ENUM | DONT_DELETE | READ_ONLY);
665   %AddNamedProperty($SIMD, "ZWWY", 0x7E, DONT_ENUM | DONT_DELETE | READ_ONLY);
666   %AddNamedProperty($SIMD, "ZWWZ", 0xBE, DONT_ENUM | DONT_DELETE | READ_ONLY);
667   %AddNamedProperty($SIMD, "ZWWW", 0xFE, DONT_ENUM | DONT_DELETE | READ_ONLY);
668   %AddNamedProperty($SIMD, "WXXX", 0x03, DONT_ENUM | DONT_DELETE | READ_ONLY);
669   %AddNamedProperty($SIMD, "WXXY", 0x43, DONT_ENUM | DONT_DELETE | READ_ONLY);
670   %AddNamedProperty($SIMD, "WXXZ", 0x83, DONT_ENUM | DONT_DELETE | READ_ONLY);
671   %AddNamedProperty($SIMD, "WXXW", 0xC3, DONT_ENUM | DONT_DELETE | READ_ONLY);
672   %AddNamedProperty($SIMD, "WXYX", 0x13, DONT_ENUM | DONT_DELETE | READ_ONLY);
673   %AddNamedProperty($SIMD, "WXYY", 0x53, DONT_ENUM | DONT_DELETE | READ_ONLY);
674   %AddNamedProperty($SIMD, "WXYZ", 0x93, DONT_ENUM | DONT_DELETE | READ_ONLY);
675   %AddNamedProperty($SIMD, "WXYW", 0xD3, DONT_ENUM | DONT_DELETE | READ_ONLY);
676   %AddNamedProperty($SIMD, "WXZX", 0x23, DONT_ENUM | DONT_DELETE | READ_ONLY);
677   %AddNamedProperty($SIMD, "WXZY", 0x63, DONT_ENUM | DONT_DELETE | READ_ONLY);
678   %AddNamedProperty($SIMD, "WXZZ", 0xA3, DONT_ENUM | DONT_DELETE | READ_ONLY);
679   %AddNamedProperty($SIMD, "WXZW", 0xE3, DONT_ENUM | DONT_DELETE | READ_ONLY);
680   %AddNamedProperty($SIMD, "WXWX", 0x33, DONT_ENUM | DONT_DELETE | READ_ONLY);
681   %AddNamedProperty($SIMD, "WXWY", 0x73, DONT_ENUM | DONT_DELETE | READ_ONLY);
682   %AddNamedProperty($SIMD, "WXWZ", 0xB3, DONT_ENUM | DONT_DELETE | READ_ONLY);
683   %AddNamedProperty($SIMD, "WXWW", 0xF3, DONT_ENUM | DONT_DELETE | READ_ONLY);
684   %AddNamedProperty($SIMD, "WYXX", 0x07, DONT_ENUM | DONT_DELETE | READ_ONLY);
685   %AddNamedProperty($SIMD, "WYXY", 0x47, DONT_ENUM | DONT_DELETE | READ_ONLY);
686   %AddNamedProperty($SIMD, "WYXZ", 0x87, DONT_ENUM | DONT_DELETE | READ_ONLY);
687   %AddNamedProperty($SIMD, "WYXW", 0xC7, DONT_ENUM | DONT_DELETE | READ_ONLY);
688   %AddNamedProperty($SIMD, "WYYX", 0x17, DONT_ENUM | DONT_DELETE | READ_ONLY);
689   %AddNamedProperty($SIMD, "WYYY", 0x57, DONT_ENUM | DONT_DELETE | READ_ONLY);
690   %AddNamedProperty($SIMD, "WYYZ", 0x97, DONT_ENUM | DONT_DELETE | READ_ONLY);
691   %AddNamedProperty($SIMD, "WYYW", 0xD7, DONT_ENUM | DONT_DELETE | READ_ONLY);
692   %AddNamedProperty($SIMD, "WYZX", 0x27, DONT_ENUM | DONT_DELETE | READ_ONLY);
693   %AddNamedProperty($SIMD, "WYZY", 0x67, DONT_ENUM | DONT_DELETE | READ_ONLY);
694   %AddNamedProperty($SIMD, "WYZZ", 0xA7, DONT_ENUM | DONT_DELETE | READ_ONLY);
695   %AddNamedProperty($SIMD, "WYZW", 0xE7, DONT_ENUM | DONT_DELETE | READ_ONLY);
696   %AddNamedProperty($SIMD, "WYWX", 0x37, DONT_ENUM | DONT_DELETE | READ_ONLY);
697   %AddNamedProperty($SIMD, "WYWY", 0x77, DONT_ENUM | DONT_DELETE | READ_ONLY);
698   %AddNamedProperty($SIMD, "WYWZ", 0xB7, DONT_ENUM | DONT_DELETE | READ_ONLY);
699   %AddNamedProperty($SIMD, "WYWW", 0xF7, DONT_ENUM | DONT_DELETE | READ_ONLY);
700   %AddNamedProperty($SIMD, "WZXX", 0x0B, DONT_ENUM | DONT_DELETE | READ_ONLY);
701   %AddNamedProperty($SIMD, "WZXY", 0x4B, DONT_ENUM | DONT_DELETE | READ_ONLY);
702   %AddNamedProperty($SIMD, "WZXZ", 0x8B, DONT_ENUM | DONT_DELETE | READ_ONLY);
703   %AddNamedProperty($SIMD, "WZXW", 0xCB, DONT_ENUM | DONT_DELETE | READ_ONLY);
704   %AddNamedProperty($SIMD, "WZYX", 0x1B, DONT_ENUM | DONT_DELETE | READ_ONLY);
705   %AddNamedProperty($SIMD, "WZYY", 0x5B, DONT_ENUM | DONT_DELETE | READ_ONLY);
706   %AddNamedProperty($SIMD, "WZYZ", 0x9B, DONT_ENUM | DONT_DELETE | READ_ONLY);
707   %AddNamedProperty($SIMD, "WZYW", 0xDB, DONT_ENUM | DONT_DELETE | READ_ONLY);
708   %AddNamedProperty($SIMD, "WZZX", 0x2B, DONT_ENUM | DONT_DELETE | READ_ONLY);
709   %AddNamedProperty($SIMD, "WZZY", 0x6B, DONT_ENUM | DONT_DELETE | READ_ONLY);
710   %AddNamedProperty($SIMD, "WZZZ", 0xAB, DONT_ENUM | DONT_DELETE | READ_ONLY);
711   %AddNamedProperty($SIMD, "WZZW", 0xEB, DONT_ENUM | DONT_DELETE | READ_ONLY);
712   %AddNamedProperty($SIMD, "WZWX", 0x3B, DONT_ENUM | DONT_DELETE | READ_ONLY);
713   %AddNamedProperty($SIMD, "WZWY", 0x7B, DONT_ENUM | DONT_DELETE | READ_ONLY);
714   %AddNamedProperty($SIMD, "WZWZ", 0xBB, DONT_ENUM | DONT_DELETE | READ_ONLY);
715   %AddNamedProperty($SIMD, "WZWW", 0xFB, DONT_ENUM | DONT_DELETE | READ_ONLY);
716   %AddNamedProperty($SIMD, "WWXX", 0x0F, DONT_ENUM | DONT_DELETE | READ_ONLY);
717   %AddNamedProperty($SIMD, "WWXY", 0x4F, DONT_ENUM | DONT_DELETE | READ_ONLY);
718   %AddNamedProperty($SIMD, "WWXZ", 0x8F, DONT_ENUM | DONT_DELETE | READ_ONLY);
719   %AddNamedProperty($SIMD, "WWXW", 0xCF, DONT_ENUM | DONT_DELETE | READ_ONLY);
720   %AddNamedProperty($SIMD, "WWYX", 0x1F, DONT_ENUM | DONT_DELETE | READ_ONLY);
721   %AddNamedProperty($SIMD, "WWYY", 0x5F, DONT_ENUM | DONT_DELETE | READ_ONLY);
722   %AddNamedProperty($SIMD, "WWYZ", 0x9F, DONT_ENUM | DONT_DELETE | READ_ONLY);
723   %AddNamedProperty($SIMD, "WWYW", 0xDF, DONT_ENUM | DONT_DELETE | READ_ONLY);
724   %AddNamedProperty($SIMD, "WWZX", 0x2F, DONT_ENUM | DONT_DELETE | READ_ONLY);
725   %AddNamedProperty($SIMD, "WWZY", 0x6F, DONT_ENUM | DONT_DELETE | READ_ONLY);
726   %AddNamedProperty($SIMD, "WWZZ", 0xAF, DONT_ENUM | DONT_DELETE | READ_ONLY);
727   %AddNamedProperty($SIMD, "WWZW", 0xEF, DONT_ENUM | DONT_DELETE | READ_ONLY);
728   %AddNamedProperty($SIMD, "WWWX", 0x3F, DONT_ENUM | DONT_DELETE | READ_ONLY);
729   %AddNamedProperty($SIMD, "WWWY", 0x7F, DONT_ENUM | DONT_DELETE | READ_ONLY);
730   %AddNamedProperty($SIMD, "WWWZ", 0xBF, DONT_ENUM | DONT_DELETE | READ_ONLY);
731   %AddNamedProperty($SIMD, "WWWW", 0xFF, DONT_ENUM | DONT_DELETE | READ_ONLY);
732
733   %ToFastProperties($SIMD);
734
735   // Set up non-enumerable properties of the SIMD float32x4 object.
736   InstallFunctions($SIMD.float32x4, DONT_ENUM, $Array(
737     // Float32x4 operations
738     "splat", Float32x4SplatJS,
739     "zero", Float32x4ZeroJS,
740     // Unary
741     "abs", Float32x4AbsJS,
742     "fromInt32x4", Int32x4ToFloat32x4JS,
743     "fromInt32x4Bits", Int32x4BitsToFloat32x4JS,
744     "neg", Float32x4NegJS,
745     "reciprocal", Float32x4ReciprocalJS,
746     "reciprocalSqrt", Float32x4ReciprocalSqrtJS,
747     "sqrt", Float32x4SqrtJS,
748     // Binary
749     "add", Float32x4AddJS,
750     "div", Float32x4DivJS,
751     "max", Float32x4MaxJS,
752     "min", Float32x4MinJS,
753     "mul", Float32x4MulJS,
754     "sub", Float32x4SubJS,
755     "lessThan", Float32x4LessThanJS,
756     "lessThanOrEqual", Float32x4LessThanOrEqualJS,
757     "equal", Float32x4EqualJS,
758     "notEqual", Float32x4NotEqualJS,
759     "greaterThanOrEqual", Float32x4GreaterThanOrEqualJS,
760     "greaterThan", Float32x4GreaterThanJS,
761     "and", Float32x4AndJS,
762     "or", Float32x4OrJS,
763     "xor", Float32x4XorJS,
764     "not", Float32x4NotJS,
765     "scale", Float32x4ScaleJS,
766     "withX", Float32x4WithXJS,
767     "withY", Float32x4WithYJS,
768     "withZ", Float32x4WithZJS,
769     "withW", Float32x4WithWJS,
770     "shuffle", Float32x4ShuffleJS,
771     // Ternary
772     "clamp", Float32x4ClampJS,
773     "shuffleMix", Float32x4ShuffleMixJS,
774     "select", Float32x4SelectJS
775   ));
776
777   // Set up non-enumerable properties of the SIMD float64x2 object.
778   InstallFunctions($SIMD.float64x2, DONT_ENUM, $Array(
779     // Float64x2 operations
780     "splat", Float64x2SplatJS,
781     "zero", Float64x2ZeroJS,
782     // Unary
783     "abs", Float64x2AbsJS,
784     "neg", Float64x2NegJS,
785     "sqrt", Float64x2SqrtJS,
786     // Binary
787     "add", Float64x2AddJS,
788     "div", Float64x2DivJS,
789     "max", Float64x2MaxJS,
790     "min", Float64x2MinJS,
791     "mul", Float64x2MulJS,
792     "sub", Float64x2SubJS,
793     "scale", Float64x2ScaleJS,
794     "withX", Float64x2WithXJS,
795     "withY", Float64x2WithYJS,
796     // Ternary
797     "clamp", Float64x2ClampJS
798   ));
799
800   // Set up non-enumerable properties of the SIMD int32x4 object.
801   InstallFunctions($SIMD.int32x4, DONT_ENUM, $Array(
802     // Int32x4 operations
803     "zero", Int32x4ZeroJS,
804     "splat", Int32x4SplatJS,
805     "bool", Int32x4BoolJS,
806     // Unary
807     "fromFloat32x4", Float32x4ToInt32x4JS,
808     "fromFloat32x4Bits", Float32x4BitsToInt32x4JS,
809     "neg", Int32x4NegJS,
810     "not", Int32x4NotJS,
811     // Binary
812     "add", Int32x4AddJS,
813     "and", Int32x4AndJS,
814     "mul", Int32x4MulJS,
815     "or", Int32x4OrJS,
816     "sub", Int32x4SubJS,
817     "xor", Int32x4XorJS,
818     "shuffle", Int32x4ShuffleJS,
819     "withX", Int32x4WithXJS,
820     "withY", Int32x4WithYJS,
821     "withZ", Int32x4WithZJS,
822     "withW", Int32x4WithWJS,
823     "withFlagX", Int32x4WithFlagXJS,
824     "withFlagY", Int32x4WithFlagYJS,
825     "withFlagZ", Int32x4WithFlagZJS,
826     "withFlagW", Int32x4WithFlagWJS,
827     "greaterThan", Int32x4GreaterThanJS,
828     "equal", Int32x4EqualJS,
829     "lessThan", Int32x4LessThanJS,
830     "shiftLeft", Int32x4ShiftLeftJS,
831     "shiftRight", Int32x4ShiftRightJS,
832     "shiftRightArithmetic", Int32x4ShiftRightArithmeticJS,
833     // Ternary
834     "select", Int32x4SelectJS
835   ));
836 }
837
838 SetUpSIMD();
839
840 //------------------------------------------------------------------------------
841 macro SIMD128_TYPED_ARRAYS(FUNCTION)
842 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize.
843 FUNCTION(10, Float32x4Array, 16)
844 FUNCTION(11, Float64x2Array, 16)
845 FUNCTION(12, Int32x4Array, 16)
846 endmacro
847
848 macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
849   function NAMEConstructByArrayBuffer(obj, buffer, byteOffset, length) {
850     if (!IS_UNDEFINED(byteOffset)) {
851         byteOffset =
852             ToPositiveInteger(byteOffset,  "invalid_typed_array_length");
853     }
854     if (!IS_UNDEFINED(length)) {
855         length = ToPositiveInteger(length, "invalid_typed_array_length");
856     }
857
858     var bufferByteLength = %_ArrayBufferGetByteLength(buffer);
859     var offset;
860     if (IS_UNDEFINED(byteOffset)) {
861       offset = 0;
862     } else {
863       offset = byteOffset;
864
865       if (offset % ELEMENT_SIZE !== 0) {
866         throw MakeRangeError("invalid_typed_array_alignment",
867             ["start offset", "NAME", ELEMENT_SIZE]);
868       }
869       if (offset > bufferByteLength) {
870         throw MakeRangeError("invalid_typed_array_offset");
871       }
872     }
873
874     var newByteLength;
875     var newLength;
876     if (IS_UNDEFINED(length)) {
877       if (bufferByteLength % ELEMENT_SIZE !== 0) {
878         throw MakeRangeError("invalid_typed_array_alignment",
879           ["byte length", "NAME", ELEMENT_SIZE]);
880       }
881       newByteLength = bufferByteLength - offset;
882       newLength = newByteLength / ELEMENT_SIZE;
883     } else {
884       var newLength = length;
885       newByteLength = newLength * ELEMENT_SIZE;
886     }
887     if ((offset + newByteLength > bufferByteLength)
888         || (newLength > %_MaxSmi())) {
889       throw MakeRangeError("invalid_typed_array_length");
890     }
891     %_TypedArrayInitialize(obj, ARRAY_ID, buffer, offset, newByteLength);
892   }
893
894   function NAMEConstructByLength(obj, length) {
895     var l = IS_UNDEFINED(length) ?
896       0 : ToPositiveInteger(length, "invalid_typed_array_length");
897     if (l > %_MaxSmi()) {
898       throw MakeRangeError("invalid_typed_array_length");
899     }
900     var byteLength = l * ELEMENT_SIZE;
901     if (byteLength > %_TypedArrayMaxSizeInHeap()) {
902       var buffer = new $ArrayBuffer(byteLength);
903       %_TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
904     } else {
905       %_TypedArrayInitialize(obj, ARRAY_ID, null, 0, byteLength);
906     }
907   }
908
909   function NAMEConstructByArrayLike(obj, arrayLike) {
910     var length = arrayLike.length;
911     var l = ToPositiveInteger(length, "invalid_typed_array_length");
912
913     if (l > %_MaxSmi()) {
914       throw MakeRangeError("invalid_typed_array_length");
915     }
916     if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) {
917       for (var i = 0; i < l; i++) {
918         // It is crucial that we let any execptions from arrayLike[i]
919         // propagate outside the function.
920         obj[i] = arrayLike[i];
921       }
922     }
923   }
924
925   function NAMEConstructor(arg1, arg2, arg3) {
926     if (%_IsConstructCall()) {
927       if (IS_ARRAYBUFFER(arg1)) {
928         NAMEConstructByArrayBuffer(this, arg1, arg2, arg3);
929       } else if (IS_NUMBER(arg1) || IS_STRING(arg1) ||
930                  IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) {
931         NAMEConstructByLength(this, arg1);
932       } else {
933         NAMEConstructByArrayLike(this, arg1);
934       }
935     } else {
936       throw MakeTypeError("constructor_not_function", ["NAME"])
937     }
938   }
939
940   function NAME_GetBuffer() {
941     if (!(%_ClassOf(this) === 'NAME')) {
942       throw MakeTypeError('incompatible_method_receiver',
943                           ["NAME.buffer", this]);
944     }
945     return %TypedArrayGetBuffer(this);
946   }
947
948   function NAME_GetByteLength() {
949     if (!(%_ClassOf(this) === 'NAME')) {
950       throw MakeTypeError('incompatible_method_receiver',
951                           ["NAME.byteLength", this]);
952     }
953     return %_ArrayBufferViewGetByteLength(this);
954   }
955
956   function NAME_GetByteOffset() {
957     if (!(%_ClassOf(this) === 'NAME')) {
958       throw MakeTypeError('incompatible_method_receiver',
959                           ["NAME.byteOffset", this]);
960     }
961     return %_ArrayBufferViewGetByteOffset(this);
962   }
963
964   function NAME_GetLength() {
965     if (!(%_ClassOf(this) === 'NAME')) {
966       throw MakeTypeError('incompatible_method_receiver',
967                           ["NAME.length", this]);
968     }
969     return %_TypedArrayGetLength(this);
970   }
971
972   var $NAME = global.NAME;
973
974   function NAMESubArray(begin, end) {
975     if (!(%_ClassOf(this) === 'NAME')) {
976       throw MakeTypeError('incompatible_method_receiver',
977                           ["NAME.subarray", this]);
978     }
979     var beginInt = TO_INTEGER(begin);
980     if (!IS_UNDEFINED(end)) {
981       end = TO_INTEGER(end);
982     }
983
984     var srcLength = %_TypedArrayGetLength(this);
985     if (beginInt < 0) {
986       beginInt = $MathMax(0, srcLength + beginInt);
987     } else {
988       beginInt = $MathMin(srcLength, beginInt);
989     }
990
991     var endInt = IS_UNDEFINED(end) ? srcLength : end;
992     if (endInt < 0) {
993       endInt = $MathMax(0, srcLength + endInt);
994     } else {
995       endInt = $MathMin(endInt, srcLength);
996     }
997     if (endInt < beginInt) {
998       endInt = beginInt;
999     }
1000     var newLength = endInt - beginInt;
1001     var beginByteOffset =
1002         %_ArrayBufferViewGetByteOffset(this) + beginInt * ELEMENT_SIZE;
1003     return new $NAME(%TypedArrayGetBuffer(this),
1004                      beginByteOffset, newLength);
1005   }
1006 endmacro
1007
1008 SIMD128_TYPED_ARRAYS(TYPED_ARRAY_CONSTRUCTOR)
1009
1010 function SetupSIMD128TypedArrays() {
1011 macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE)
1012   %CheckIsBootstrapping();
1013   %SetCode(global.NAME, NAMEConstructor);
1014   %FunctionSetPrototype(global.NAME, new $Object());
1015
1016   %AddNamedProperty(global.NAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE,
1017                READ_ONLY | DONT_ENUM | DONT_DELETE);
1018   %AddNamedProperty(global.NAME.prototype,
1019                "constructor", global.NAME, DONT_ENUM);
1020   %AddNamedProperty(global.NAME.prototype,
1021                "BYTES_PER_ELEMENT", ELEMENT_SIZE,
1022                READ_ONLY | DONT_ENUM | DONT_DELETE);
1023   InstallGetter(global.NAME.prototype, "buffer", NAME_GetBuffer);
1024   InstallGetter(global.NAME.prototype, "byteOffset", NAME_GetByteOffset);
1025   InstallGetter(global.NAME.prototype, "byteLength", NAME_GetByteLength);
1026   InstallGetter(global.NAME.prototype, "length", NAME_GetLength);
1027
1028   InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array(
1029         "subarray", NAMESubArray,
1030         "set", TypedArraySet
1031   ));
1032 endmacro
1033
1034 SIMD128_TYPED_ARRAYS(SETUP_TYPED_ARRAY)
1035 }
1036
1037 SetupSIMD128TypedArrays();
1038
1039 macro DECLARE_TYPED_ARRAY_FUNCTION(NAME)
1040 function NAMEArrayGet(i) {
1041   return this[i];
1042 }
1043
1044 function NAMEArraySet(i, v) {
1045   CheckNAME(v);
1046   this[i] = v;
1047 }
1048
1049 function SetUpNAMEArray() {
1050   InstallFunctions(global.NAMEArray.prototype, DONT_ENUM, $Array(
1051     "getAt", NAMEArrayGet,
1052     "setAt", NAMEArraySet
1053   ));
1054 }
1055 endmacro
1056
1057 DECLARE_TYPED_ARRAY_FUNCTION(Float32x4)
1058 DECLARE_TYPED_ARRAY_FUNCTION(Float64x2)
1059 DECLARE_TYPED_ARRAY_FUNCTION(Int32x4)
1060
1061 SetUpFloat32x4Array();
1062 SetUpFloat64x2Array();
1063 SetUpInt32x4Array();