testZeroSplatBool.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function equal(a, b) {
  6. if (a == b)
  7. print("Correct");
  8. else
  9. print(">> Fail!");
  10. }
  11. function testSplat() {
  12. var n = SIMD.Int32x4.splat(3);
  13. print("splat");
  14. equal(3, SIMD.Int32x4.extractLane(n, 0));
  15. equal(3, SIMD.Int32x4.extractLane(n, 1));
  16. equal(3, SIMD.Int32x4.extractLane(n, 2));
  17. equal(3, SIMD.Int32x4.extractLane(n, 3));
  18. }
  19. function testBool() {
  20. var n = SIMD.Int32x4.bool(true, false, true, false);
  21. print("bool");
  22. equal(-1, SIMD.Int32x4.extractLane(n, 0));
  23. equal(0, SIMD.Int32x4.extractLane(n, 1));
  24. equal(-1, SIMD.Int32x4.extractLane(n, 2));
  25. equal(0, SIMD.Int32x4.extractLane(n, 3));
  26. }
  27. testSplat();
  28. testSplat();
  29. testSplat();
  30. testSplat();
  31. testSplat();
  32. testSplat();
  33. testSplat();
  34. testSplat();
  35. testBool();
  36. testBool();
  37. testBool();
  38. testBool();
  39. testBool();
  40. testBool();
  41. testBool();
  42. testBool();