Skip to content

Commit

Permalink
Fix tizen arm32 issue. (#55987)
Browse files Browse the repository at this point in the history
* Add asserts that we don't expect LONG copies on arm32.

* Fix tizen.
  • Loading branch information
Sergey Andreenko committed Jul 20, 2021
1 parent 978b0db commit fc0f790
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
18 changes: 17 additions & 1 deletion src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12641,7 +12641,23 @@ void CodeGen::genCodeForBitCast(GenTreeOp* treeNode)
}
else
{
genBitCast(targetType, targetReg, op1->TypeGet(), op1->GetRegNum());
#ifdef TARGET_ARM
if (compiler->opts.compUseSoftFP && (targetType == TYP_LONG))
{
// This is a special arm-softFP case when a TYP_LONG node was introduced during lowering
// for a call argument, so it was not handled by decomposelongs phase as all other TYP_LONG nodes.
// Example foo(double LclVar V01), LclVar V01 has to be passed in general registers r0, r1,
// so lowering will add `BITCAST long(LclVar double V01)` and codegen has to support it here.
const regNumber srcReg = op1->GetRegNum();
const regNumber otherReg = treeNode->AsMultiRegOp()->gtOtherReg;
assert(otherReg != REG_NA);
inst_RV_RV_RV(INS_vmov_d2i, targetReg, otherReg, srcReg, EA_8BYTE);
}
else
#endif // TARGET_ARM
{
genBitCast(targetType, targetReg, op1->TypeGet(), op1->GetRegNum());
}
}
genProduceReg(treeNode);
}
10 changes: 7 additions & 3 deletions src/coreclr/jit/instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1911,15 +1911,19 @@ instruction CodeGen::ins_Copy(regNumber srcReg, var_types dstType)
return INS_mov;
}
#elif defined(TARGET_ARM)
// No SIMD support yet
// No SIMD support yet.
assert(!varTypeIsSIMD(dstType));
if (dstIsFloatReg)
{
return (dstType == TYP_DOUBLE) ? INS_vmov_i2d : INS_vmov_i2f;
// Can't have LONG in a register.
assert(dstType == TYP_FLOAT);
return INS_vmov_i2f;
}
else
{
return (dstType == TYP_LONG) ? INS_vmov_d2i : INS_vmov_f2i;
// Can't have LONG in a register.
assert(dstType == TYP_INT);
return INS_vmov_f2i;
}
#else // TARGET*
#error "Unknown TARGET"
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,11 @@ GenTree* Lowering::LowerFloatArgReg(GenTree* arg, regNumber regNum)
#ifdef TARGET_ARM
if (floatType == TYP_DOUBLE)
{
// A special case when we introduce TYP_LONG
// during lowering for arm32 softFP to pass double
// in int registers.
assert(comp->opts.compUseSoftFP);

regNumber nextReg = REG_NEXT(regNum);
intArg->AsMultiRegOp()->gtOtherReg = nextReg;
}
Expand Down

0 comments on commit fc0f790

Please sign in to comment.