diff --git a/lib/Runtime/Language/AsmJsByteCodeGenerator.cpp b/lib/Runtime/Language/AsmJsByteCodeGenerator.cpp
index bb8f0fe6310..1e6a425a7ce 100644
--- a/lib/Runtime/Language/AsmJsByteCodeGenerator.cpp
+++ b/lib/Runtime/Language/AsmJsByteCodeGenerator.cpp
@@ -913,11 +913,50 @@ namespace Js
mWriter.AsmBr( mFunction->GetFuncInfo()->singleExit );
return emitInfo;
}
+
bool AsmJSByteCodeGenerator::IsFRound(AsmJsMathFunction* sym)
{
return (sym && sym->GetMathBuiltInFunction() == AsmJSMathBuiltin_fround);
}
+ bool AsmJSByteCodeGenerator::IsValidSimdFcnRetType(AsmJsSIMDFunction& simdFunction, const AsmJsRetType& expectedType, const AsmJsRetType& retType)
+ {
+ // Return types of simd builtins can be coereced to other asmjs types when a valid coercion exists
+ // e.g.
+ // float -> double var d = 0.0; d = +float32x4ExtractLane(...)
+ // signed -> double var d = 0.0; d = +int32x4ExtractLane(...)
+ // unsigned -> double var d = 0.0; d = +uint32x4ExtractLane(...)
+
+ // If a simd built-in is used without coercion, then expectedType is Void.
+ // All SIMD ops are allowed without coercion except a few that return bool. E.g. b4anyTrue()
+ // Unsigned and Bools are represented as Signed in AsmJs
+ if (expectedType == AsmJsRetType::Void)
+ {
+ return true;
+ }
+ else if (expectedType == retType)
+ {
+ Assert(expectedType == AsmJsRetType::Float ||
+ expectedType == AsmJsRetType::Signed ||
+ expectedType == AsmJsRetType::Unsigned||
+ expectedType.toType().isSIMDType() );
+ return true;
+ }
+ else if (expectedType == AsmJsRetType::Double)
+ {
+ return (retType == AsmJsRetType::Float ||
+ retType == AsmJsRetType::Signed ||
+ retType == AsmJsRetType::Unsigned);
+ }
+ else if (expectedType == AsmJsRetType::Signed)
+ {
+ //Unsigned and Bools are represented as Signed in AsmJs
+ return (retType == AsmJsRetType::Unsigned ||
+ simdFunction.ReturnsBool());
+ }
+ return false;
+ }
+
// First set of opcode are for External calls, second set is for internal calls
static const OpCodeAsmJs callOpCode[2][7] =
{
@@ -1642,12 +1681,7 @@ namespace Js
throw AsmJsCompilationException(_u("SIMD builtin function doesn't support arguments"));
}
- // If a simd built-in is used without coercion, then expectedType is Void
- // All SIMD ops are allowed without coercion except a few that return bool. E.g. b4anyTrue()
- if (
- (simdFunction->ReturnsBool() && expectedType != AsmJsRetType::Signed) ||
- (expectedType != AsmJsRetType::Void && retType != expectedType)
- )
+ if (!IsValidSimdFcnRetType(*simdFunction, expectedType, retType))
{
throw AsmJsCompilationException(_u("SIMD builtin function returns wrong type"));
}
diff --git a/lib/Runtime/Language/AsmJsByteCodeGenerator.h b/lib/Runtime/Language/AsmJsByteCodeGenerator.h
index ea4b0e3fecf..17b48023120 100644
--- a/lib/Runtime/Language/AsmJsByteCodeGenerator.h
+++ b/lib/Runtime/Language/AsmJsByteCodeGenerator.h
@@ -137,6 +137,7 @@ namespace Js
void LoadSimd(RegSlot dst, RegSlot src, AsmJsVarType type);
bool IsFRound(AsmJsMathFunction* sym);
+ bool IsValidSimdFcnRetType(AsmJsSIMDFunction& simdFunction, const AsmJsRetType& expectedType, const AsmJsRetType& retType);
/// TODO:: Finish removing references to old bytecode generator
ByteCodeGenerator* GetOldByteCodeGenerator() const
{
diff --git a/test/SIMD.bool16x8.asmjs/rlexe.xml b/test/SIMD.bool16x8.asmjs/rlexe.xml
index 24d9d320496..184920c4236 100644
--- a/test/SIMD.bool16x8.asmjs/rlexe.xml
+++ b/test/SIMD.bool16x8.asmjs/rlexe.xml
@@ -101,4 +101,12 @@
-bgjit- -simdjs -simd128typespec -asmjs- -off:simplejit -mic:1
+
+
+ testBug1.js
+ testBug1.baseline
+ exclude_dynapogo,exclude_ship
+ -off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
diff --git a/test/SIMD.bool16x8.asmjs/testBug1.baseline b/test/SIMD.bool16x8.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.bool16x8.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.bool16x8.asmjs/testBug1.js b/test/SIMD.bool16x8.asmjs/testBug1.js
new file mode 100644
index 00000000000..8e0d2bf0637
--- /dev/null
+++ b/test/SIMD.bool16x8.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b8 = stdlib.SIMD.Bool16x8;
+ var b8extractLane = b8.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b8(1, 0, 1, 0, 1, 0, 1, 0);
+ var result = fround(0);
+ result = fround(b8extractLane(a,0));
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.bool16x8.asmjs/testConstructor.js b/test/SIMD.bool16x8.asmjs/testConstructor.js
index ab0d53d17af..f3982df7064 100644
--- a/test/SIMD.bool16x8.asmjs/testConstructor.js
+++ b/test/SIMD.bool16x8.asmjs/testConstructor.js
@@ -84,6 +84,13 @@ function asmModule(stdlib, imports) {
return b8check(result);
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret1 = 0;
+ var a = b8(1,2,3,4,5,6,7,8);
+ ret1 = (b8extractLane(a, 0))|0;
+ }
return {testConstructor:testConstructor,
testSplat:testSplat,
testLaneAccess: testLaneAccess};
diff --git a/test/SIMD.bool32x4.asmjs/rlexe.xml b/test/SIMD.bool32x4.asmjs/rlexe.xml
index 24d9d320496..184920c4236 100644
--- a/test/SIMD.bool32x4.asmjs/rlexe.xml
+++ b/test/SIMD.bool32x4.asmjs/rlexe.xml
@@ -101,4 +101,12 @@
-bgjit- -simdjs -simd128typespec -asmjs- -off:simplejit -mic:1
+
+
+ testBug1.js
+ testBug1.baseline
+ exclude_dynapogo,exclude_ship
+ -off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
diff --git a/test/SIMD.bool32x4.asmjs/testBug1.baseline b/test/SIMD.bool32x4.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.bool32x4.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.bool32x4.asmjs/testBug1.js b/test/SIMD.bool32x4.asmjs/testBug1.js
new file mode 100644
index 00000000000..d72b98cd7c3
--- /dev/null
+++ b/test/SIMD.bool32x4.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b = stdlib.SIMD.Bool32x4;
+ var bextractLane = b.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b(1, 0, 1, 0);
+ var result = fround(0);
+ result = fround(bextractLane(a,0));
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.bool32x4.asmjs/testConstructor.js b/test/SIMD.bool32x4.asmjs/testConstructor.js
index 80f8ab5328b..b509a3098ed 100644
--- a/test/SIMD.bool32x4.asmjs/testConstructor.js
+++ b/test/SIMD.bool32x4.asmjs/testConstructor.js
@@ -73,6 +73,14 @@ function asmModule(stdlib, imports) {
return b4check(result);
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret1 = 0;
+ var a = b4(1,2,3,4);
+ ret1 = (b4extractLane(a, 0))|0;
+ }
+
return {testConstructor:testConstructor,
testSplat:testSplat,
testLaneAccess: testLaneAccess};
diff --git a/test/SIMD.bool32x4.asmjs/testNeg1.js b/test/SIMD.bool32x4.asmjs/testNeg1.js
new file mode 100644
index 00000000000..302d21a31da
--- /dev/null
+++ b/test/SIMD.bool32x4.asmjs/testNeg1.js
@@ -0,0 +1,20 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b8 = stdlib.SIMD.Bool16x8;
+ var b8extractLane = b8.extractLane;
+ function testNeg()
+ {
+ var a = b8(1, 0, 1, 0, 1, 0, 1, 0);
+ var result = 0.0;
+ result = +(b8extractLane(a,0));
+ return;
+ }
+ return {testNeg:testNeg};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.bool8x16.asmjs/rlexe.xml b/test/SIMD.bool8x16.asmjs/rlexe.xml
index d6299841808..57a64127a67 100644
--- a/test/SIMD.bool8x16.asmjs/rlexe.xml
+++ b/test/SIMD.bool8x16.asmjs/rlexe.xml
@@ -125,5 +125,13 @@
exclude_dynapogo,exclude_ship
-bgjit- -asmjs -testtrace:asmjs -simdjs -AsmJsStopOnError -maic:0 -mic:0
-
+
+
+
+ testBug1.js
+ testBug1.baseline
+ exclude_dynapogo,exclude_ship
+ -off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
diff --git a/test/SIMD.bool8x16.asmjs/testBug1.baseline b/test/SIMD.bool8x16.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.bool8x16.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.bool8x16.asmjs/testBug1.js b/test/SIMD.bool8x16.asmjs/testBug1.js
new file mode 100644
index 00000000000..d5aa69bf1f3
--- /dev/null
+++ b/test/SIMD.bool8x16.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b = stdlib.SIMD.Bool8x16;
+ var bextractLane = b.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b(1, 0, 1, 0,1, 0, 1, 0,1, 0, 1, 0,1, 0, 1, 0);
+ var result = fround(0);
+ result = fround(bextractLane(a,0));
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.bool8x16.asmjs/testConstructor.js b/test/SIMD.bool8x16.asmjs/testConstructor.js
index 38b5e3a281c..e8bae813e77 100644
--- a/test/SIMD.bool8x16.asmjs/testConstructor.js
+++ b/test/SIMD.bool8x16.asmjs/testConstructor.js
@@ -109,6 +109,14 @@ function asmModule(stdlib, imports) {
return b16check(result);
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret1 = 0;
+ var a = b16(1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8);
+ ret1 = (b16extractLane(a, 0))|0;
+ }
+
return {testConstructor:testConstructor,
testSplat:testSplat,
testLaneAccess: testLaneAccess};
diff --git a/test/SIMD.float32x4.asmjs/rlexe.xml b/test/SIMD.float32x4.asmjs/rlexe.xml
index 47afb3fe247..8fb3d36a976 100644
--- a/test/SIMD.float32x4.asmjs/rlexe.xml
+++ b/test/SIMD.float32x4.asmjs/rlexe.xml
@@ -942,4 +942,12 @@
-bgjit- -simdjs -simd128typespec -asmjs- -off:simplejit -mic:1
+
+
+ testBug1.js
+ testBug1.baseline
+ exclude_dynapogo,exclude_ship
+ -off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
diff --git a/test/SIMD.float32x4.asmjs/testBug1.baseline b/test/SIMD.float32x4.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.float32x4.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.float32x4.asmjs/testBug1.js b/test/SIMD.float32x4.asmjs/testBug1.js
new file mode 100644
index 00000000000..5533e040861
--- /dev/null
+++ b/test/SIMD.float32x4.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b = stdlib.SIMD.Float32x4;
+ var bextractLane = b.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b(1.0, 0.0, 1.0, 0.0);
+ var result = 0;
+ result = bextractLane(a,0)|0;
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.float32x4.asmjs/testCalls.js b/test/SIMD.float32x4.asmjs/testCalls.js
index 3f4d3a576bb..86f4e168a18 100644
--- a/test/SIMD.float32x4.asmjs/testCalls.js
+++ b/test/SIMD.float32x4.asmjs/testCalls.js
@@ -53,7 +53,7 @@ function asmModule(stdlib, imports) {
var f4xor = f4.xor;
var f4not = f4.not;
-
+ var f4extractLane = f4.extractLane;
var fround = stdlib.Math.fround;
@@ -187,6 +187,16 @@ function asmModule(stdlib, imports) {
return i4check(k);
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret = 0.0;
+ var ret1 = fround(0);
+ var a = f4(1.0, 2.0, 3.0, 4.0);
+ ret = +f4extractLane(a, 0);
+ ret1 = fround(f4extractLane(a, 0));
+ }
+
return {func1:func1, func2:func2, func3:func3, func4:func4, fcBug1:fcBug_1, fcBug2:fcBug_2};
}
diff --git a/test/SIMD.int16x8.asmjs/rlexe.xml b/test/SIMD.int16x8.asmjs/rlexe.xml
index 3708200e134..57498bf2fa6 100644
--- a/test/SIMD.int16x8.asmjs/rlexe.xml
+++ b/test/SIMD.int16x8.asmjs/rlexe.xml
@@ -742,5 +742,12 @@
-bgjit- -simdjs -simd128typespec -asmjs- -off:simplejit -mic:1
-
+
+
+ testBug1.js
+ testBug1.baseline
+ exclude_dynapogo,exclude_ship
+ -off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
diff --git a/test/SIMD.int16x8.asmjs/testBug1.baseline b/test/SIMD.int16x8.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.int16x8.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.int16x8.asmjs/testBug1.js b/test/SIMD.int16x8.asmjs/testBug1.js
new file mode 100644
index 00000000000..4c6ffbff9bd
--- /dev/null
+++ b/test/SIMD.int16x8.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b8 = stdlib.SIMD.Int16x8;
+ var b8extractLane = b8.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b8(1, 0, 1, 0, 1, 0, 1, 0);
+ var result = fround(0);
+ result = fround(b8extractLane(a,0));
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.int16x8.asmjs/testCalls.js b/test/SIMD.int16x8.asmjs/testCalls.js
index c01c24e2edc..1e655362184 100644
--- a/test/SIMD.int16x8.asmjs/testCalls.js
+++ b/test/SIMD.int16x8.asmjs/testCalls.js
@@ -37,7 +37,7 @@ function asmModule(stdlib, imports) {
var f4 = stdlib.SIMD.Float32x4;
var f4check = f4.check;
var f4splat = f4.splat;
-
+ var i8extractLane = i8.extractLane;
var f4fromInt32x4 = f4.fromInt32x4;
var f4fromInt32x4Bits = f4.fromInt32x4Bits;
var f4abs = f4.abs;
@@ -200,6 +200,16 @@ function asmModule(stdlib, imports) {
return i8check(k);
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret = 0.0;
+ var ret1 = 0;
+ var a = i8(1,2,3,4,5,6,7,8);
+ ret = +i8extractLane(a, 0);
+ ret1 = (i8extractLane(a, 0))|0;
+ }
+
return {func1:func1, func2:func2, func3:func3, func4:func4, fcBug_2:fcBug_2, fcBug_1:fcBug_1/*, func5:func5, func6:func6*/};
}
diff --git a/test/SIMD.int32x4.asmjs/rlexe.xml b/test/SIMD.int32x4.asmjs/rlexe.xml
index aa254971b7e..c62e9190831 100644
--- a/test/SIMD.int32x4.asmjs/rlexe.xml
+++ b/test/SIMD.int32x4.asmjs/rlexe.xml
@@ -765,4 +765,12 @@
-bgjit- -simdjs -simd128typespec -off:simplejit -mic:1
+
+
+ testBug1.js
+ testBug1.baseline
+ exclude_dynapogo,exclude_ship
+ -off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
diff --git a/test/SIMD.int32x4.asmjs/testBug1.baseline b/test/SIMD.int32x4.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.int32x4.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.int32x4.asmjs/testBug1.js b/test/SIMD.int32x4.asmjs/testBug1.js
new file mode 100644
index 00000000000..1ac89e03405
--- /dev/null
+++ b/test/SIMD.int32x4.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b = stdlib.SIMD.Int32x4;
+ var bextractLane = b.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b(1, 0, 1, 0);
+ var result = fround(0);
+ result = fround(bextractLane(a,0));
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.int32x4.asmjs/testCalls.js b/test/SIMD.int32x4.asmjs/testCalls.js
index e0799fd08b9..9c83f063a1b 100644
--- a/test/SIMD.int32x4.asmjs/testCalls.js
+++ b/test/SIMD.int32x4.asmjs/testCalls.js
@@ -28,6 +28,7 @@ function asmModule(stdlib, imports) {
var i4or = i4.or;
var i4xor = i4.xor;
var i4not = i4.not;
+ var i4extractLane = i4.extractLane;
//var i4shiftLeftByScalar = i4.shiftLeftByScalar;
//var i4shiftRightByScalar = i4.shiftRightByScalar;
//var i4shiftRightArithmeticByScalar = i4.shiftRightArithmeticByScalar;
@@ -197,6 +198,16 @@ function asmModule(stdlib, imports) {
return i16check(k);
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret = 0.0;
+ var ret1 = 0;
+ var a = i4(1, 2, 3, 4);
+ ret = +i4extractLane(a, 0);
+ ret1 = (i4extractLane(a, 0))|0;
+ }
+
return {func1:func1, func2:func2, func3:func3, func4:func4, fcBug_2:fcBug_2, fcBug_1:fcBug_1};
}
diff --git a/test/SIMD.int8x16.asmjs/testBug1.baseline b/test/SIMD.int8x16.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.int8x16.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.int8x16.asmjs/testBug1.js b/test/SIMD.int8x16.asmjs/testBug1.js
new file mode 100644
index 00000000000..4c6ffbff9bd
--- /dev/null
+++ b/test/SIMD.int8x16.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b8 = stdlib.SIMD.Int16x8;
+ var b8extractLane = b8.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b8(1, 0, 1, 0, 1, 0, 1, 0);
+ var result = fround(0);
+ result = fround(b8extractLane(a,0));
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.int8x16.asmjs/testCalls.js b/test/SIMD.int8x16.asmjs/testCalls.js
index 1b37cfdf82a..f1fc92fe44f 100644
--- a/test/SIMD.int8x16.asmjs/testCalls.js
+++ b/test/SIMD.int8x16.asmjs/testCalls.js
@@ -67,7 +67,7 @@ function asmModule(stdlib, imports) {
var f4xor = f4.xor;
var f4not = f4.not;
-
+ var i16extractLane = i16.extractLane;
var fround = stdlib.Math.fround;
@@ -200,6 +200,16 @@ function asmModule(stdlib, imports) {
return i16check(k);
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret = 0.0;
+ var ret1 = 0;
+ var a = i16(1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4);
+ ret = +i16extractLane(a, 0);
+ ret1 = (i16extractLane(a, 0))|0;
+ }
+
return {func1:func1, func2:func2, func3:func3, func4:func4, func5:fcBug_1, func6:fcBug_2};
}
diff --git a/test/SIMD.uint16x8.asmjs/rlexe.xml b/test/SIMD.uint16x8.asmjs/rlexe.xml
index 71b97b0628d..96b88d5bead 100644
--- a/test/SIMD.uint16x8.asmjs/rlexe.xml
+++ b/test/SIMD.uint16x8.asmjs/rlexe.xml
@@ -677,5 +677,13 @@
exclude_dynapogo,exclude_ship
-bgjit- -simdjs -simd128typespec -asmjs- -off:simplejit -mic:1
-
+
+
+
+ testBug1.js
+ testBug1.baseline
+ exclude_dynapogo,exclude_ship
+ -off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
diff --git a/test/SIMD.uint16x8.asmjs/testBug1.baseline b/test/SIMD.uint16x8.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.uint16x8.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.uint16x8.asmjs/testBug1.js b/test/SIMD.uint16x8.asmjs/testBug1.js
new file mode 100644
index 00000000000..5e33d4ba85e
--- /dev/null
+++ b/test/SIMD.uint16x8.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b8 = stdlib.SIMD.Uint16x8;
+ var b8extractLane = b8.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b8(1, 0, 1, 0, 1, 0, 1, 0);
+ var result = fround(0);
+ result = fround(b8extractLane(a,0));
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.uint16x8.asmjs/testCalls.js b/test/SIMD.uint16x8.asmjs/testCalls.js
index 6888dbed768..e240f7df7db 100644
--- a/test/SIMD.uint16x8.asmjs/testCalls.js
+++ b/test/SIMD.uint16x8.asmjs/testCalls.js
@@ -88,7 +88,7 @@ function asmModule(stdlib, imports) {
var i8fromU8bits = i8.fromUint16x8Bits;
var u8fromI8bits = u8.fromInt16x8Bits;
-
+ var u8extractLane = u8.extractLane;
var i16 = stdlib.SIMD.Int8x16;
var i16check = i16.check;
var i16fromU16bits = i16.fromUint8x16Bits;
@@ -210,6 +210,16 @@ function asmModule(stdlib, imports) {
return i16check(i16fromU16bits(k));
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret = 0.0;
+ var ret1 = 0;
+ var a = u8(1,2,3,4,5,6,7,8);
+ ret = +u8extractLane(a, 0);
+ ret1 = (u8extractLane(a, 0))|0;
+ }
+
return {func1:func1, func2:func2, func3:func3, func4:func4, func5:fcBug_1, func6:fcBug_2};
}
diff --git a/test/SIMD.uint32x4.asmjs/rlexe.xml b/test/SIMD.uint32x4.asmjs/rlexe.xml
index 42abe9a8db1..eb161348126 100644
--- a/test/SIMD.uint32x4.asmjs/rlexe.xml
+++ b/test/SIMD.uint32x4.asmjs/rlexe.xml
@@ -55,6 +55,14 @@
-off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
+ testBug1.js
+ testBug1.baseline
+ exclude_dynapogo,exclude_ship
+ -off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
testFail_1.js
diff --git a/test/SIMD.uint32x4.asmjs/testBug1.baseline b/test/SIMD.uint32x4.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.uint32x4.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.uint32x4.asmjs/testBug1.js b/test/SIMD.uint32x4.asmjs/testBug1.js
new file mode 100644
index 00000000000..dc8749152b2
--- /dev/null
+++ b/test/SIMD.uint32x4.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b = stdlib.SIMD.Uint32x4;
+ var bextractLane = b.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b(1, 0, 1, 0);
+ var result = fround(0);
+ result = fround(bextractLane(a,0));
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.uint32x4.asmjs/testCalls.js b/test/SIMD.uint32x4.asmjs/testCalls.js
index 51b1a2fb6bd..22bbf686fa3 100644
--- a/test/SIMD.uint32x4.asmjs/testCalls.js
+++ b/test/SIMD.uint32x4.asmjs/testCalls.js
@@ -33,6 +33,7 @@ function asmModule(stdlib, imports) {
var u4 = stdlib.SIMD.Uint32x4;
var u4check = u4.check;
+ var u4extractLane = u4.extractLane;
var f4 = stdlib.SIMD.Float32x4;
var f4check = f4.check;
var f4splat = f4.splat;
@@ -199,6 +200,16 @@ function asmModule(stdlib, imports) {
return i4check(i4fu4(k));
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret = 0.0;
+ var ret1 = 0;
+ var a = u4(1, 2, 3, 4);
+ ret = +u4extractLane(a, 0);
+ ret1 = (u4extractLane(a, 0))|0;
+ }
+
return {func1:func1, func2:func2, func3:func3, func4:func4, func5:fcBug_1, func6:fcBug_2};
}
diff --git a/test/SIMD.uint8x16.asmjs/rlexe.xml b/test/SIMD.uint8x16.asmjs/rlexe.xml
index 8f2b63b6542..6b169cbf27c 100644
--- a/test/SIMD.uint8x16.asmjs/rlexe.xml
+++ b/test/SIMD.uint8x16.asmjs/rlexe.xml
@@ -40,6 +40,14 @@
-off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
+ testBug1.js
+ testBug1.baseline
+ exclude_dynapogo,exclude_ship
+ -off:deferparse -testtrace:asmjs -simdjs -bgjit- -maic:1
+
+
testCalls.js
diff --git a/test/SIMD.uint8x16.asmjs/testBug1.baseline b/test/SIMD.uint8x16.asmjs/testBug1.baseline
new file mode 100644
index 00000000000..96ec6267c1a
--- /dev/null
+++ b/test/SIMD.uint8x16.asmjs/testBug1.baseline
@@ -0,0 +1,6 @@
+
+testBug1.js(11, 5)
+ Asm.js Compilation Error function : asmModule::testBug
+ SIMD builtin function returns wrong type
+
+Asm.js compilation failed.
diff --git a/test/SIMD.uint8x16.asmjs/testBug1.js b/test/SIMD.uint8x16.asmjs/testBug1.js
new file mode 100644
index 00000000000..5e33d4ba85e
--- /dev/null
+++ b/test/SIMD.uint8x16.asmjs/testBug1.js
@@ -0,0 +1,21 @@
+//-------------------------------------------------------------------------------------------------------
+// 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 b8 = stdlib.SIMD.Uint16x8;
+ var b8extractLane = b8.extractLane;
+ var fround = stdlib.Math.fround;
+ function testBug()
+ {
+ var a = b8(1, 0, 1, 0, 1, 0, 1, 0);
+ var result = fround(0);
+ result = fround(b8extractLane(a,0));
+ return;
+ }
+ return {testBug:testBug};
+}
+
+var m = asmModule(this, {g1:SIMD.Bool16x8(1, 1, 1, 1, 1, 1, 1, 1)});
diff --git a/test/SIMD.uint8x16.asmjs/testCalls.js b/test/SIMD.uint8x16.asmjs/testCalls.js
index 404590a799d..8913460223f 100644
--- a/test/SIMD.uint8x16.asmjs/testCalls.js
+++ b/test/SIMD.uint8x16.asmjs/testCalls.js
@@ -35,6 +35,8 @@ function asmModule(stdlib, imports) {
var u16 = stdlib.SIMD.Uint8x16;
var u16check = u16.check;
+ var u16extractLane = u16.extractLane;
+
var f4 = stdlib.SIMD.Float32x4;
var f4check = f4.check;
var f4splat = f4.splat;
@@ -201,6 +203,16 @@ function asmModule(stdlib, imports) {
return i16check(i16fu16(k));
}
+ //Validation will fail with the bug
+ function retValueCoercionBug()
+ {
+ var ret = 0.0;
+ var ret1 = 0;
+ var a = u16(1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4);
+ ret = +u16extractLane(a, 0);
+ ret1 = (u16extractLane(a, 0))|0;
+ }
+
return {func1:func1, func2:func2, func3:func3, func4:func4, func5:fcBug_1, func6:fcBug_2};
}