Conversation
|
Tagging subscribers to this area: @dotnet/area-system-numerics |
|
I assume that this change is expected to be a performance improvement. Is that correct? Could you please share some numbers for how this improves performance of public APIs? |
|
Sorry for late response, finally got benchmarking working. Benchmark is for checked multiplication of Top one is main branch, not a big improvement it seems... |
It's to be expected overall. We generally have good handling of promotion for types that only contain two primitive fields and we have code paths that check if upper of both inputs are 0 so we can specialize the codegen down to So this is really just reducing the work the JIT has to do and in turn does a little bit of cleanup around the inlining boundaries where forward sub isn't robust enough today. It's essentially a simplification of the code path and one that won't change, so it's something I'm happy to take |
For
Math.BigMul(ulong a, ulong b, out ulong low): now we can leverage intrinsicsFor
Math.UInt128 BigMul(UInt128 left, UInt128 right, out UInt128 lower): Don't do 128x128-bit multiplication when we can use 64x64-bit.Note: maybe there will be performance regressions due to #75594, but in that case it would be better to remove affected intrinsics-usage in the BigMul methods until the underlying issue is resolved.