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