Skip to content

Commit facd855

Browse files
authored
JIT: Handle more unsupported argument conversion cases (#119388)
On 32-bit platforms we can end up with long operands to a function taking a parameter in a double. We would try to create bitcasts for this cast. Generalize a condition to properly detect this unsupported case.
1 parent 043fcd5 commit facd855

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/coreclr/jit/lower.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,8 +1562,6 @@ void Lowering::LowerArg(GenTreeCall* call, CallArg* callArg)
15621562

15631563
if (varTypeIsLong(arg))
15641564
{
1565-
assert(callArg->AbiInfo.CountRegsAndStackSlots() == 2);
1566-
15671565
noway_assert(arg->OperIs(GT_LONG));
15681566
GenTreeFieldList* fieldList = new (comp, GT_FIELD_LIST) GenTreeFieldList();
15691567
fieldList->AddFieldLIR(comp, arg->gtGetOp1(), 0, TYP_INT);
@@ -5177,6 +5175,16 @@ bool Lowering::IsFieldListCompatibleWithRegisters(GenTreeFieldList* fieldList,
51775175
return false;
51785176
}
51795177

5178+
// int -> float is currently only supported if we can do it as a single bitcast (i.e. without insertions
5179+
// required)
5180+
if (varTypeUsesIntReg(use->GetNode()) && varTypeUsesFloatReg(regType) &&
5181+
(genTypeSize(regType) > TARGET_POINTER_SIZE))
5182+
{
5183+
JITDUMP("it is not; field [%06u] requires an insertion into float register %u of size %d\n",
5184+
Compiler::dspTreeID(use->GetNode()), i, genTypeSize(regType));
5185+
return false;
5186+
}
5187+
51805188
use = use->GetNext();
51815189
} while (use != nullptr);
51825190
}

0 commit comments

Comments
 (0)