harmony-simd.js 25.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

(function(global, utils) {

"use strict";

%CheckIsBootstrapping();

// -------------------------------------------------------------------
// Imports

var GlobalSIMD = global.SIMD;
15
var MakeTypeError;
16
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
17

18 19 20 21 22 23
utils.Import(function(from) {
  MakeTypeError = from.MakeTypeError;
});

// -------------------------------------------------------------------

24
macro SIMD_FLOAT_TYPES(FUNCTION)
25
FUNCTION(Float32x4, float32x4, 4)
26 27 28
endmacro

macro SIMD_INT_TYPES(FUNCTION)
29 30 31
FUNCTION(Int32x4, int32x4, 4)
FUNCTION(Int16x8, int16x8, 8)
FUNCTION(Int8x16, int8x16, 16)
32 33
endmacro

34 35 36 37 38 39
macro SIMD_UINT_TYPES(FUNCTION)
FUNCTION(Uint32x4, uint32x4, 4)
FUNCTION(Uint16x8, uint16x8, 8)
FUNCTION(Uint8x16, uint8x16, 16)
endmacro

40 41 42
macro SIMD_BOOL_TYPES(FUNCTION)
FUNCTION(Bool32x4, bool32x4, 4)
FUNCTION(Bool16x8, bool16x8, 8)
43 44
FUNCTION(Bool8x16, bool8x16, 16)
endmacro
45

46 47 48
macro SIMD_ALL_TYPES(FUNCTION)
SIMD_FLOAT_TYPES(FUNCTION)
SIMD_INT_TYPES(FUNCTION)
49
SIMD_UINT_TYPES(FUNCTION)
50 51 52
SIMD_BOOL_TYPES(FUNCTION)
endmacro

53 54 55
macro DECLARE_GLOBALS(NAME, TYPE, LANES)
var GlobalNAME = GlobalSIMD.NAME;
endmacro
56

57
SIMD_ALL_TYPES(DECLARE_GLOBALS)
58

59 60 61
macro DECLARE_COMMON_FUNCTIONS(NAME, TYPE, LANES)
function NAMECheckJS(a) {
  return %NAMECheck(a);
62 63
}

64
function NAMEToString() {
65 66
  var value = %_ValueOf(this);
  if (typeof(value) !== 'TYPE') {
67
    throw MakeTypeError(kIncompatibleMethodReceiver,
68
                        "NAME.prototype.toString", this);
69
  }
70 71 72 73 74 75
  var str = "SIMD.NAME(";
  str += %NAMEExtractLane(value, 0);
  for (var i = 1; i < LANES; i++) {
    str += ", " + %NAMEExtractLane(value, i);
  }
  return str + ")";
76 77
}

78
function NAMEToLocaleString() {
79 80
  var value = %_ValueOf(this);
  if (typeof(value) !== 'TYPE') {
81
    throw MakeTypeError(kIncompatibleMethodReceiver,
82
                        "NAME.prototype.toLocaleString", this);
83
  }
84 85 86 87 88 89
  var str = "SIMD.NAME(";
  str += %NAMEExtractLane(value, 0).toLocaleString();
  for (var i = 1; i < LANES; i++) {
    str += ", " + %NAMEExtractLane(value, i).toLocaleString();
  }
  return str + ")";
90 91
}

92
function NAMEValueOf() {
93 94
  var value = %_ValueOf(this);
  if (typeof(value) !== 'TYPE') {
95
    throw MakeTypeError(kIncompatibleMethodReceiver,
96
                        "NAME.prototype.valueOf", this);
97
  }
98
  return value;
99 100
}

101 102 103
function NAMEExtractLaneJS(instance, lane) {
  return %NAMEExtractLane(instance, lane);
}
104
endmacro
105

106 107
SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS)

108
macro DECLARE_SHIFT_FUNCTIONS(NAME, TYPE, LANES)
109 110
function NAMEShiftLeftByScalarJS(instance, shift) {
  return %NAMEShiftLeftByScalar(instance, shift);
111
}
112

113 114
function NAMEShiftRightByScalarJS(instance, shift) {
  return %NAMEShiftRightByScalar(instance, shift);
115
}
116 117
endmacro

118 119
SIMD_INT_TYPES(DECLARE_SHIFT_FUNCTIONS)
SIMD_UINT_TYPES(DECLARE_SHIFT_FUNCTIONS)
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147

macro SIMD_SMALL_INT_TYPES(FUNCTION)
FUNCTION(Int16x8)
FUNCTION(Int8x16)
FUNCTION(Uint8x16)
FUNCTION(Uint16x8)
endmacro

macro DECLARE_SMALL_INT_FUNCTIONS(NAME)
function NAMEAddSaturateJS(a, b) {
  return %NAMEAddSaturate(a, b);
}

function NAMESubSaturateJS(a, b) {
  return %NAMESubSaturate(a, b);
}
endmacro

SIMD_SMALL_INT_TYPES(DECLARE_SMALL_INT_FUNCTIONS)

macro DECLARE_SIGNED_FUNCTIONS(NAME, TYPE, LANES)
function NAMENegJS(a) {
  return %NAMENeg(a);
}
endmacro

SIMD_FLOAT_TYPES(DECLARE_SIGNED_FUNCTIONS)
SIMD_INT_TYPES(DECLARE_SIGNED_FUNCTIONS)
148 149

macro DECLARE_BOOL_FUNCTIONS(NAME, TYPE, LANES)
150 151 152
function NAMEReplaceLaneJS(instance, lane, value) {
  return %NAMEReplaceLane(instance, lane, value);
}
153 154 155 156 157 158 159 160

function NAMEAnyTrueJS(s) {
  return %NAMEAnyTrue(s);
}

function NAMEAllTrueJS(s) {
  return %NAMEAllTrue(s);
}
161 162 163 164
endmacro

SIMD_BOOL_TYPES(DECLARE_BOOL_FUNCTIONS)

165 166 167
macro SIMD_NUMERIC_TYPES(FUNCTION)
SIMD_FLOAT_TYPES(FUNCTION)
SIMD_INT_TYPES(FUNCTION)
168
SIMD_UINT_TYPES(FUNCTION)
169 170 171 172
endmacro

macro DECLARE_NUMERIC_FUNCTIONS(NAME, TYPE, LANES)
function NAMEReplaceLaneJS(instance, lane, value) {
173
  return %NAMEReplaceLane(instance, lane, TO_NUMBER(value));
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
}

function NAMESelectJS(selector, a, b) {
  return %NAMESelect(selector, a, b);
}

function NAMEAddJS(a, b) {
  return %NAMEAdd(a, b);
}

function NAMESubJS(a, b) {
  return %NAMESub(a, b);
}

function NAMEMulJS(a, b) {
  return %NAMEMul(a, b);
}

function NAMEMinJS(a, b) {
  return %NAMEMin(a, b);
}

function NAMEMaxJS(a, b) {
  return %NAMEMax(a, b);
}

200 201 202 203 204 205 206 207
function NAMEEqualJS(a, b) {
  return %NAMEEqual(a, b);
}

function NAMENotEqualJS(a, b) {
  return %NAMENotEqual(a, b);
}

208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
function NAMELessThanJS(a, b) {
  return %NAMELessThan(a, b);
}

function NAMELessThanOrEqualJS(a, b) {
  return %NAMELessThanOrEqual(a, b);
}

function NAMEGreaterThanJS(a, b) {
  return %NAMEGreaterThan(a, b);
}

function NAMEGreaterThanOrEqualJS(a, b) {
  return %NAMEGreaterThanOrEqual(a, b);
}
223 224 225 226

function NAMELoadJS(tarray, index) {
  return %NAMELoad(tarray, index);
}
227 228 229 230

function NAMEStoreJS(tarray, index, a) {
  return %NAMEStore(tarray, index, a);
}
231 232 233 234 235 236
endmacro

SIMD_NUMERIC_TYPES(DECLARE_NUMERIC_FUNCTIONS)

macro SIMD_LOGICAL_TYPES(FUNCTION)
SIMD_INT_TYPES(FUNCTION)
237
SIMD_UINT_TYPES(FUNCTION)
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
SIMD_BOOL_TYPES(FUNCTION)
endmacro

macro DECLARE_LOGICAL_FUNCTIONS(NAME, TYPE, LANES)
function NAMEAndJS(a, b) {
  return %NAMEAnd(a, b);
}

function NAMEOrJS(a, b) {
  return %NAMEOr(a, b);
}

function NAMEXorJS(a, b) {
  return %NAMEXor(a, b);
}

function NAMENotJS(a) {
  return %NAMENot(a);
}
endmacro

SIMD_LOGICAL_TYPES(DECLARE_LOGICAL_FUNCTIONS)

macro SIMD_FROM_TYPES(FUNCTION)
FUNCTION(Float32x4, Int32x4)
263
FUNCTION(Float32x4, Uint32x4)
264
FUNCTION(Int32x4, Float32x4)
265 266 267 268 269 270 271
FUNCTION(Int32x4, Uint32x4)
FUNCTION(Uint32x4, Float32x4)
FUNCTION(Uint32x4, Int32x4)
FUNCTION(Int16x8, Uint16x8)
FUNCTION(Uint16x8, Int16x8)
FUNCTION(Int8x16, Uint8x16)
FUNCTION(Uint8x16, Int8x16)
272 273 274 275 276 277 278 279 280 281 282 283
endmacro

macro DECLARE_FROM_FUNCTIONS(TO, FROM)
function TOFromFROMJS(a) {
  return %TOFromFROM(a);
}
endmacro

SIMD_FROM_TYPES(DECLARE_FROM_FUNCTIONS)

macro SIMD_FROM_BITS_TYPES(FUNCTION)
FUNCTION(Float32x4, Int32x4)
284
FUNCTION(Float32x4, Uint32x4)
285
FUNCTION(Float32x4, Int16x8)
286
FUNCTION(Float32x4, Uint16x8)
287
FUNCTION(Float32x4, Int8x16)
288
FUNCTION(Float32x4, Uint8x16)
289
FUNCTION(Int32x4, Float32x4)
290
FUNCTION(Int32x4, Uint32x4)
291
FUNCTION(Int32x4, Int16x8)
292
FUNCTION(Int32x4, Uint16x8)
293
FUNCTION(Int32x4, Int8x16)
294 295 296 297 298 299 300
FUNCTION(Int32x4, Uint8x16)
FUNCTION(Uint32x4, Float32x4)
FUNCTION(Uint32x4, Int32x4)
FUNCTION(Uint32x4, Int16x8)
FUNCTION(Uint32x4, Uint16x8)
FUNCTION(Uint32x4, Int8x16)
FUNCTION(Uint32x4, Uint8x16)
301 302
FUNCTION(Int16x8, Float32x4)
FUNCTION(Int16x8, Int32x4)
303 304
FUNCTION(Int16x8, Uint32x4)
FUNCTION(Int16x8, Uint16x8)
305
FUNCTION(Int16x8, Int8x16)
306 307 308 309 310 311 312
FUNCTION(Int16x8, Uint8x16)
FUNCTION(Uint16x8, Float32x4)
FUNCTION(Uint16x8, Int32x4)
FUNCTION(Uint16x8, Uint32x4)
FUNCTION(Uint16x8, Int16x8)
FUNCTION(Uint16x8, Int8x16)
FUNCTION(Uint16x8, Uint8x16)
313 314
FUNCTION(Int8x16, Float32x4)
FUNCTION(Int8x16, Int32x4)
315
FUNCTION(Int8x16, Uint32x4)
316
FUNCTION(Int8x16, Int16x8)
317 318 319 320 321 322 323 324
FUNCTION(Int8x16, Uint16x8)
FUNCTION(Int8x16, Uint8x16)
FUNCTION(Uint8x16, Float32x4)
FUNCTION(Uint8x16, Int32x4)
FUNCTION(Uint8x16, Uint32x4)
FUNCTION(Uint8x16, Int16x8)
FUNCTION(Uint8x16, Uint16x8)
FUNCTION(Uint8x16, Int8x16)
325 326 327 328 329 330 331 332 333 334
endmacro

macro DECLARE_FROM_BITS_FUNCTIONS(TO, FROM)
function TOFromFROMBitsJS(a) {
  return %TOFromFROMBits(a);
}
endmacro

SIMD_FROM_BITS_TYPES(DECLARE_FROM_BITS_FUNCTIONS)

335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351

macro SIMD_LOADN_STOREN_TYPES(FUNCTION)
FUNCTION(Float32x4, 1)
FUNCTION(Float32x4, 2)
FUNCTION(Float32x4, 3)
FUNCTION(Int32x4, 1)
FUNCTION(Int32x4, 2)
FUNCTION(Int32x4, 3)
FUNCTION(Uint32x4, 1)
FUNCTION(Uint32x4, 2)
FUNCTION(Uint32x4, 3)
endmacro

macro DECLARE_LOADN_STOREN_FUNCTIONS(NAME, COUNT)
function NAMELoadCOUNTJS(tarray, index) {
  return %NAMELoadCOUNT(tarray, index);
}
352 353 354 355

function NAMEStoreCOUNTJS(tarray, index, a) {
  return %NAMEStoreCOUNT(tarray, index, a);
}
356 357 358 359
endmacro

SIMD_LOADN_STOREN_TYPES(DECLARE_LOADN_STOREN_FUNCTIONS)

360 361
//-------------------------------------------------------------------

362 363 364 365 366 367
macro SIMD_X4_TYPES(FUNCTION)
FUNCTION(Float32x4)
FUNCTION(Int32x4)
FUNCTION(Uint32x4)
FUNCTION(Bool32x4)
endmacro
368

369 370 371
macro DECLARE_X4_FUNCTIONS(NAME)
function NAMESplat(s) {
  return %CreateNAME(s, s, s, s);
372 373
}

374 375
function NAMESwizzleJS(a, c0, c1, c2, c3) {
  return %NAMESwizzle(a, c0, c1, c2, c3);
376 377
}

378 379
function NAMEShuffleJS(a, b, c0, c1, c2, c3) {
  return %NAMEShuffle(a, b, c0, c1, c2, c3);
380
}
381
endmacro
382

383
SIMD_X4_TYPES(DECLARE_X4_FUNCTIONS)
384

385 386 387 388 389
macro SIMD_X8_TYPES(FUNCTION)
FUNCTION(Int16x8)
FUNCTION(Uint16x8)
FUNCTION(Bool16x8)
endmacro
390

391 392 393
macro DECLARE_X8_FUNCTIONS(NAME)
function NAMESplat(s) {
  return %CreateNAME(s, s, s, s, s, s, s, s);
394 395
}

396 397
function NAMESwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
  return %NAMESwizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
398 399
}

400 401
function NAMEShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
  return %NAMEShuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
402
}
403
endmacro
404

405
SIMD_X8_TYPES(DECLARE_X8_FUNCTIONS)
406

407 408 409 410 411 412 413 414 415
macro SIMD_X16_TYPES(FUNCTION)
FUNCTION(Int8x16)
FUNCTION(Uint8x16)
FUNCTION(Bool8x16)
endmacro

macro DECLARE_X16_FUNCTIONS(NAME)
function NAMESplat(s) {
  return %CreateNAME(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
416 417
}

418 419 420 421 422
function NAMESwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
                          c12, c13, c14, c15) {
  return %NAMESwizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
                         c12, c13, c14, c15);
}
423

424 425 426 427
function NAMEShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
                             c11, c12, c13, c14, c15) {
  return %NAMEShuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
                            c11, c12, c13, c14, c15);
428
}
429
endmacro
430

431
SIMD_X16_TYPES(DECLARE_X16_FUNCTIONS)
432

433 434 435
//-------------------------------------------------------------------

function Float32x4Constructor(c0, c1, c2, c3) {
436 437 438
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Float32x4");
  }
439 440
  return %CreateFloat32x4(TO_NUMBER(c0), TO_NUMBER(c1),
                          TO_NUMBER(c2), TO_NUMBER(c3));
441 442 443
}


444
function Int32x4Constructor(c0, c1, c2, c3) {
445 446 447
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Int32x4");
  }
448 449
  return %CreateInt32x4(TO_NUMBER(c0), TO_NUMBER(c1),
                        TO_NUMBER(c2), TO_NUMBER(c3));
450 451 452
}


453
function Uint32x4Constructor(c0, c1, c2, c3) {
454 455 456
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Uint32x4");
  }
457 458
  return %CreateUint32x4(TO_NUMBER(c0), TO_NUMBER(c1),
                         TO_NUMBER(c2), TO_NUMBER(c3));
459 460 461
}


462
function Bool32x4Constructor(c0, c1, c2, c3) {
463 464 465
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Bool32x4");
  }
466 467 468 469 470
  return %CreateBool32x4(c0, c1, c2, c3);
}


function Int16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
471 472 473
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Int16x8");
  }
474 475 476 477
  return %CreateInt16x8(TO_NUMBER(c0), TO_NUMBER(c1),
                        TO_NUMBER(c2), TO_NUMBER(c3),
                        TO_NUMBER(c4), TO_NUMBER(c5),
                        TO_NUMBER(c6), TO_NUMBER(c7));
478 479 480
}


481
function Uint16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
482 483 484
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Uint16x8");
  }
485 486 487 488
  return %CreateUint16x8(TO_NUMBER(c0), TO_NUMBER(c1),
                         TO_NUMBER(c2), TO_NUMBER(c3),
                         TO_NUMBER(c4), TO_NUMBER(c5),
                         TO_NUMBER(c6), TO_NUMBER(c7));
489 490 491
}


492
function Bool16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
493 494 495
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Bool16x8");
  }
496 497 498 499 500 501
  return %CreateBool16x8(c0, c1, c2, c3, c4, c5, c6, c7);
}


function Int8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
                            c12, c13, c14, c15) {
502 503 504
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Int8x16");
  }
505 506 507 508 509 510 511 512
  return %CreateInt8x16(TO_NUMBER(c0), TO_NUMBER(c1),
                        TO_NUMBER(c2), TO_NUMBER(c3),
                        TO_NUMBER(c4), TO_NUMBER(c5),
                        TO_NUMBER(c6), TO_NUMBER(c7),
                        TO_NUMBER(c8), TO_NUMBER(c9),
                        TO_NUMBER(c10), TO_NUMBER(c11),
                        TO_NUMBER(c12), TO_NUMBER(c13),
                        TO_NUMBER(c14), TO_NUMBER(c15));
513 514 515
}


516 517
function Uint8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
                             c12, c13, c14, c15) {
518 519 520
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Uint8x16");
  }
521 522 523 524 525 526 527 528
  return %CreateUint8x16(TO_NUMBER(c0), TO_NUMBER(c1),
                         TO_NUMBER(c2), TO_NUMBER(c3),
                         TO_NUMBER(c4), TO_NUMBER(c5),
                         TO_NUMBER(c6), TO_NUMBER(c7),
                         TO_NUMBER(c8), TO_NUMBER(c9),
                         TO_NUMBER(c10), TO_NUMBER(c11),
                         TO_NUMBER(c12), TO_NUMBER(c13),
                         TO_NUMBER(c14), TO_NUMBER(c15));
529 530 531
}


532 533
function Bool8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
                             c12, c13, c14, c15) {
534 535 536
  if (!IS_UNDEFINED(new.target)) {
    throw MakeTypeError(kNotConstructor, "Bool8x16");
  }
537 538
  return %CreateBool8x16(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
                         c13, c14, c15);
539 540 541
}


542 543
function Float32x4AbsJS(a) {
  return %Float32x4Abs(a);
544 545 546
}


547 548
function Float32x4SqrtJS(a) {
  return %Float32x4Sqrt(a);
549 550 551
}


552 553 554 555 556 557 558 559 560 561 562 563
function Float32x4RecipApproxJS(a) {
  return %Float32x4RecipApprox(a);
}


function Float32x4RecipSqrtApproxJS(a) {
  return %Float32x4RecipSqrtApprox(a);
}


function Float32x4DivJS(a, b) {
  return %Float32x4Div(a, b);
564 565 566
}


567 568
function Float32x4MinNumJS(a, b) {
  return %Float32x4MinNum(a, b);
569 570 571
}


572 573
function Float32x4MaxNumJS(a, b) {
  return %Float32x4MaxNum(a, b);
574 575 576
}


577
%AddNamedProperty(GlobalSIMD, toStringTagSymbol, 'SIMD', READ_ONLY | DONT_ENUM);
578

579 580 581 582 583
macro SETUP_SIMD_TYPE(NAME, TYPE, LANES)
%SetCode(GlobalNAME, NAMEConstructor);
%FunctionSetPrototype(GlobalNAME, {});
%AddNamedProperty(GlobalNAME.prototype, 'constructor', GlobalNAME,
    DONT_ENUM);
584
%AddNamedProperty(GlobalNAME.prototype, toStringTagSymbol, 'NAME',
585
    DONT_ENUM | READ_ONLY);
586 587 588 589
utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [
  'toLocaleString', NAMEToLocaleString,
  'toString', NAMEToString,
  'valueOf', NAMEValueOf,
590
]);
591 592
endmacro

593
SIMD_ALL_TYPES(SETUP_SIMD_TYPE)
594 595

//-------------------------------------------------------------------
596 597 598 599 600

utils.InstallFunctions(GlobalFloat32x4, DONT_ENUM, [
  'splat', Float32x4Splat,
  'check', Float32x4CheckJS,
  'extractLane', Float32x4ExtractLaneJS,
601
  'replaceLane', Float32x4ReplaceLaneJS,
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
  'neg', Float32x4NegJS,
  'abs', Float32x4AbsJS,
  'sqrt', Float32x4SqrtJS,
  'reciprocalApproximation', Float32x4RecipApproxJS,
  'reciprocalSqrtApproximation', Float32x4RecipSqrtApproxJS,
  'add', Float32x4AddJS,
  'sub', Float32x4SubJS,
  'mul', Float32x4MulJS,
  'div', Float32x4DivJS,
  'min', Float32x4MinJS,
  'max', Float32x4MaxJS,
  'minNum', Float32x4MinNumJS,
  'maxNum', Float32x4MaxNumJS,
  'lessThan', Float32x4LessThanJS,
  'lessThanOrEqual', Float32x4LessThanOrEqualJS,
  'greaterThan', Float32x4GreaterThanJS,
  'greaterThanOrEqual', Float32x4GreaterThanOrEqualJS,
  'equal', Float32x4EqualJS,
  'notEqual', Float32x4NotEqualJS,
  'select', Float32x4SelectJS,
  'swizzle', Float32x4SwizzleJS,
  'shuffle', Float32x4ShuffleJS,
  'fromInt32x4', Float32x4FromInt32x4JS,
625
  'fromUint32x4', Float32x4FromUint32x4JS,
626
  'fromInt32x4Bits', Float32x4FromInt32x4BitsJS,
627
  'fromUint32x4Bits', Float32x4FromUint32x4BitsJS,
628
  'fromInt16x8Bits', Float32x4FromInt16x8BitsJS,
629
  'fromUint16x8Bits', Float32x4FromUint16x8BitsJS,
630
  'fromInt8x16Bits', Float32x4FromInt8x16BitsJS,
631
  'fromUint8x16Bits', Float32x4FromUint8x16BitsJS,
632 633 634 635
  'load', Float32x4LoadJS,
  'load1', Float32x4Load1JS,
  'load2', Float32x4Load2JS,
  'load3', Float32x4Load3JS,
636 637 638 639
  'store', Float32x4StoreJS,
  'store1', Float32x4Store1JS,
  'store2', Float32x4Store2JS,
  'store3', Float32x4Store3JS,
640 641 642 643 644 645 646
]);

utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [
  'splat', Int32x4Splat,
  'check', Int32x4CheckJS,
  'extractLane', Int32x4ExtractLaneJS,
  'replaceLane', Int32x4ReplaceLaneJS,
647 648 649 650 651 652 653 654 655 656 657
  'neg', Int32x4NegJS,
  'add', Int32x4AddJS,
  'sub', Int32x4SubJS,
  'mul', Int32x4MulJS,
  'min', Int32x4MinJS,
  'max', Int32x4MaxJS,
  'and', Int32x4AndJS,
  'or', Int32x4OrJS,
  'xor', Int32x4XorJS,
  'not', Int32x4NotJS,
  'shiftLeftByScalar', Int32x4ShiftLeftByScalarJS,
658
  'shiftRightByScalar', Int32x4ShiftRightByScalarJS,
659 660 661 662 663 664 665 666 667 668
  'lessThan', Int32x4LessThanJS,
  'lessThanOrEqual', Int32x4LessThanOrEqualJS,
  'greaterThan', Int32x4GreaterThanJS,
  'greaterThanOrEqual', Int32x4GreaterThanOrEqualJS,
  'equal', Int32x4EqualJS,
  'notEqual', Int32x4NotEqualJS,
  'select', Int32x4SelectJS,
  'swizzle', Int32x4SwizzleJS,
  'shuffle', Int32x4ShuffleJS,
  'fromFloat32x4', Int32x4FromFloat32x4JS,
669
  'fromUint32x4', Int32x4FromUint32x4JS,
670
  'fromFloat32x4Bits', Int32x4FromFloat32x4BitsJS,
671
  'fromUint32x4Bits', Int32x4FromUint32x4BitsJS,
672
  'fromInt16x8Bits', Int32x4FromInt16x8BitsJS,
673
  'fromUint16x8Bits', Int32x4FromUint16x8BitsJS,
674
  'fromInt8x16Bits', Int32x4FromInt8x16BitsJS,
675
  'fromUint8x16Bits', Int32x4FromUint8x16BitsJS,
676 677 678 679
  'load', Int32x4LoadJS,
  'load1', Int32x4Load1JS,
  'load2', Int32x4Load2JS,
  'load3', Int32x4Load3JS,
680 681 682 683
  'store', Int32x4StoreJS,
  'store1', Int32x4Store1JS,
  'store2', Int32x4Store2JS,
  'store3', Int32x4Store3JS,
684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700
]);

utils.InstallFunctions(GlobalUint32x4, DONT_ENUM, [
  'splat', Uint32x4Splat,
  'check', Uint32x4CheckJS,
  'extractLane', Uint32x4ExtractLaneJS,
  'replaceLane', Uint32x4ReplaceLaneJS,
  'add', Uint32x4AddJS,
  'sub', Uint32x4SubJS,
  'mul', Uint32x4MulJS,
  'min', Uint32x4MinJS,
  'max', Uint32x4MaxJS,
  'and', Uint32x4AndJS,
  'or', Uint32x4OrJS,
  'xor', Uint32x4XorJS,
  'not', Uint32x4NotJS,
  'shiftLeftByScalar', Uint32x4ShiftLeftByScalarJS,
701
  'shiftRightByScalar', Uint32x4ShiftRightByScalarJS,
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
  'lessThan', Uint32x4LessThanJS,
  'lessThanOrEqual', Uint32x4LessThanOrEqualJS,
  'greaterThan', Uint32x4GreaterThanJS,
  'greaterThanOrEqual', Uint32x4GreaterThanOrEqualJS,
  'equal', Uint32x4EqualJS,
  'notEqual', Uint32x4NotEqualJS,
  'select', Uint32x4SelectJS,
  'swizzle', Uint32x4SwizzleJS,
  'shuffle', Uint32x4ShuffleJS,
  'fromFloat32x4', Uint32x4FromFloat32x4JS,
  'fromInt32x4', Uint32x4FromInt32x4JS,
  'fromFloat32x4Bits', Uint32x4FromFloat32x4BitsJS,
  'fromInt32x4Bits', Uint32x4FromInt32x4BitsJS,
  'fromInt16x8Bits', Uint32x4FromInt16x8BitsJS,
  'fromUint16x8Bits', Uint32x4FromUint16x8BitsJS,
  'fromInt8x16Bits', Uint32x4FromInt8x16BitsJS,
  'fromUint8x16Bits', Uint32x4FromUint8x16BitsJS,
719 720 721 722
  'load', Uint32x4LoadJS,
  'load1', Uint32x4Load1JS,
  'load2', Uint32x4Load2JS,
  'load3', Uint32x4Load3JS,
723 724 725 726
  'store', Uint32x4StoreJS,
  'store1', Uint32x4Store1JS,
  'store2', Uint32x4Store2JS,
  'store3', Uint32x4Store3JS,
727 728 729 730 731 732 733
]);

utils.InstallFunctions(GlobalBool32x4, DONT_ENUM, [
  'splat', Bool32x4Splat,
  'check', Bool32x4CheckJS,
  'extractLane', Bool32x4ExtractLaneJS,
  'replaceLane', Bool32x4ReplaceLaneJS,
734 735 736 737 738 739 740 741
  'and', Bool32x4AndJS,
  'or', Bool32x4OrJS,
  'xor', Bool32x4XorJS,
  'not', Bool32x4NotJS,
  'anyTrue', Bool32x4AnyTrueJS,
  'allTrue', Bool32x4AllTrueJS,
  'swizzle', Bool32x4SwizzleJS,
  'shuffle', Bool32x4ShuffleJS,
742 743 744 745 746 747 748
]);

utils.InstallFunctions(GlobalInt16x8, DONT_ENUM, [
  'splat', Int16x8Splat,
  'check', Int16x8CheckJS,
  'extractLane', Int16x8ExtractLaneJS,
  'replaceLane', Int16x8ReplaceLaneJS,
749 750 751
  'neg', Int16x8NegJS,
  'add', Int16x8AddJS,
  'sub', Int16x8SubJS,
752 753
  'addSaturate', Int16x8AddSaturateJS,
  'subSaturate', Int16x8SubSaturateJS,
754 755 756 757 758 759 760 761
  'mul', Int16x8MulJS,
  'min', Int16x8MinJS,
  'max', Int16x8MaxJS,
  'and', Int16x8AndJS,
  'or', Int16x8OrJS,
  'xor', Int16x8XorJS,
  'not', Int16x8NotJS,
  'shiftLeftByScalar', Int16x8ShiftLeftByScalarJS,
762
  'shiftRightByScalar', Int16x8ShiftRightByScalarJS,
763 764 765 766 767 768 769 770 771
  'lessThan', Int16x8LessThanJS,
  'lessThanOrEqual', Int16x8LessThanOrEqualJS,
  'greaterThan', Int16x8GreaterThanJS,
  'greaterThanOrEqual', Int16x8GreaterThanOrEqualJS,
  'equal', Int16x8EqualJS,
  'notEqual', Int16x8NotEqualJS,
  'select', Int16x8SelectJS,
  'swizzle', Int16x8SwizzleJS,
  'shuffle', Int16x8ShuffleJS,
772
  'fromUint16x8', Int16x8FromUint16x8JS,
773 774
  'fromFloat32x4Bits', Int16x8FromFloat32x4BitsJS,
  'fromInt32x4Bits', Int16x8FromInt32x4BitsJS,
775 776
  'fromUint32x4Bits', Int16x8FromUint32x4BitsJS,
  'fromUint16x8Bits', Int16x8FromUint16x8BitsJS,
777
  'fromInt8x16Bits', Int16x8FromInt8x16BitsJS,
778
  'fromUint8x16Bits', Int16x8FromUint8x16BitsJS,
779
  'load', Int16x8LoadJS,
780
  'store', Int16x8StoreJS,
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799
]);

utils.InstallFunctions(GlobalUint16x8, DONT_ENUM, [
  'splat', Uint16x8Splat,
  'check', Uint16x8CheckJS,
  'extractLane', Uint16x8ExtractLaneJS,
  'replaceLane', Uint16x8ReplaceLaneJS,
  'add', Uint16x8AddJS,
  'sub', Uint16x8SubJS,
  'addSaturate', Uint16x8AddSaturateJS,
  'subSaturate', Uint16x8SubSaturateJS,
  'mul', Uint16x8MulJS,
  'min', Uint16x8MinJS,
  'max', Uint16x8MaxJS,
  'and', Uint16x8AndJS,
  'or', Uint16x8OrJS,
  'xor', Uint16x8XorJS,
  'not', Uint16x8NotJS,
  'shiftLeftByScalar', Uint16x8ShiftLeftByScalarJS,
800
  'shiftRightByScalar', Uint16x8ShiftRightByScalarJS,
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816
  'lessThan', Uint16x8LessThanJS,
  'lessThanOrEqual', Uint16x8LessThanOrEqualJS,
  'greaterThan', Uint16x8GreaterThanJS,
  'greaterThanOrEqual', Uint16x8GreaterThanOrEqualJS,
  'equal', Uint16x8EqualJS,
  'notEqual', Uint16x8NotEqualJS,
  'select', Uint16x8SelectJS,
  'swizzle', Uint16x8SwizzleJS,
  'shuffle', Uint16x8ShuffleJS,
  'fromInt16x8', Uint16x8FromInt16x8JS,
  'fromFloat32x4Bits', Uint16x8FromFloat32x4BitsJS,
  'fromInt32x4Bits', Uint16x8FromInt32x4BitsJS,
  'fromUint32x4Bits', Uint16x8FromUint32x4BitsJS,
  'fromInt16x8Bits', Uint16x8FromInt16x8BitsJS,
  'fromInt8x16Bits', Uint16x8FromInt8x16BitsJS,
  'fromUint8x16Bits', Uint16x8FromUint8x16BitsJS,
817
  'load', Uint16x8LoadJS,
818
  'store', Uint16x8StoreJS,
819 820
]);

821 822 823 824 825
utils.InstallFunctions(GlobalBool16x8, DONT_ENUM, [
  'splat', Bool16x8Splat,
  'check', Bool16x8CheckJS,
  'extractLane', Bool16x8ExtractLaneJS,
  'replaceLane', Bool16x8ReplaceLaneJS,
826 827 828 829 830 831 832 833
  'and', Bool16x8AndJS,
  'or', Bool16x8OrJS,
  'xor', Bool16x8XorJS,
  'not', Bool16x8NotJS,
  'anyTrue', Bool16x8AnyTrueJS,
  'allTrue', Bool16x8AllTrueJS,
  'swizzle', Bool16x8SwizzleJS,
  'shuffle', Bool16x8ShuffleJS,
834 835 836 837 838 839 840
]);

utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [
  'splat', Int8x16Splat,
  'check', Int8x16CheckJS,
  'extractLane', Int8x16ExtractLaneJS,
  'replaceLane', Int8x16ReplaceLaneJS,
841 842 843
  'neg', Int8x16NegJS,
  'add', Int8x16AddJS,
  'sub', Int8x16SubJS,
844 845
  'addSaturate', Int8x16AddSaturateJS,
  'subSaturate', Int8x16SubSaturateJS,
846 847 848 849 850 851 852 853
  'mul', Int8x16MulJS,
  'min', Int8x16MinJS,
  'max', Int8x16MaxJS,
  'and', Int8x16AndJS,
  'or', Int8x16OrJS,
  'xor', Int8x16XorJS,
  'not', Int8x16NotJS,
  'shiftLeftByScalar', Int8x16ShiftLeftByScalarJS,
854
  'shiftRightByScalar', Int8x16ShiftRightByScalarJS,
855 856 857 858 859 860 861 862 863
  'lessThan', Int8x16LessThanJS,
  'lessThanOrEqual', Int8x16LessThanOrEqualJS,
  'greaterThan', Int8x16GreaterThanJS,
  'greaterThanOrEqual', Int8x16GreaterThanOrEqualJS,
  'equal', Int8x16EqualJS,
  'notEqual', Int8x16NotEqualJS,
  'select', Int8x16SelectJS,
  'swizzle', Int8x16SwizzleJS,
  'shuffle', Int8x16ShuffleJS,
864
  'fromUint8x16', Int8x16FromUint8x16JS,
865 866
  'fromFloat32x4Bits', Int8x16FromFloat32x4BitsJS,
  'fromInt32x4Bits', Int8x16FromInt32x4BitsJS,
867
  'fromUint32x4Bits', Int8x16FromUint32x4BitsJS,
868
  'fromInt16x8Bits', Int8x16FromInt16x8BitsJS,
869 870
  'fromUint16x8Bits', Int8x16FromUint16x8BitsJS,
  'fromUint8x16Bits', Int8x16FromUint8x16BitsJS,
871
  'load', Int8x16LoadJS,
872
  'store', Int8x16StoreJS,
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891
]);

utils.InstallFunctions(GlobalUint8x16, DONT_ENUM, [
  'splat', Uint8x16Splat,
  'check', Uint8x16CheckJS,
  'extractLane', Uint8x16ExtractLaneJS,
  'replaceLane', Uint8x16ReplaceLaneJS,
  'add', Uint8x16AddJS,
  'sub', Uint8x16SubJS,
  'addSaturate', Uint8x16AddSaturateJS,
  'subSaturate', Uint8x16SubSaturateJS,
  'mul', Uint8x16MulJS,
  'min', Uint8x16MinJS,
  'max', Uint8x16MaxJS,
  'and', Uint8x16AndJS,
  'or', Uint8x16OrJS,
  'xor', Uint8x16XorJS,
  'not', Uint8x16NotJS,
  'shiftLeftByScalar', Uint8x16ShiftLeftByScalarJS,
892
  'shiftRightByScalar', Uint8x16ShiftRightByScalarJS,
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908
  'lessThan', Uint8x16LessThanJS,
  'lessThanOrEqual', Uint8x16LessThanOrEqualJS,
  'greaterThan', Uint8x16GreaterThanJS,
  'greaterThanOrEqual', Uint8x16GreaterThanOrEqualJS,
  'equal', Uint8x16EqualJS,
  'notEqual', Uint8x16NotEqualJS,
  'select', Uint8x16SelectJS,
  'swizzle', Uint8x16SwizzleJS,
  'shuffle', Uint8x16ShuffleJS,
  'fromInt8x16', Uint8x16FromInt8x16JS,
  'fromFloat32x4Bits', Uint8x16FromFloat32x4BitsJS,
  'fromInt32x4Bits', Uint8x16FromInt32x4BitsJS,
  'fromUint32x4Bits', Uint8x16FromUint32x4BitsJS,
  'fromInt16x8Bits', Uint8x16FromInt16x8BitsJS,
  'fromUint16x8Bits', Uint8x16FromUint16x8BitsJS,
  'fromInt8x16Bits', Uint8x16FromInt8x16BitsJS,
909
  'load', Uint8x16LoadJS,
910
  'store', Uint8x16StoreJS,
911 912 913 914 915 916 917
]);

utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [
  'splat', Bool8x16Splat,
  'check', Bool8x16CheckJS,
  'extractLane', Bool8x16ExtractLaneJS,
  'replaceLane', Bool8x16ReplaceLaneJS,
918 919 920 921 922 923 924 925
  'and', Bool8x16AndJS,
  'or', Bool8x16OrJS,
  'xor', Bool8x16XorJS,
  'not', Bool8x16NotJS,
  'anyTrue', Bool8x16AnyTrueJS,
  'allTrue', Bool8x16AllTrueJS,
  'swizzle', Bool8x16SwizzleJS,
  'shuffle', Bool8x16ShuffleJS,
926
]);
927

928 929 930
utils.Export(function(to) {
  to.Float32x4ToString = Float32x4ToString;
  to.Int32x4ToString = Int32x4ToString;
931
  to.Uint32x4ToString = Uint32x4ToString;
932 933
  to.Bool32x4ToString = Bool32x4ToString;
  to.Int16x8ToString = Int16x8ToString;
934
  to.Uint16x8ToString = Uint16x8ToString;
935 936
  to.Bool16x8ToString = Bool16x8ToString;
  to.Int8x16ToString = Int8x16ToString;
937
  to.Uint8x16ToString = Uint8x16ToString;
938 939 940
  to.Bool8x16ToString = Bool8x16ToString;
});

941
})