Skip to content

Commit f1a2cdc

Browse files
committed
[MERGE #5907 @penzn] [WASM SIMD] Release registers in shuffle
Merge pull request #5907 from penzn:wasm.shuffle.releaselocation Release bytecode locations for WASM SIMD shuffle instruction. Use correct order of operands in `IRBuilderAsmJs` as it expects processing of uses before processing of defs. For #5898
2 parents 1a88201 + 52dcd2b commit f1a2cdc

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/Backend/IRBuilderAsmJs.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ IRBuilderAsmJs::BuildSrcOpnd(Js::RegSlot srcRegSlot, IRType type)
337337
{
338338
StackSym * symSrc = m_func->m_symTable->FindStackSym(BuildSrcStackSymID(srcRegSlot, type));
339339
AssertMsg(symSrc, "Tried to use an undefined stack slot?");
340-
IR::RegOpnd * regOpnd = IR::RegOpnd::New(symSrc, type, m_func);
340+
IR::RegOpnd * regOpnd = IR::RegOpnd::New(symSrc, type, m_func);
341341

342342
return regOpnd;
343343
}
@@ -5901,7 +5901,6 @@ IRBuilderAsmJs::BuildInt1Uint8x16_1Int1(Js::OpCodeAsmJs newOpcode, uint32 offset
59015901

59025902
void IRBuilderAsmJs::BuildUint8x16_2Int16(Js::OpCodeAsmJs newOpcode, uint32 offset, BUILD_SIMD_ARGS_REG18)
59035903
{
5904-
IR::RegOpnd * dstOpnd = BuildDstOpnd(dstRegSlot, TySimd128U16);
59055904
IR::RegOpnd * src1Opnd = BuildSrcOpnd(src1RegSlot, TySimd128U16);
59065905

59075906
IR::RegOpnd * src2Opnd = BuildIntConstOpnd(src2RegSlot);
@@ -5921,6 +5920,8 @@ void IRBuilderAsmJs::BuildUint8x16_2Int16(Js::OpCodeAsmJs newOpcode, uint32 offs
59215920
IR::RegOpnd * src16Opnd = BuildIntConstOpnd(src16RegSlot);
59225921
IR::RegOpnd * src17Opnd = BuildIntConstOpnd(src17RegSlot);
59235922

5923+
IR::RegOpnd * dstOpnd = BuildDstOpnd(dstRegSlot, TySimd128U16);
5924+
59245925
IR::Instr * instr = nullptr;
59255926
dstOpnd->SetValueType(ValueType::Simd);
59265927
src1Opnd->SetValueType(ValueType::Simd);
@@ -5959,9 +5960,9 @@ IRBuilderAsmJs::BuildAsmShuffle(Js::OpCodeAsmJs newOpcode, uint32 offset)
59595960
Assert(OpCodeAttrAsmJs::HasMultiSizeLayout(newOpcode) && newOpcode == Js::OpCodeAsmJs::Simd128_Shuffle_V8X16);
59605961
auto layout = m_jnReader.GetLayout<Js::OpLayoutT_AsmShuffle<SizePolicy>>();
59615962

5962-
IR::RegOpnd * dstOpnd = BuildDstOpnd(GetRegSlotFromSimd128Reg(layout->R0), TySimd128U16);
59635963
IR::RegOpnd * src1Opnd = BuildSrcOpnd(GetRegSlotFromSimd128Reg(layout->R1), TySimd128U16);
59645964
IR::RegOpnd * src2Opnd = BuildSrcOpnd(GetRegSlotFromSimd128Reg(layout->R2), TySimd128U16);
5965+
IR::RegOpnd * dstOpnd = BuildDstOpnd(GetRegSlotFromSimd128Reg(layout->R0), TySimd128U16);
59655966
dstOpnd->SetValueType(ValueType::Simd);
59665967
src1Opnd->SetValueType(ValueType::Simd);
59675968
src2Opnd->SetValueType(ValueType::Simd);
@@ -5980,7 +5981,6 @@ IRBuilderAsmJs::BuildAsmShuffle(Js::OpCodeAsmJs newOpcode, uint32 offset)
59805981

59815982
void IRBuilderAsmJs::BuildUint8x16_3Int16(Js::OpCodeAsmJs newOpcode, uint32 offset, BUILD_SIMD_ARGS_REG19)
59825983
{
5983-
IR::RegOpnd * dstOpnd = BuildDstOpnd(dstRegSlot, TySimd128U16);
59845984
IR::RegOpnd * src1Opnd = BuildSrcOpnd(src1RegSlot, TySimd128U16);
59855985
IR::RegOpnd * src2Opnd = BuildSrcOpnd(src2RegSlot, TySimd128U16);
59865986

@@ -6001,6 +6001,8 @@ void IRBuilderAsmJs::BuildUint8x16_3Int16(Js::OpCodeAsmJs newOpcode, uint32 offs
60016001
IR::RegOpnd * src17Opnd = BuildIntConstOpnd(src17RegSlot);
60026002
IR::RegOpnd * src18Opnd = BuildIntConstOpnd(src18RegSlot);
60036003

6004+
IR::RegOpnd * dstOpnd = BuildDstOpnd(dstRegSlot, TySimd128U16);
6005+
60046006
IR::Instr * instr = nullptr;
60056007
dstOpnd->SetValueType(ValueType::Simd);
60066008
src1Opnd->SetValueType(ValueType::Simd);

lib/WasmReader/WasmByteCodeGenerator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,8 @@ EmitInfo WasmBytecodeGenerator::EmitV8X16Shuffle()
15961596
EmitInfo arg2Info = PopEvalStack(WasmTypes::M128);
15971597
EmitInfo arg1Info = PopEvalStack(WasmTypes::M128);
15981598

1599-
// FIXME Release arg2Info and arg1Info
1599+
ReleaseLocation(&arg2Info);
1600+
ReleaseLocation(&arg1Info);
16001601

16011602
Js::RegSlot resultReg = GetRegisterSpace(WasmTypes::M128)->AcquireTmpRegister();
16021603
EmitInfo resultInfo(resultReg, WasmTypes::M128);

0 commit comments

Comments
 (0)