Skip to content

Commit 36bc6b4

Browse files
committed
Fixed bug with * x = dConst if dConst is not 0
1 parent ee617c7 commit 36bc6b4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/coreclr/jit/lower.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -6792,8 +6792,6 @@ void Lowering::LowerStoreIndirCommon(GenTreeStoreInd* ind)
67926792
TryCreateAddrMode(ind->Addr(), true, ind->TypeGet());
67936793
if (!comp->codeGen->gcInfo.gcIsWriteBarrierStoreIndNode(ind))
67946794
{
6795-
LowerStoreIndir(ind);
6796-
67976795
if (varTypeIsFloating(ind) && ind->Data()->IsCnsFltOrDbl())
67986796
{
67996797
// Optimize *x = DCON to *x = ICON which is slightly faster on xarch
@@ -6802,11 +6800,16 @@ void Lowering::LowerStoreIndirCommon(GenTreeStoreInd* ind)
68026800
ssize_t intCns = 0;
68036801
var_types type = TYP_UNKNOWN;
68046802

6805-
if (ind->TypeIs(TYP_FLOAT))
6803+
if (ind->TypeIs(TYP_FLOAT)
6804+
#if defined(TARGET_ARM64) || defined(TARGET_ARM)
6805+
&& data->IsFPZero()
6806+
#endif
6807+
)
68066808
{
68076809
float fltCns = static_cast<float>(dblCns); // should be a safe round-trip
68086810
intCns = static_cast<ssize_t>(*reinterpret_cast<INT32*>(&fltCns));
68096811
type = TYP_INT;
6812+
printf("qwe");
68106813
}
68116814
#ifdef TARGET_AMD64
68126815
else
@@ -6820,12 +6823,11 @@ void Lowering::LowerStoreIndirCommon(GenTreeStoreInd* ind)
68206823
if (type != TYP_UNKNOWN)
68216824
{
68226825
data->BashToConst(intCns, type);
6823-
#if defined(TARGET_ARM64)
6824-
data->SetContained();
6825-
#endif
68266826
ind->ChangeType(type);
68276827
}
68286828
}
6829+
6830+
LowerStoreIndir(ind);
68296831
}
68306832
}
68316833

0 commit comments

Comments
 (0)