mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-25 14:17:22 +00:00
Bug 1366096 - SIMD globals with 8x16 and 16x8 types. r=bbouvier
Add support for asm.js global variables with the following types: Int8x16, Bool8x16, Int16x8, Bool16x8. We already have the needed code generation support, but tests were missing for these types, and so their types were omitted from some critical switches. MozReview-Commit-ID: B4r7VofjlYL --HG-- extra : rebase_source : 4df72f2296f814a1ea83d6ff93170ed2049f4361
This commit is contained in:
parent
63a7ff4ecb
commit
fe9b95a3ca
@ -73,6 +73,21 @@ assertAsmTypeFail('glob', USE_ASM + B16x8 + "function f() {var x=b16x8(1,0,0,0,
|
||||
assertAsmTypeFail('glob', USE_ASM + B16x8 + "function f() {var x=b16x8(1,0,0,0, 0,0,0,0, 1);} return f");
|
||||
assertEq(asmLink(asmCompile('glob', USE_ASM + B16x8 + "function f() {var x=b16x8(1,0,0,0, 0,-1,-2,0);} return f"), this)(), undefined);
|
||||
|
||||
// Global variable of Int16x8 type.
|
||||
assertEqVecArr(asmLink(asmCompile('glob', 'ffi', USE_ASM + I16x8 + I16x8CHK + "var g=i16x8chk(ffi.g); function f() { return i16x8chk(g); } return f"), this,
|
||||
{g: SIMD.Int16x8(1,2,3,4,5,6,7,8)})(), [1,2,3,4,5,6,7,8]);
|
||||
assertEqVecArr(asmLink(asmCompile('glob', 'ffi', USE_ASM + I16x8 + I16x8CHK + "var g=i16x8chk(ffi.g); function f() { g=i16x8(5,6,7,8,9,10,11,12); return i16x8chk(g); } return f"), this,
|
||||
{g: SIMD.Int16x8(1,2,3,4,5,6,7,8)})(), [5,6,7,8,9,10,11,12]);
|
||||
|
||||
// Global variable of Bool16x8 type.
|
||||
assertEqVecArr(asmLink(asmCompile('glob', 'ffi', USE_ASM + B16x8 + B16x8CHK + "var g=b16x8chk(ffi.g); function f() { return b16x8chk(g); } return f"), this,
|
||||
{g: SIMD.Bool16x8(1,1,0,1,0,0,1,0)})(), [true,true,false,true,false,false,true,false]);
|
||||
assertEqVecArr(asmLink(asmCompile('glob', 'ffi', USE_ASM + B16x8 + B16x8CHK + "var g=b16x8chk(ffi.g); function f() { g=b16x8(1,1,0,1,0,1,1,1); return b16x8chk(g); } return f"), this,
|
||||
{g: SIMD.Bool16x8(1,1,0,1,0,0,1,0)})(), [true,true,false,true,false,true,true,true]);
|
||||
|
||||
// Unsigned SIMD globals are not allowed.
|
||||
assertAsmTypeFail('glob', 'ffi', USE_ASM + U16x8 + U16x8CHK + "var g=u16x8chk(ffi.g); function f() { } return f");
|
||||
|
||||
// Only signed Int16x8 allowed as return value.
|
||||
assertEqVecArr(asmLink(asmCompile('glob', USE_ASM + I16x8 + "function f() {return i16x8(1,2,3,4,5,6,7,8);} return f"), this)(),
|
||||
[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
|
@ -73,6 +73,21 @@ assertAsmTypeFail('glob', USE_ASM + B8x16 + "function f() {var x=b8x16(1,0,0,0,0
|
||||
assertAsmTypeFail('glob', USE_ASM + B8x16 + "function f() {var x=b8x16(1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1);} return f");
|
||||
assertEq(asmLink(asmCompile('glob', USE_ASM + B8x16 + "function f() {var x=b8x16(1,0,0,0,0,0,0,0,0,1,-1,2,-2,1,1,1);} return f"), this)(), undefined);
|
||||
|
||||
// Global variable of Int8x16 type.
|
||||
assertEqVecArr(asmLink(asmCompile('glob', 'ffi', USE_ASM + I8x16 + I8x16CHK + "var g=i8x16chk(ffi.g); function f() { return i8x16chk(g); } return f"), this,
|
||||
{g: SIMD.Int8x16(1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17)})(), [1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17]);
|
||||
assertEqVecArr(asmLink(asmCompile('glob', 'ffi', USE_ASM + I8x16 + I8x16CHK + "var g=i8x16chk(ffi.g); function f() { g=i8x16(5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8); return i8x16chk(g); } return f"), this,
|
||||
{g: SIMD.Int8x16(1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17)})(), [5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8]);
|
||||
|
||||
// Global variable of Bool8x16 type.
|
||||
assertEqVecArr(asmLink(asmCompile('glob', 'ffi', USE_ASM + B8x16 + B8x16CHK + "var g=b8x16chk(ffi.g); function f() { return b8x16chk(g); } return f"), this,
|
||||
{g: SIMD.Bool8x16(1,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0)})(), [true,true,false,true,false,false,true,false,false,true,false,true,false,false,true,false]);
|
||||
assertEqVecArr(asmLink(asmCompile('glob', 'ffi', USE_ASM + B8x16 + B8x16CHK + "var g=b8x16chk(ffi.g); function f() { g=b8x16(1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,0); return b8x16chk(g); } return f"), this,
|
||||
{g: SIMD.Bool8x16(1,1,0,1,0,0,1,0)})(), [true,true,false,true,false,true,true,true,false,true,false,true,true,true,false,false]);
|
||||
|
||||
// Unsigned SIMD globals are not allowed.
|
||||
assertAsmTypeFail('glob', 'ffi', USE_ASM + U8x16 + U8x16CHK + "var g=u8x16chk(ffi.g); function f() { } return f");
|
||||
|
||||
// Only signed Int8x16 allowed as return value.
|
||||
assertEqVecArr(asmLink(asmCompile('glob', USE_ASM + I8x16 + "function f() {return i8x16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);} return f"), this)(),
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
|
||||
|
@ -1611,7 +1611,11 @@ CodeGeneratorShared::visitWasmStoreGlobalVar(LWasmStoreGlobalVar* ins)
|
||||
break;
|
||||
// Aligned access: code is aligned on PageSize + there is padding
|
||||
// before the global data section.
|
||||
case MIRType::Int8x16:
|
||||
case MIRType::Int16x8:
|
||||
case MIRType::Int32x4:
|
||||
case MIRType::Bool8x16:
|
||||
case MIRType::Bool16x8:
|
||||
case MIRType::Bool32x4:
|
||||
masm.storeInt32x4(ToFloatRegister(ins->value()), addr);
|
||||
break;
|
||||
|
@ -7506,8 +7506,11 @@ static bool
|
||||
HasPureCoercion(JSContext* cx, HandleValue v)
|
||||
{
|
||||
// Unsigned SIMD types are not allowed in function signatures.
|
||||
if (IsVectorObject<Int32x4>(v) || IsVectorObject<Float32x4>(v) || IsVectorObject<Bool32x4>(v))
|
||||
if (IsVectorObject<Int32x4>(v) || IsVectorObject<Int16x8>(v) || IsVectorObject<Int8x16>(v) ||
|
||||
IsVectorObject<Bool32x4>(v) || IsVectorObject<Bool16x8>(v) ||
|
||||
IsVectorObject<Bool8x16>(v) || IsVectorObject<Float32x4>(v)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ideally, we'd reject all non-SIMD non-primitives, but Emscripten has a
|
||||
// bug that generates code that passes functions for some imports. To avoid
|
||||
|
Loading…
x
Reference in New Issue
Block a user