[crossgen2] Handle Floor and Ceiling (dotnet/coreclr#27003)
authorAndrew Au <andrewau@microsoft.com>
Thu, 3 Oct 2019 12:14:42 +0000 (05:14 -0700)
committerMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Thu, 3 Oct 2019 12:14:42 +0000 (14:14 +0200)
Commit migrated from https://github.com/dotnet/coreclr/commit/8e4d98a34aaa115d8f8004aadfaa37716e06e3ae

src/coreclr/src/tools/crossgen2/Common/JitInterface/CorInfoImpl.Intrinsics.cs

index aa86fe7..a8f5eb9 100644 (file)
@@ -117,10 +117,15 @@ namespace Internal.JitInterface
             table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Pow, "Pow", "System", "MathF");
             table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Exp, "Exp", "System", "Math");
             table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Exp, "Exp", "System", "MathF");
+#if !READYTORUN
+            // These are normally handled via the SSE4.1 instructions ROUNDSS/ROUNDSD.
+            // However, we don't know the ISAs the target machine supports so we should
+            // fallback to the method call implementation instead.
             table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Ceiling, "Ceiling", "System", "Math");
             table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Ceiling, "Ceiling", "System", "MathF");
             table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Floor, "Floor", "System", "Math");
             table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Floor, "Floor", "System", "MathF");
+#endif
             // table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetChar, null, null, null); // unused
             // table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Array_GetDimLength, "GetLength", "System", "Array"); // not handled
             table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_Array_Get, "Get", null, null);