summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jit/codegenxarch.cpp3
-rw-r--r--src/jit/morph.cpp9
-rw-r--r--src/vm/jithelpers.cpp2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index 17967cbba7..d91a73b7b5 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -8018,7 +8018,8 @@ void CodeGen::genIntToFloatCast(GenTreePtr treeNode)
assert(!varTypeIsFloating(srcType) && varTypeIsFloating(dstType));
#if !defined(_TARGET_64BIT_)
- NYI_IF(varTypeIsLong(srcType), "Conversion from long to float");
+ // We expect morph to replace long to float/double casts with helper calls
+ noway_assert(!varTypeIsLong(srcType));
#endif // !defined(_TARGET_64BIT_)
// Since xarch emitter doesn't handle reporting gc-info correctly while casting away gc-ness we
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 15f9790d8b..3c0a4fd35c 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -360,8 +360,17 @@ GenTreePtr Compiler::fgMorphCast(GenTreePtr tree)
oper = gtNewCastNode(TYP_LONG, oper, TYP_LONG);
oper->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT | GTF_UNSIGNED));
tree->gtFlags &= ~GTF_UNSIGNED;
+#ifndef LEGACY_BACKEND
+ return fgMorphCastIntoHelper(tree, CORINFO_HELP_LNG2DBL, oper);
+#endif
}
}
+#ifndef LEGACY_BACKEND
+ else if (((tree->gtFlags & GTF_UNSIGNED) == 0) && (srcType == TYP_LONG) && varTypeIsFloating(dstType))
+ {
+ return fgMorphCastIntoHelper(tree, CORINFO_HELP_LNG2DBL, oper);
+ }
+#endif
#endif //_TARGET_XARCH_
else if (varTypeIsGC(srcType) != varTypeIsGC(dstType))
{
diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp
index dac9f59246..641575d584 100644
--- a/src/vm/jithelpers.cpp
+++ b/src/vm/jithelpers.cpp
@@ -513,7 +513,7 @@ HCIMPL1_V(double, JIT_ULng2Dbl, UINT64 val)
HCIMPLEND
/*********************************************************************/
-// needed for ARM
+// needed for ARM and RyuJIT-x86
HCIMPL1_V(double, JIT_Lng2Dbl, INT64 val)
{
FCALL_CONTRACT;