summaryrefslogtreecommitdiff
path: root/src/jit/compiler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jit/compiler.hpp')
-rw-r--r--src/jit/compiler.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index ab3f32e548..2b9f3aa94b 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -1436,6 +1436,15 @@ inline void GenTree::SetOper(genTreeOps oper, ValueNumberUpdate vnUpdate)
assert(GenTree::s_gtNodeSizes[oper] == TREE_NODE_SZ_SMALL || GenTree::s_gtNodeSizes[oper] == TREE_NODE_SZ_LARGE);
assert(GenTree::s_gtNodeSizes[oper] == TREE_NODE_SZ_SMALL || (gtDebugFlags & GTF_DEBUG_NODE_LARGE));
+#if defined(_HOST_64BIT_) && !defined(_TARGET_64BIT_)
+ if (gtOper == GT_CNS_LNG && oper == GT_CNS_INT)
+ {
+ // When casting from LONG to INT, we need to force cast of the value,
+ // if the host architecture represents INT and LONG with the same data size.
+ gtLngCon.gtLconVal = (INT64)(INT32)gtLngCon.gtLconVal;
+ }
+#endif // defined(_HOST_64BIT_) && !defined(_TARGET_64BIT_)
+
SetOperRaw(oper);
#ifdef DEBUG