mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1060087 - OdinMonkey SIMD: add support for signMask; r=luke
This commit is contained in:
parent
edd045a2f7
commit
81a9fcef97
@ -2586,6 +2586,17 @@ class FunctionCompiler
|
||||
return ins;
|
||||
}
|
||||
|
||||
MDefinition *extractSignMask(MDefinition *base)
|
||||
{
|
||||
if (inDeadCode())
|
||||
return nullptr;
|
||||
|
||||
JS_ASSERT(IsSimdType(base->type()));
|
||||
MSimdSignMask *ins = MSimdSignMask::NewAsmJS(alloc(), base);
|
||||
curBlock_->add(ins);
|
||||
return ins;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
MDefinition *constructSimd(MDefinition *x, MDefinition *y, MDefinition *z, MDefinition *w,
|
||||
MIRType type)
|
||||
@ -4027,6 +4038,13 @@ CheckDotAccess(FunctionCompiler &f, ParseNode *elem, MDefinition **def, Type *ty
|
||||
|
||||
SimdLane lane;
|
||||
JSAtomState &names = m.cx()->names();
|
||||
|
||||
if (field == names.signMask) {
|
||||
*type = Type::Int;
|
||||
*def = f.extractSignMask(baseDef);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (field == names.x)
|
||||
lane = LaneX;
|
||||
else if (field == names.y)
|
||||
@ -4036,7 +4054,7 @@ CheckDotAccess(FunctionCompiler &f, ParseNode *elem, MDefinition **def, Type *ty
|
||||
else if (field == names.w)
|
||||
lane = LaneW;
|
||||
else
|
||||
return f.fail(base, "dot access field must be a lane name (x, y, z, w)");
|
||||
return f.fail(base, "dot access field must be a lane name (x, y, z, w) or signMask");
|
||||
|
||||
*type = baseType.simdToScalarType();
|
||||
*def = f.extractSimdElement(lane, baseDef, type->toMIRType());
|
||||
|
@ -161,6 +161,21 @@ CheckF4('', 'var x=f4(' + (INT32_MAX + 1) + ', 2, 3, 4)', [INT32_MAX + 1, 2, 3,
|
||||
CheckF4('', 'var x=f4(1.3, 2.4, 3.5, 98.76)', [1.3, 2.4, 3.5, 98.76]);
|
||||
CheckF4('', 'var x=f4(13.37, 2., 3., -0)', [13.37, 2, 3, -0]);
|
||||
|
||||
// signMask
|
||||
assertAsmTypeFail('glob', USE_ASM + I32 + "function f() {var x=i4(1,2,3,4); var y=0.0; y=x.signMask;} return f");
|
||||
assertAsmTypeFail('glob', USE_ASM + I32 + FROUND + "function f() {var x=i4(1,2,3,4); var y=f32(0.0); y=x.signMask;} return f");
|
||||
|
||||
assertAsmTypeFail('glob', USE_ASM + "function f() {var x=42; return x.signMask;} return f");
|
||||
assertAsmTypeFail('glob', USE_ASM + "function f() {var x=42.; return x.signMask;} return f");
|
||||
assertAsmTypeFail('glob', USE_ASM + FROUND + "function f() {var x=f32(42.); return x.signMask;} return f");
|
||||
|
||||
assertEq(asmLink(asmCompile('glob', USE_ASM + I32 + 'function f() { var x=i4(1,2,3,4); return x.signMask | 0 } return f'), this)(), 0b0000);
|
||||
assertEq(asmLink(asmCompile('glob', USE_ASM + I32 + 'function f() { var x=i4(0,-1, ' + INT32_MAX + ',' + INT32_MIN + '); return x.signMask | 0 } return f'), this)(), 0b1010);
|
||||
|
||||
assertEq(asmLink(asmCompile('glob', USE_ASM + F32 + 'var Infinity = glob.Infinity; function f() { var x=f4(0,0,0,0); x=f4(1, -13.37, 42, -Infinity); return x.signMask | 0 } return f'), this)(), 0b1010);
|
||||
assertEq(asmLink(asmCompile('glob', USE_ASM + F32 + 'var Infinity = glob.Infinity; function f() { var x=f4(0,0,0,0); x=f4(-1, 0, -0.000001, Infinity); return x.signMask | 0 } return f'), this)(), 0b0101);
|
||||
assertEq(asmLink(asmCompile('glob', USE_ASM + F32 + 'var NaN = glob.NaN; function f() { var x=f4(0,0,0,0); x=f4(-1, NaN, 3., 4.); return x.signMask | 0 } return f'), this)(), 0b0001);
|
||||
|
||||
// 1.3.3. Variable assignments
|
||||
assertAsmTypeFail('glob', USE_ASM + I32 + I32A + "function f() {var x=i4(1,2,3,4); x=i4();} return f");
|
||||
assertAsmTypeFail('glob', USE_ASM + I32 + I32A + "function f() {var x=i4(1,2,3,4); x=i4(1);} return f");
|
||||
|
@ -166,6 +166,7 @@
|
||||
macro(sensitivity, sensitivity, "sensitivity") \
|
||||
macro(set, set, "set") \
|
||||
macro(shape, shape, "shape") \
|
||||
macro(signMask, signMask, "signMask") \
|
||||
macro(source, source, "source") \
|
||||
macro(stack, stack, "stack") \
|
||||
macro(sticky, sticky, "sticky") \
|
||||
|
Loading…
Reference in New Issue
Block a user