Skip to content

Commit fc0f790

Browse files
author
Sergey Andreenko
authored
Fix tizen arm32 issue. (#55987)
* Add asserts that we don't expect LONG copies on arm32. * Fix tizen.
1 parent 978b0db commit fc0f790

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

src/coreclr/jit/codegencommon.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12641,7 +12641,23 @@ void CodeGen::genCodeForBitCast(GenTreeOp* treeNode)
1264112641
}
1264212642
else
1264312643
{
12644-
genBitCast(targetType, targetReg, op1->TypeGet(), op1->GetRegNum());
12644+
#ifdef TARGET_ARM
12645+
if (compiler->opts.compUseSoftFP && (targetType == TYP_LONG))
12646+
{
12647+
// This is a special arm-softFP case when a TYP_LONG node was introduced during lowering
12648+
// for a call argument, so it was not handled by decomposelongs phase as all other TYP_LONG nodes.
12649+
// Example foo(double LclVar V01), LclVar V01 has to be passed in general registers r0, r1,
12650+
// so lowering will add `BITCAST long(LclVar double V01)` and codegen has to support it here.
12651+
const regNumber srcReg = op1->GetRegNum();
12652+
const regNumber otherReg = treeNode->AsMultiRegOp()->gtOtherReg;
12653+
assert(otherReg != REG_NA);
12654+
inst_RV_RV_RV(INS_vmov_d2i, targetReg, otherReg, srcReg, EA_8BYTE);
12655+
}
12656+
else
12657+
#endif // TARGET_ARM
12658+
{
12659+
genBitCast(targetType, targetReg, op1->TypeGet(), op1->GetRegNum());
12660+
}
1264512661
}
1264612662
genProduceReg(treeNode);
1264712663
}

src/coreclr/jit/instr.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,15 +1911,19 @@ instruction CodeGen::ins_Copy(regNumber srcReg, var_types dstType)
19111911
return INS_mov;
19121912
}
19131913
#elif defined(TARGET_ARM)
1914-
// No SIMD support yet
1914+
// No SIMD support yet.
19151915
assert(!varTypeIsSIMD(dstType));
19161916
if (dstIsFloatReg)
19171917
{
1918-
return (dstType == TYP_DOUBLE) ? INS_vmov_i2d : INS_vmov_i2f;
1918+
// Can't have LONG in a register.
1919+
assert(dstType == TYP_FLOAT);
1920+
return INS_vmov_i2f;
19191921
}
19201922
else
19211923
{
1922-
return (dstType == TYP_LONG) ? INS_vmov_d2i : INS_vmov_f2i;
1924+
// Can't have LONG in a register.
1925+
assert(dstType == TYP_INT);
1926+
return INS_vmov_f2i;
19231927
}
19241928
#else // TARGET*
19251929
#error "Unknown TARGET"

src/coreclr/jit/lower.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,11 @@ GenTree* Lowering::LowerFloatArgReg(GenTree* arg, regNumber regNum)
15071507
#ifdef TARGET_ARM
15081508
if (floatType == TYP_DOUBLE)
15091509
{
1510+
// A special case when we introduce TYP_LONG
1511+
// during lowering for arm32 softFP to pass double
1512+
// in int registers.
1513+
assert(comp->opts.compUseSoftFP);
1514+
15101515
regNumber nextReg = REG_NEXT(regNum);
15111516
intArg->AsMultiRegOp()->gtOtherReg = nextReg;
15121517
}

0 commit comments

Comments
 (0)