Re:MathSharp, a vector and matrix library written in C# usin...
by Faark on Thursday September 12, 2019 @07:56PM
(#20957739)
There was some discussion here on hn a few days ago [0] that linked to a blog post about those intrinsics [1]. Those should indeed be optimized away. The relevant section:
> The IsSupported checks are treated as runtime constants by the JIT (when optimizations are enabled) and so you do not need to cross-compile to support multiple different ISAs, platforms, or architectures. Instead, you just write your code using if-statements and the unused code paths (any code path which is not executed, due to the condition for the branch being false or an earlier branch being taken instead) are dropped from the generated code (the native assembly code generated by the JIT at runtime).
> The IsSupported checks are treated as runtime constants by the JIT (when optimizations are enabled) and so you do not need to cross-compile to support multiple different ISAs, platforms, or architectures. Instead, you just write your code using if-statements and the unused code paths (any code path which is not executed, due to the condition for the branch being false or an earlier branch being taken instead) are dropped from the generated code (the native assembly code generated by the JIT at runtime).
[0] https://news.ycombinator.com/item?id=20915430 [1] https://devblogs.microsoft.com/dotnet/hardware-intrinsics-in...