compiler-builtins icon indicating copy to clipboard operation
compiler-builtins copied to clipboard

libm: implement accelerated computation of `(x << e) % y`

Open quaternic opened this issue 5 months ago • 3 comments

Builds on rust-lang/compiler-builtins#1011, both were split from rust-lang/compiler-builtins#1002

The computation is implemented in linear_mul_reduction.

quaternic avatar Aug 12 '25 15:08 quaternic

I've now rebased and applied the previous feedback.

@tgross35

Could you add a module-level doc comment with some of the common names used here? E.g. R, RR (if that's not R*R) r, m, q, xq. I'm unfortunately a bit lost :) (but I don't need to understand it in detail)

To make the module easier to follow, I moved the public interface, fn linear_mul_reduction, to the start of the file and added more explanatory comments. That should be understandable on its own. The implementation is essentially unchanged from before, other than one minor tweak.

quaternic avatar Sep 08 '25 17:09 quaternic

I've gone through and rewritten the comments for the implementation of Reducer, which should actually be understandable now. (At least this time I didn't get too much of a headache from it.)

quaternic avatar Sep 16 '25 20:09 quaternic

:warning: Warning :warning:

  • The following commits have merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

    • 43fc861484dc9dda855f415c41dea70043fb196e

    You can start a rebase with the following commands:

    $ # rebase
    $ git pull --rebase https://github.com/rust-lang/compiler-builtins.git master
    $ git push --force-with-lease
    

rustbot avatar Oct 22 '25 13:10 rustbot