Skip to content

Commit e12dac3

Browse files
Krovatkinarunetm-zz
authored andcommitted
truncation & conversion ops for 64x2 types
1 parent d3c6d41 commit e12dac3

17 files changed

+195
-10
lines changed

lib/Backend/IRBuilderAsmJs.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4672,7 +4672,11 @@ IRBuilderAsmJs::BuildInt64x2_3(Js::OpCodeAsmJs newOpcode, uint32 offset, BUILD_S
46724672
void
46734673
IRBuilderAsmJs::BuildInt64x2_2(Js::OpCodeAsmJs newOpcode, uint32 offset, BUILD_SIMD_ARGS_REG2)
46744674
{
4675-
Assert(newOpcode == Js::OpCodeAsmJs::Simd128_Neg_I2);
4675+
Assert(newOpcode == Js::OpCodeAsmJs::Simd128_Neg_I2 ||
4676+
newOpcode == Js::OpCodeAsmJs::Simd128_FromUint64x2_D2 ||
4677+
newOpcode == Js::OpCodeAsmJs::Simd128_FromInt64x2_D2 ||
4678+
newOpcode == Js::OpCodeAsmJs::Simd128_FromFloat64x2_I2 ||
4679+
newOpcode == Js::OpCodeAsmJs::Simd128_FromFloat64x2_U2);
46764680
BuildSimd_2(newOpcode, offset, dstRegSlot, src1RegSlot, TySimd128I2);
46774681
}
46784682

lib/Backend/JnHelperMethodList.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ HELPERCALL(Simd128ShRtByScalarU2, Js::SIMDInt64x2Operation::OpShiftRightByScalar
355355
HELPERCALL(Simd128ShRtByScalarI2, Js::SIMDInt64x2Operation::OpShiftRightByScalar, 0)
356356
HELPERCALL(Simd128ShLtByScalarI2, Js::SIMDInt64x2Operation::OpShiftLeftByScalar, 0)
357357
HELPERCALL(Simd128ReplaceLaneI2, Js::SIMDInt64x2Operation::OpReplaceLane, 0)
358+
HELPERCALL(Simd128TruncateI2, (void(*)(SIMDValue*, SIMDValue*))&Js::SIMDInt64x2Operation::OpTrunc<int64>, AttrCanThrow)
359+
HELPERCALL(Simd128TruncateU2, (void(*)(SIMDValue*, SIMDValue*))&Js::SIMDInt64x2Operation::OpTrunc<uint64>, AttrCanThrow)
360+
HELPERCALL(Simd128ConvertSD2, (void(*)(SIMDValue*, SIMDValue*))&Js::SIMDFloat64x2Operation::OpConv<int64>, 0)
361+
HELPERCALL(Simd128ConvertUD2, (void(*)(SIMDValue*, SIMDValue*))&Js::SIMDFloat64x2Operation::OpConv<uint64>, 0)
358362
#endif
359363

360364
HELPERCALL(Op_TryCatch, nullptr, 0)

lib/Backend/LowerMDShared.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ class LowererMD
347347
void EmitExtractInt64(IR::Opnd* dst, IR::Opnd* src, uint index, IR::Instr *instr);
348348
void EmitInsertInt64(IR::Opnd* dst, uint index, IR::Instr *instr);
349349
void EmitShiftByScalarI2(IR::Instr *instr, IR::JnHelperMethod helper);
350+
IR::Instr* EmitSimdConversion(IR::Instr *instr, IR::JnHelperMethod helper);
350351
IR::Instr* SIMD128LowerReplaceLane_4(IR::Instr *instr);
351352
IR::Instr* SIMD128LowerReplaceLane_8(IR::Instr *instr);
352353
IR::Instr* SIMD128LowerReplaceLane_16(IR::Instr *instr);

lib/Backend/LowerMDSharedSimd128.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,14 @@ IR::Instr* LowererMD::Simd128LowerUnMappedInstruction(IR::Instr *instr)
772772
case Js::OpCode::Simd128_FromFloat32x4_U4:
773773
return Simd128LowerUint32x4FromFloat32x4(instr);
774774

775+
case Js::OpCode::Simd128_FromInt64x2_D2:
776+
return EmitSimdConversion(instr, IR::HelperSimd128ConvertSD2);
777+
case Js::OpCode::Simd128_FromUint64x2_D2:
778+
return EmitSimdConversion(instr, IR::HelperSimd128ConvertUD2);
779+
case Js::OpCode::Simd128_FromFloat64x2_I2:
780+
return EmitSimdConversion(instr, IR::HelperSimd128TruncateI2);
781+
case Js::OpCode::Simd128_FromFloat64x2_U2:
782+
return EmitSimdConversion(instr, IR::HelperSimd128TruncateU2);
775783
case Js::OpCode::Simd128_Neq_I4:
776784
case Js::OpCode::Simd128_Neq_I8:
777785
case Js::OpCode::Simd128_Neq_I16:
@@ -901,6 +909,20 @@ IR::Instr* LowererMD::Simd128CanonicalizeToBools(IR::Instr* instr, const Js::OpC
901909
return instr;
902910
}
903911

912+
IR::Instr* LowererMD::EmitSimdConversion(IR::Instr *instr, IR::JnHelperMethod helper)
913+
{
914+
IR::MemRefOpnd* srcMemRef = LoadSimdHelperArgument(instr, 0);
915+
IR::MemRefOpnd* dstMemRef = LoadSimdHelperArgument(instr, 1);
916+
m_lowerer->InsertMove(srcMemRef, instr->UnlinkSrc1(), instr);
917+
918+
IR::Instr * helperCall = IR::Instr::New(Js::OpCode::CALL, this->m_func);
919+
instr->InsertBefore(helperCall);
920+
this->ChangeToHelperCall(helperCall, helper);
921+
922+
m_lowerer->InsertMove(instr->UnlinkDst(), dstMemRef, instr);
923+
return removeInstr(instr);
924+
}
925+
904926
void LowererMD::EmitShiftByScalarI2(IR::Instr *instr, IR::JnHelperMethod helper)
905927
{
906928
IR::Opnd* src2 = instr->GetSrc2();

lib/Runtime/ByteCode/OpCodesSimd.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ MACRO_SIMD_EXTEND_WMS(Simd128_ShRtByScalar_I2, Int64x2_2Int1, None, None, 0)
144144
MACRO_SIMD_EXTEND_WMS(Simd128_ShRtByScalar_U2, Int64x2_2Int1, None, None, 0)
145145
MACRO_SIMD_EXTEND_WMS(Simd128_AnyTrue_B2, Int1Bool64x2_1, None, None, 0)
146146
MACRO_SIMD_EXTEND_WMS(Simd128_AllTrue_B2, Int1Bool64x2_1, None, None, 0)
147+
MACRO_SIMD_EXTEND_WMS(Simd128_FromFloat64x2_I2, Int64x2_2, None, None, 0)
148+
MACRO_SIMD_EXTEND_WMS(Simd128_FromFloat64x2_U2, Int64x2_2, None, None, 0)
147149

148150
// Float64x2
149151
MACRO_SIMD_EXTEND_WMS(Simd128_Splat_D2, Float64x2_1Double1, None, None, 0)
@@ -164,6 +166,8 @@ MACRO_SIMD_EXTEND_WMS(Simd128_Sub_D2, Float64x2_3, None, None, 0)
164166
MACRO_SIMD_EXTEND_WMS(Simd128_Mul_D2, Float64x2_3, None, None, 0)
165167
MACRO_SIMD_EXTEND_WMS(Simd128_Div_D2, Float64x2_3, None, None, 0)
166168
MACRO_SIMD_EXTEND_WMS(Simd128_Sqrt_D2, Float64x2_2, None, None, 0)
169+
MACRO_SIMD_EXTEND_WMS(Simd128_FromInt64x2_D2, Int64x2_2, None, None, 0) //Int64x2_2 is intentional
170+
MACRO_SIMD_EXTEND_WMS(Simd128_FromUint64x2_D2, Int64x2_2, None, None, 0)
167171
// Float64x2
168172
#if 0 //Disabling this type until the specification decides to include or not.
169173
MACRO_SIMD_EXTEND_WMS(Simd128_DoublesToD2, Float64x2_1Double2, None, None, 0)

lib/Runtime/Language/InterpreterHandlerAsmJs.inl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,10 @@ EXDEF2_WMS(SIMD_D2_2toD2_1, Simd128_Neq_D2, Js::SIMDFloat64x2Operation::OpNotEqu
723723
EXDEF2_WMS(SIMD_D2_2toD2_1, Simd128_GtEq_D2, Js::SIMDFloat64x2Operation::OpGreaterThanOrEqual)
724724
EXDEF2_WMS(SIMD_D2_2toD2_1, Simd128_Gt_D2, Js::SIMDFloat64x2Operation::OpGreaterThan)
725725
EXDEF2_WMS(SIMD_D2_1toD2_1, Simd128_Sqrt_D2, SIMDFloat64x2Operation::OpSqrt)
726+
EXDEF2_WMS(SIMD_I2_1toI2_P, Simd128_FromInt64x2_D2, SIMDFloat64x2Operation::OpConv<int64>)
727+
EXDEF2_WMS(SIMD_I2_1toI2_P, Simd128_FromUint64x2_D2, SIMDFloat64x2Operation::OpConv<uint64>)
728+
EXDEF2_WMS(SIMD_I2_1toI2_P, Simd128_FromFloat64x2_I2, SIMDInt64x2Operation::OpTrunc<int64>)
729+
EXDEF2_WMS(SIMD_I2_1toI2_P, Simd128_FromFloat64x2_U2, SIMDInt64x2Operation::OpTrunc<uint64>)
726730

727731
#if 0
728732
EXDEF2_WMS(SIMD_D2toD2_1, Simd128_DoublesToD2, SIMDFloat64x2Operation::OpFloat64x2)

lib/Runtime/Language/InterpreterProcessOpCodeAsmJs.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343
#define PROCESS_FUNCtoA1Mem(name, func) PROCESS_FUNCtoA1Mem_COMMON(name, func,)
4444

45-
4645
#define PROCESS_CUSTOM_ASMJS_COMMON(name, func, layout, suffix) \
4746
case OpCodeAsmJs::name: \
4847
{ \
@@ -873,6 +872,18 @@ if (switchProfileMode) \
873872
}
874873
#define PROCESS_SIMD_I2_1toI2_1 (name, func) PROCESS_SIMD_I2_1toI2_1_COMMON(name, func,)
875874

875+
#define PROCESS_SIMD_I2_1toI2_P_COMMON(name, func, suffix) \
876+
case OpCodeAsmJs::name: \
877+
{ \
878+
PROCESS_READ_LAYOUT_ASMJS(name, Int64x2_2, suffix); \
879+
SIMDValue result {0}; \
880+
SIMDValue src = GetRegRawSimd(playout->I2_1); \
881+
func(&result, &src); \
882+
SetRegRawSimd(playout->I2_0, result); \
883+
break; \
884+
}
885+
#define PROCESS_SIMD_I2_1toI2_P(name, func) PROCESS_SIMD_I2_1toI2_P_COMMON(name, func,)
886+
876887
#define PROCESS_SIMD_I2_1I1toI2_1_COMMON(name, func, suffix) \
877888
case OpCodeAsmJs::name: \
878889
{ \

lib/Runtime/Language/InterpreterStackFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3803,7 +3803,7 @@ namespace Js
38033803
case AsmJsRetType::Uint32x4:
38043804
case AsmJsRetType::Uint16x8:
38053805
case AsmJsRetType::Uint8x16:
3806-
#if _WIN32 || _WIN64 //WASM.SIMD ToDo: Enable thunk for Xplat
3806+
#if _WIN32 //WASM.SIMD ToDo: Enable thunk for Xplat
38073807
#if _M_X64
38083808
X86SIMDValue simdVal;
38093809
simdVal.m128_value = JavascriptFunction::CallAsmJsFunction<__m128>(function, entrypointInfo->jsMethod, m_outParams, alignedArgsSize, reg);

lib/Runtime/Language/SimdFloat64x2Operation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace Js {
4343
static SIMDValue OpGreaterThan(const SIMDValue& aValue, const SIMDValue& bValue);
4444
static SIMDValue OpGreaterThanOrEqual(const SIMDValue& aValue, const SIMDValue& bValue);
4545
static SIMDValue OpSelect(const SIMDValue& mV, const SIMDValue& tV, const SIMDValue& fV);
46+
template<typename T> static void OpConv(SIMDValue* dst, SIMDValue* src);
4647
};
4748

4849
} // namespace Js

lib/Runtime/Language/SimdFloat64x2OperationX86X64.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,16 @@ namespace Js
318318
return X86SIMDValue::ToSIMDValue(x86Result);
319319
}
320320

321+
template<typename T>
322+
void SIMDFloat64x2Operation::OpConv(SIMDValue* dst, SIMDValue* src)
323+
{
324+
dst->f64[0] = (double) (T)src->i64[0];
325+
dst->f64[1] = (double) (T)src->i64[1];
326+
}
327+
328+
template void SIMDFloat64x2Operation::OpConv<int64>(SIMDValue* dst, SIMDValue* src);
329+
template void SIMDFloat64x2Operation::OpConv<uint64>(SIMDValue* dst, SIMDValue* src);
330+
321331
}
322332

323333
#endif

lib/Runtime/Language/SimdInt64x2Operation.cpp

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Js
99
{
10-
1110
SIMDValue SIMDInt64x2Operation::OpSplat(int64 val)
1211
{
1312
SIMDValue result;
@@ -40,6 +39,57 @@ namespace Js
4039
return result;
4140
}
4241

42+
static bool IsInRange(double val, uint64& out)
43+
{
44+
if (val != val || val <= (double)0)
45+
{
46+
out = 0;
47+
return false;
48+
}
49+
50+
if (val >= (double)ULLONG_MAX)
51+
{
52+
out = ULLONG_MAX;
53+
return false;
54+
}
55+
56+
return true;
57+
}
58+
59+
static bool IsInRange(double val, int64& out)
60+
{
61+
if (val != val)
62+
{
63+
out = 0;
64+
return false;
65+
}
66+
67+
if (val <= (double)LLONG_MIN)
68+
{
69+
out = LLONG_MIN;
70+
return false;
71+
}
72+
73+
if (val >= (double)LLONG_MAX)
74+
{
75+
out = LLONG_MAX;
76+
return false;
77+
}
78+
79+
return true;
80+
}
81+
82+
template<typename T>
83+
void SIMDInt64x2Operation::OpTrunc(SIMDValue* dst, SIMDValue* src)
84+
{
85+
T convertedVal;
86+
dst->i64[0] = IsInRange(src->f64[0], convertedVal) ? (T)src->f64[0] : convertedVal;
87+
dst->i64[1] = IsInRange(src->f64[1], convertedVal) ? (T)src->f64[1] : convertedVal;
88+
}
89+
90+
template void SIMDInt64x2Operation::OpTrunc<int64>(SIMDValue* dst, SIMDValue* src);
91+
template void SIMDInt64x2Operation::OpTrunc<uint64>(SIMDValue* dst, SIMDValue* src);
92+
4393
void SIMDInt64x2Operation::OpShiftLeftByScalar(SIMDValue* dst, SIMDValue* src, int count)
4494
{
4595
count = count & SIMDUtils::SIMDGetShiftAmountMask(8);

lib/Runtime/Language/SimdInt64x2Operation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Js {
1616
//pointer-based arguments are used to ensure that calling conventions are consistent across x86/x64
1717
//and match call sequences JIT generates.
1818
//TODO: nikolayk back to "const SIMDValue& a"
19+
template<typename T> static void OpTrunc(SIMDValue* dst, SIMDValue* src);
1920
static void OpShiftLeftByScalar(SIMDValue* dst, SIMDValue* src, int count);
2021
static void OpShiftRightByScalar(SIMDValue* dst, SIMDValue* src, int count);
2122
static void OpShiftRightByScalarU(SIMDValue* dst, SIMDValue* src, int count);

lib/Runtime/Library/amd64/JavascriptFunctionA.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ LEAF_END _ZN2Js18JavascriptFunction17CallAsmJsFunctionIdEET_PNS_16RecyclableObje
187187
// AsmJsSIMDValue CallAsmJsFunction<AsmJsSIMDValue>(RecyclableObject *function, JavascriptMethod entryPoint, uint argc, Var *argv);
188188
.balign 16
189189
LEAF_ENTRY _ZN2Js18JavascriptFunction17CallAsmJsFunctionIDv4_fEET_PNS_16RecyclableObjectEPFPvS5_NS_8CallInfoEzEjPS6_, _TEXT
190-
int 3 //TODO: Verify this code path when enabling WASM.SIMD for xplat
190+
int 3 //TODO: Verify this code path when enabling WASM.SIMD for xplat
191191
jmp C_FUNC(_ZN2Js18JavascriptFunction17CallAsmJsFunctionIiEET_PNS_16RecyclableObjectEPFPvS4_NS_8CallInfoEzEPS5_jPh)
192192
LEAF_END _ZN2Js18JavascriptFunction17CallAsmJsFunctionIDv4_fEET_PNS_16RecyclableObjectEPFPvS5_NS_8CallInfoEzEjPS6_, _TEXT
193193

lib/WasmReader/WasmBinaryOpcodesSimd.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ WASM_UNARY__OPCODE(F4Sqrt, 0x182, M128_M128, Simd128_Sqrt_F4, false)
195195
WASM_UNARY__OPCODE(F2Sqrt, 0x183, M128_M128, Simd128_Sqrt_D2, false)
196196
WASM_UNARY__OPCODE(F4ConvertS, 0x184, M128_M128, Simd128_FromInt32x4_F4, false)
197197
WASM_UNARY__OPCODE(F4ConvertU, 0x185, M128_M128, Simd128_FromUint32x4_F4, false)
198-
WASM_MISC_OPCODE(F2ConvertS, 0x186, Limit, true)
199-
WASM_MISC_OPCODE(F2ConvertU, 0x187, Limit, true)
198+
WASM_UNARY__OPCODE(F2ConvertS, 0x186, M128_M128, Simd128_FromInt64x2_D2, false)
199+
WASM_UNARY__OPCODE(F2ConvertU, 0x187, M128_M128, Simd128_FromUint64x2_D2, false)
200200
WASM_UNARY__OPCODE(I4TruncS, 0x188, M128_M128, Simd128_FromFloat32x4_I4, false)
201201
WASM_UNARY__OPCODE(I4TruncU, 0x189, M128_M128, Simd128_FromFloat32x4_U4, false)
202-
WASM_MISC_OPCODE(I2TruncS, 0x18a, Limit, true)
203-
WASM_MISC_OPCODE(I2TruncU, 0x18b, Limit, true)
202+
WASM_UNARY__OPCODE(I2TruncS, 0x18a, M128_M128, Simd128_FromFloat64x2_I2, false)
203+
WASM_UNARY__OPCODE(I2TruncU, 0x18b, M128_M128, Simd128_FromFloat64x2_U2, false)
204204

205205
#undef WASM_SIMD_BUILD_OPCODE
206206
#undef WASM_LANE_OPCODE

test/wasm.simd/math.wasm

188 Bytes
Binary file not shown.

test/wasm.simd/math.wast

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,24 @@
311311
(set_local $v1 (m128.load offset=0 align=4 (i32.const 0)))
312312
(m128.store offset=0 (i32.const 0) (f64x2.sqrt (get_local $v1)))
313313
)
314+
315+
(func (export "func_i64x2_trunc_s") (local $v1 m128)
316+
(set_local $v1 (m128.load offset=0 align=4 (i32.const 0)))
317+
(m128.store offset=0 (i32.const 0) (i64x2.trunc_s (get_local $v1)))
318+
)
319+
320+
(func (export "func_i64x2_trunc_u") (local $v1 m128)
321+
(set_local $v1 (m128.load offset=0 align=4 (i32.const 0)))
322+
(m128.store offset=0 (i32.const 0) (i64x2.trunc_u (get_local $v1)))
323+
)
324+
325+
(func (export "func_f64x2_convert_s") (local $v1 m128)
326+
(set_local $v1 (m128.load offset=0 align=4 (i32.const 0)))
327+
(m128.store offset=0 (i32.const 0) (f64x2.convert_s (get_local $v1)))
328+
)
329+
330+
(func (export "func_f64x2_convert_u") (local $v1 m128)
331+
(set_local $v1 (m128.load offset=0 align=4 (i32.const 0)))
332+
(m128.store offset=0 (i32.const 0) (f64x2.convert_u (get_local $v1)))
333+
)
314334
)

test/wasm.simd/mathTests.js

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const arrays = {
2020
"i16x8" : new Int16Array (memObj.buffer),
2121
"i8x16" : new Int8Array (memObj.buffer),
2222
"f32x4" : new Float32Array (memObj.buffer),
23-
"f64x2" : new Float64Array (memObj.buffer)
23+
"f64x2" : new Float64Array (memObj.buffer),
24+
"i64x2" : new Int32Array (memObj.buffer)
2425
};
2526

2627
function moveArgsIntoArray(args, offset, arr) {
@@ -70,6 +71,28 @@ let testMathOps = function (funcname, args1, args2, resultArr) {
7071
}
7172
}
7273

74+
let reverse64x2Type = (type) => type === "f64x2" ? "i64x2" : "f64x2";
75+
let testTruncConvOps = function (funcname, args1, resultArr) {
76+
77+
const len = args1.length;
78+
const type = funcname.split('_')[1];
79+
const resultType = reverse64x2Type(type);
80+
const arr = arrays[resultType];
81+
const resultArrView = arrays[type];
82+
83+
moveArgsIntoArray(args1, 0, arr);
84+
instance[funcname]();
85+
86+
for (let i = 0; i < resultArr.length; i++) {
87+
if (type === "f64x2" && Number.isNaN(resultArr[i])) {
88+
assertEquals(true, Number.isNaN(resultArrView[i]));
89+
} else {
90+
assertEquals(resultArr[i], resultArrView[i]);
91+
}
92+
93+
}
94+
}
95+
7396
//i32x4
7497
testMathOps("func_i32x4_add",
7598
[2147483645 , 0, -1, 65536],
@@ -357,6 +380,36 @@ testMathOps("func_i8x16_shuffle_test2",
357380
[0 , 17 , 1 , 18 , 2 , 19 , 3 , 20 , 4 , 21 , 5 , 22 , 6 , 23 , 7 , 24]
358381
);
359382

383+
testTruncConvOps("func_f64x2_convert_u",
384+
[0xffffffff|0, 0xffffffff|0, 0, 0],
385+
[1.8446744073709552e+19, 0]
386+
);
387+
388+
testTruncConvOps("func_f64x2_convert_s",
389+
[0xffffffff|0, 0x7fffffff|0, 0x0|0, 0x80000000|0],
390+
[9.2233720368547758e+18, -9.2233720368547758e+18]
391+
);
392+
393+
testTruncConvOps("func_i64x2_trunc_u",
394+
[1.8446744073709553e+19, -1],
395+
[0xffffffff|0, 0xffffffff|0, 0, 0]
396+
);
397+
398+
testTruncConvOps("func_i64x2_trunc_u",
399+
[12345.6, Number.NaN],
400+
[12345, 0, 0, 0]
401+
);
402+
403+
testTruncConvOps("func_i64x2_trunc_s",
404+
[9.2233720368547759e+18, -9.2233720368547759e+18],
405+
[0xffffffff|0, 0x7fffffff|0, 0x0|0, 0x80000000|0]
406+
);
407+
408+
testTruncConvOps("func_i64x2_trunc_s",
409+
[-12345.6, Number.NaN],
410+
[-12345, -1, 0, 0]
411+
);
412+
360413
if (passed) {
361414
print("Passed");
362415
}

0 commit comments

Comments
 (0)