ARM64: Fix casting unsigned int to double
authorKyungwoo Lee <kyulee@microsoft.com>
Mon, 14 Mar 2016 17:12:34 +0000 (10:12 -0700)
committerKyungwoo Lee <kyulee@microsoft.com>
Mon, 14 Mar 2016 17:17:13 +0000 (10:17 -0700)
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
src/coreclr/tests/arm64/Tests.lst

index a1a04c2..ee24891 100644 (file)
@@ -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)
index ac95b76..e639a31 100644 (file)
@@ -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