.net 如何检测C代码是否使用硬件内部函数?
.NET5下的C#的System.Numerics API包括具有硬件支持的函数。这些函数被标记为“内在” 当您检查生成的IL是否有“operator+”之类的内容时,您将看到:.net 如何检测C代码是否使用硬件内部函数?,.net,.net-core,.net,.net Core,.NET5下的C#的System.Numerics API包括具有硬件支持的函数。这些函数被标记为“内在” 当您检查生成的IL是否有“operator+”之类的内容时,您将看到: "IL_000d: call valuetype [System.Private.CoreLib]System.Numerics.Vector3 [System.Private.CoreLib]System.Numerics.Vector3::op_Addition(valuetype [Sy
"IL_000d: call valuetype [System.Private.CoreLib]System.Numerics.Vector3 [System.Private.CoreLib]System.Numerics.Vector3::op_Addition(valuetype [System.Private.CoreLib]System.Numerics.Vector3, valuetype [System.Private.CoreLib]System.Numerics.Vector3)"
您可以在“Vector3_Intrinsics.cs”中看到这一点的实现说明:
如果我在dotnet下运行此代码,如何确定我的特定运行是否使用了硬件内部函数?有可用的工具吗
我知道有一个API可以告诉您的硬件是否支持此功能,但您如何确定JIT是否真的支持此功能?您为什么想知道此信息?
// This file contains the definitions for all of the JIT intrinsic methods and properties that are recognized by the current x64 JIT compiler.
// The implementation defined here is used in any circumstance where the JIT fails to recognize these members as intrinsic.
// The JIT recognizes these methods and properties by name and signature: if either is changed, the JIT will no longer recognize the member.
// Some methods declared here are not strictly intrinsic, but delegate to an intrinsic method. For example, only one overload of CopyTo()
// is actually recognized by the JIT, but both are here for simplicity.