dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.36k stars 4.74k forks source link

RyuJIT/x86: import non-target intrinsics as intrinsics #7032

Open pgavlin opened 7 years ago

pgavlin commented 7 years ago

As of dotnet/coreclr#8235, RyuJIT/x86 imports intrinsics that are not supported by the target as calls to user functions. This has an obvious CQ downside in that it prohibits the compiler from reasoning more precisely about the behavior of the calls. Unfortunately, there is a phase ordering issue that complicates importing these intrinsics as intrinsics and allowing the rationalizer to rewrite them back into user calls: on x86, morph is responsible for calculating the depth of the stack at certain points in the method, but it does not handle intrinsics when doing so. Incorrect stack depth information can cause SBCG in functions with EH.

The most straightforward fix aside from the one that was chosen by dotnet/coreclr#8235 would seem to be to update morph to take non-target intrinsics into account when calculating the stack depth. category:cq theme:hardware-intrinsics skill-level:intermediate cost:medium

AndyAyersMS commented 6 years ago

Wonder if this is unblocked by dotnet/coreclr#15597 and/or dotnet/coreclr#16411?