testSelect.js 1010 B

12345678910111213141516171819202122232425262728293031
  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 testSelect() {
  12. print("Int32x4 Select");
  13. var m = SIMD.Bool32x4(true, true, false, false);
  14. var t = SIMD.Int32x4(1, 2, 3, 4);
  15. var f = SIMD.Int32x4(5, 6, 7, 8);
  16. var s = SIMD.Int32x4.select(m, t, f);
  17. equal(1, SIMD.Int32x4.extractLane(s, 0));
  18. equal(2, SIMD.Int32x4.extractLane(s, 1));
  19. equal(7, SIMD.Int32x4.extractLane(s, 2));
  20. equal(8, SIMD.Int32x4.extractLane(s, 3));
  21. }
  22. testSelect();
  23. testSelect();
  24. testSelect();
  25. testSelect();
  26. testSelect();
  27. testSelect();
  28. testSelect();