From 518a40afe20ba57e68557c323319bb090383fe9c Mon Sep 17 00:00:00 2001 From: Kyungwoo Lee Date: Mon, 14 Mar 2016 10:12:34 -0700 Subject: [PATCH] ARM64: Fix casting unsigned int to double When casting unsigned int to double, JIT emitted ```scvtf``` instead of ```uscvtf```. The issue was JIT used dst type instead of src type for checking the sign. This fixes a part of https://github.com/dotnet/coreclr/issues/3667. Commit migrated from https://github.com/dotnet/coreclr/commit/09d80083421bc69cc592a71bb00e63a3eebe91c5 --- src/coreclr/src/jit/codegenarm64.cpp | 7 +------ src/coreclr/tests/arm64/Tests.lst | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/coreclr/src/jit/codegenarm64.cpp b/src/coreclr/src/jit/codegenarm64.cpp index a1a04c2..ee24891 100644 --- a/src/coreclr/src/jit/codegenarm64.cpp +++ b/src/coreclr/src/jit/codegenarm64.cpp @@ -6225,14 +6225,9 @@ CodeGen::genIntToFloatCast(GenTreePtr treeNode) emitAttr srcSize = EA_ATTR(genTypeSize(srcType)); noway_assert((srcSize == EA_4BYTE) ||(srcSize == EA_8BYTE)); - instruction ins = INS_scvtf; // default to sign converts + instruction ins = varTypeIsUnsigned(srcType) ? INS_ucvtf : INS_scvtf; insOpts cvtOption = INS_OPTS_NONE; // invalid value - if (varTypeIsUnsigned(dstType)) - { - ins = INS_ucvtf; // use unsigned converts - } - if (dstType == TYP_DOUBLE) { if (srcSize == EA_4BYTE) diff --git a/src/coreclr/tests/arm64/Tests.lst b/src/coreclr/tests/arm64/Tests.lst index ac95b76..e639a31 100644 --- a/src/coreclr/tests/arm64/Tests.lst +++ b/src/coreclr/tests/arm64/Tests.lst @@ -36404,7 +36404,7 @@ RelativePath=JIT\Regression\CLR-x86-JIT\V1-M12-Beta2\b68045\b68045\b68045.exe WorkingDir=JIT\Regression\CLR-x86-JIT\V1-M12-Beta2\b68045\b68045 Expected=100 MaxAllowedDurationSeconds=600 -Categories=Pri0;JIT;EXPECTED_FAIL;ISSUE_3667 +Categories=Pri0;JIT;EXPECTED_PASS HostStyle=Any [b68361.exe_5201] RelativePath=JIT\Regression\CLR-x86-JIT\V1-M12-Beta2\b68361\b68361\b68361.exe -- 2.7.4