b95.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft Corporation and contributors. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function asmModule(stdlib, imports) {
  6. "use asm";
  7. var i16 = stdlib.SIMD.Int8x16;
  8. var i16c = i16.check;
  9. var i4 = stdlib.SIMD.Int32x4;
  10. var i16shiftRightByScalar = i16.shiftRightByScalar;
  11. var i16add = i16.add;
  12. var i4extractLane = i4.extractLane;
  13. function f2(a)
  14. {
  15. a = i16c(a);
  16. return a;
  17. }
  18. function testShiftLeftScalarLocal()
  19. {
  20. var a = i16(255, 40, -40, 40, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
  21. var b = i4(255,0,0,0);
  22. var i = 0;
  23. i = i4extractLane (b, 0);
  24. a = i16shiftRightByScalar(a, i >>> 0);
  25. a = i16c(f2(a));
  26. return i|0;
  27. }
  28. return {
  29. testShiftLeftScalarLocal: testShiftLeftScalarLocal };
  30. }
  31. var m = asmModule(this, {});
  32. print (m.testShiftLeftScalarLocal());
  33. print (m.testShiftLeftScalarLocal());