num-bigint icon indicating copy to clipboard operation
num-bigint copied to clipboard

Use inline asm! for x86 DIV on Rust 1.59+

Open cuviper opened this issue 3 years ago • 3 comments

cuviper avatar Feb 23 '22 21:02 cuviper

bors try

cuviper avatar Feb 24 '22 19:02 cuviper

While this does improve benchmarks here and in my own programs, one downside is that this asm! is opaque to LLVM, so it doesn't get a chance to optimize division by a constant (scalar) value into "magic" multiplication.

cuviper avatar Feb 25 '22 01:02 cuviper

On further reflection, the measured gains should outweigh theoretical optimization losses.

Maybe someday we could try is_val_statically_known to detect divisors that might be optimizable.

cuviper avatar May 06 '24 21:05 cuviper