testSelect.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. {
  8. print("Correct");
  9. }
  10. else
  11. {
  12. print(">> Fail!");
  13. }
  14. }
  15. function testSelect() {
  16. print("Float32x4 Select");
  17. var m = SIMD.Int32x4.bool(true, true, false, false);
  18. var t = SIMD.Float32x4(1.0, 2.0, 3.0, 4.0);
  19. var f = SIMD.Float32x4(5.0, 6.0, 7.0, 8.0);
  20. var s = SIMD.Float32x4.select(m, t, f);
  21. equal(1.0, SIMD.Float32x4.extractLane(s, 0));
  22. equal(2.0, SIMD.Float32x4.extractLane(s, 1));
  23. equal(7.0, SIMD.Float32x4.extractLane(s, 2));
  24. equal(8.0, SIMD.Float32x4.extractLane(s, 3));
  25. }
  26. testSelect();
  27. testSelect();
  28. testSelect();
  29. testSelect();
  30. testSelect();
  31. testSelect();
  32. testSelect();