-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MERGE #941] Asm.js Simd.js : Fix for simd shr sequence cloberring th…
…e source reg value Merge pull request #941 from Krovatkin:b95_onto_r12_test
- Loading branch information
Showing
13 changed files
with
136 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Successfully compiled asm.js code | ||
SIMD.Int32x4(1, 2, 3, 4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft Corporation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
|
||
function asmModule(stdlib, imports,buffer) { | ||
"use asm"; | ||
var i4 = stdlib.SIMD.Int32x4; | ||
var i4check = i4.check; | ||
var i4shiftLeftByScalar = i4.shiftLeftByScalar; | ||
var i4shiftRightByScalar = i4.shiftRightByScalar; | ||
var u4 = stdlib.SIMD.Uint32x4; | ||
var u4check = u4.check; | ||
var u4shiftLeftByScalar = u4.shiftLeftByScalar ; | ||
var u4shiftRightByScalar= u4.shiftRightByScalar ; | ||
var loopCOUNT = 3; | ||
|
||
function func1(a) | ||
{ | ||
a = i4check(a); | ||
var x = u4(0, 0, 0, 0); | ||
var y = u4(0, 0, 0, 0); | ||
var loopIndex = 0; | ||
var loopCOUNT = 3; | ||
|
||
while ( (loopIndex|0) < (loopCOUNT|0)) { | ||
x = u4shiftLeftByScalar(x, loopIndex); | ||
y = u4shiftRightByScalar(y, loopIndex); | ||
|
||
loopIndex = (loopIndex + 1) | 0; | ||
} | ||
return i4check(a); | ||
} | ||
return {func1:func1}; | ||
} | ||
|
||
var buffer = new ArrayBuffer(0x10000); | ||
var m = asmModule(this, {}, buffer); | ||
|
||
var v = SIMD.Int32x4(1, 2, 3, 4 ); | ||
|
||
var ret1 = m.func1(v); | ||
print(ret1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Successfully compiled asm.js code | ||
255 | ||
255 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft Corporation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
function asmModule(stdlib, imports) { | ||
"use asm"; | ||
|
||
var i16 = stdlib.SIMD.Int8x16; | ||
var i16c = i16.check; | ||
var i4 = stdlib.SIMD.Int32x4; | ||
var i16shiftRightByScalar = i16.shiftRightByScalar; | ||
var i16add = i16.add; | ||
var i4extractLane = i4.extractLane; | ||
|
||
function f2(a) | ||
{ | ||
a = i16c(a); | ||
return a; | ||
} | ||
|
||
function testShiftLeftScalarLocal() | ||
{ | ||
var a = i16(255, 40, -40, 40, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); | ||
var b = i4(255,0,0,0); | ||
var i = 0; | ||
i = i4extractLane (b, 0); | ||
a = i16shiftRightByScalar(a, i >>> 0); | ||
a = i16c(f2(a)); | ||
return i|0; | ||
} | ||
|
||
return { | ||
testShiftLeftScalarLocal: testShiftLeftScalarLocal }; | ||
} | ||
|
||
var m = asmModule(this, {}); | ||
|
||
print (m.testShiftLeftScalarLocal()); | ||
print (m.testShiftLeftScalarLocal()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.